Enchantments, some world, Biomes, bucks, world/gen/features.

This commit is contained in:
LexManos 2016-03-02 23:23:40 -08:00
parent b15667a7e6
commit b6bcf7bf4b
68 changed files with 1237 additions and 1103 deletions

View file

@ -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<IBlockState> target)
+ public boolean isReplaceableOreGen(IBlockState state, IBlockAccess world, BlockPos pos, com.google.common.base.Predicate<IBlockState> 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)
+ {

View file

@ -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 <i>all possible</i> 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};

View file

@ -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)
{

View file

@ -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);
+ }
}

View file

@ -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<BlockPos> affectedBlockPositions;
private final Map<EntityPlayer, Vec3d> 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<BlockPos> 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<Entity> 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; }
}

View file

@ -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<ChunkCoordIntPair> 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

View file

@ -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);
+ }

View file

@ -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)

View file

@ -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_)

View file

@ -32,3 +32,87 @@
}
public Class <? extends BiomeGenBase > getBiomeClass()
@@ -386,6 +387,83 @@
return this.enableSnow;
}
+ /* ========================================= FORGE START ======================================*/
+ protected List<FlowerEntry> flowers = new java.util.ArrayList<FlowerEntry>();
+
+ 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)));

View file

@ -7,7 +7,7 @@
+ @Override
+ public void addDefaultFlowers()
+ {
+ if (field_150632_aF != 1)
+ if (field_150632_aF != BiomeGenForest.Type.FLOWER)
+ {
+ super.addDefaultFlowers();
+ return;

View file

@ -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);
+ }

View file

@ -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<BiomeGenBase> 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;
+ }
}

View file

@ -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 @@
}
}
}

View file

@ -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);

View file

@ -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));
}

View file

@ -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));

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
+ }
}

View file

@ -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)
{

View file

@ -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));
+ }
}

View file

@ -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;

View file

@ -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;

View file

@ -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;
}

View file

@ -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);
+ }
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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);
+ }
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
+ }
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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)
{

View file

@ -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();

View file

@ -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);
}

View file

@ -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];

View file

@ -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)
{

View file

@ -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));
}

View file

@ -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 <i>all possible</i> 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<Enchantment> list = Lists.<Enchantment>newArrayList();
++++ END PATCH

View file

@ -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

View file

@ -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

View file

@ -1,18 +0,0 @@
++++ REJECTED PATCH 1
private final float explosionSize;
private final List<BlockPos> affectedBlockPositions;
private final Map<EntityPlayer, Vec3> 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<BlockPos> 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<Entity> 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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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<FlowerEntry> flowers = new java.util.ArrayList<FlowerEntry>();
+
+ 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

View file

@ -1,47 +0,0 @@
++++ REJECTED PATCH 1
public class WorldChunkManager
{
+ public static List<BiomeGenBase> 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.<BiomeGenBase>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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -1,15 +0,0 @@
++++ REJECTED PATCH 1
if (j3 == 1)
{
worldIn.setBlockState(blockpos2, Blocks.chest.correctFacing(worldIn, blockpos2, Blocks.chest.getDefaultState()), 2);
- List<WeightedRandomChestContent> 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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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<MapData.MapInfo> playersArrayList = Lists.<MapData.MapInfo>newArrayList();
++++ END PATCH

View file

@ -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

View file

@ -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;
}