world.gen.feature patches, worldgen should be stable with vanilla. In all places I looked.

This commit is contained in:
LexManos committed 2018-12-06 18:09:47 -08:00
1 parent eb22f42fea
commit bbf1ea41b8
66 files changed
+1066 -1026

No files matched your search

@@ -22,7 +22,7 @@ package net.minecraftforge.common;
import java.util.ArrayList;
import java.util.Random;
import net.minecraft.util.ResourceLocation;
import net.minecraft.entity.EntityType;
import net.minecraft.util.WeightedRandom;
public class DungeonHooks
@@ -34,7 +34,7 @@ public class DungeonHooks
* If the mob is already in the spawn list, the rarity will be added to the existing one,
* causing the mob to be more common.
*
* @param name The name of the monster, use the same name used when registering the entity.
* @param type Monster type
* @param rarity The rarity of selecting this mob over others. Must be greater then 0.
* Vanilla Minecraft has the following mobs:
* Spider 100
@@ -43,7 +43,7 @@ public class DungeonHooks
* Meaning, Zombies are twice as common as spiders or skeletons.
* @return The new rarity of the monster,
*/
public static float addDungeonMob(ResourceLocation name, int rarity)
public static float addDungeonMob(EntityType<?> type, int rarity)
{
if (rarity <= 0)
{
@@ -52,13 +52,13 @@ public class DungeonHooks
for (DungeonMob mob : dungeonMobs)
{
if (name.equals(mob.type))
if (type == mob.type)
{
return mob.itemWeight += rarity;
}
}
dungeonMobs.add(new DungeonMob(rarity, name));
dungeonMobs.add(new DungeonMob(rarity, type));
return rarity;
}
@@ -68,11 +68,11 @@ public class DungeonHooks
* @param name The name of the mob to remove
* @return The rarity of the removed mob, prior to being removed.
*/
public static int removeDungeonMob(ResourceLocation name)
public static int removeDungeonMob(EntityType<?> name)
{
for (DungeonMob mob : dungeonMobs)
{
if (name.equals(mob.type))
if (name == mob.type)
{
dungeonMobs.remove(mob);
return mob.itemWeight;
@@ -86,7 +86,7 @@ public class DungeonHooks
* @param rand World generation random number generator
* @return The mob name
*/
public static ResourceLocation getRandomDungeonMob(Random rand)
public static EntityType<?> getRandomDungeonMob(Random rand)
{
DungeonMob mob = WeightedRandom.getRandomItem(rand, dungeonMobs);
return mob.type;
@@ -95,8 +95,8 @@ public class DungeonHooks
public static class DungeonMob extends WeightedRandom.Item
{
public ResourceLocation type;
public DungeonMob(int weight, ResourceLocation type)
public final EntityType<?> type;
public DungeonMob(int weight, EntityType<?> type)
{
super(weight);
this.type = type;
@@ -111,8 +111,8 @@ public class DungeonHooks
static
{
addDungeonMob(new ResourceLocation("skeleton"), 100);
addDungeonMob(new ResourceLocation("zombie"), 200);
addDungeonMob(new ResourceLocation("spider"), 100);
addDungeonMob(EntityType.SKELETON, 100);
addDungeonMob(EntityType.ZOMBIE, 200);
addDungeonMob(EntityType.SPIDER, 100);
}
}
@@ -35,6 +35,7 @@ public class Tags
public static final Tag<Block> CHESTS_TRAPPED = tag("chests/trapped");
public static final Tag<Block> CHESTS_WOODEN = tag("chests/wooden");
public static final Tag<Block> COBBLESTONE = tag("cobblestone");
public static final Tag<Block> DIRT = tag("dirt");
public static final Tag<Block> FENCE_GATES = tag("fence_gates");
public static final Tag<Block> FENCE_GATES_WOODEN = tag("fence_gates/wooden");
public static final Tag<Block> FENCES = tag("fences");
@@ -374,9 +374,9 @@ public interface IForgeBlock
* @param pos Block position in world
* @return true if this block can be replaced by growing leaves.
*/
default boolean canBeReplacedByLeaves(IBlockState state, IWorldReader world, BlockPos pos)
default boolean canBeReplacedByLeaves(IBlockState state, IWorldReaderBase world, BlockPos pos)
{
return isAir(state, world, pos) || state.isIn(BlockTags.LEAVES);
return (isAir(state, world, pos) || state.isIn(BlockTags.LEAVES)) || !state.isOpaqueCube(world, pos);
}
/**
@@ -390,7 +390,7 @@ public interface IForgeBlock
* @return True to allow this block to be replaced by a ore
*/
default boolean isReplaceableOreGen(IBlockState state, IWorldReader world, BlockPos pos, Predicate<IBlockState> target)
{ //TODO: Re-evaluate with new world gen
{
return target.test(state);
}
@@ -580,9 +580,9 @@ public interface IForgeBlock
* @param pos Block position in world
* @param source Source plant's position in world
*/
default void onPlantGrow(IBlockState state, World world, BlockPos pos, BlockPos source)
default void onPlantGrow(IBlockState state, IWorld world, BlockPos pos, BlockPos source)
{
if (this.getBlock() == Blocks.GRASS || this.getBlock() == Blocks.FARMLAND)
if (this.getBlock() == Blocks.GRASS || this.getBlock() == Blocks.FARMLAND || this.getBlock() == Blocks.AIR)
world.setBlockState(pos, Blocks.DIRT.getDefaultState(), 2);
}
@@ -36,6 +36,7 @@ import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.pathfinding.PathNodeType;
import net.minecraft.tags.BlockTags;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
@@ -184,7 +185,6 @@ public interface IForgeBlockState
return getBlockState().getBlock().canHarvestBlock(getBlockState(), world, pos, player);
}
/**
* Called when a player removes a block. This is responsible for
* actually destroying the block, and the block is intact at time of call.
@@ -323,7 +323,7 @@ public interface IForgeBlockState
* @param pos Block position in world
* @return true if this block can be replaced by growing leaves.
*/
default boolean canBeReplacedByLeaves(IWorldReader world, BlockPos pos)
default boolean canBeReplacedByLeaves(IWorldReaderBase world, BlockPos pos)
{
return getBlockState().getBlock().canBeReplacedByLeaves(getBlockState(), world, pos);
}
@@ -520,7 +520,7 @@ public interface IForgeBlockState
* @param pos Block position in world
* @param source Source plant's position in world
*/
default void onPlantGrow(World world, BlockPos pos, BlockPos source)
default void onPlantGrow(IWorld world, BlockPos pos, BlockPos source)
{
getBlockState().getBlock().onPlantGrow(getBlockState(), world, pos, source);
}