Fix remaining issues preventing compilation, launching, and loading worlds (#5156)

Fix duplicate ID for ingredient serializers
Fix KeyBinding compile errors. No GuiKeyBindingList patches yet.
Implement controls GUI and WorldServer patches
This commit is contained in:
tterrag authored and LexManos committed 2018-09-21 19:07:48 -07:00
1 parent c191851ec0
commit d08f8e1a78
15 files changed
+645 -75

No files matched your search

@@ -296,7 +296,7 @@ public class DimensionManager
dimensions.get(id).ticksWaited = 0;
}
WorldServer ret = worlds.get(id);
if (ret != null && forceLoad)
if (ret == null && forceLoad)
{
initDimension(id);
ret = worlds.get(id);
@@ -295,20 +295,6 @@ public class ForgeHooks
return ret;
}
static
{
seedList.add(new SeedEntry(new ItemStack(Items.WHEAT_SEEDS), 10)
{
@Override
@Nonnull
public ItemStack getStack(Random rand, int fortune)
{
return new ItemStack(Items.WHEAT_SEEDS, 1 + rand.nextInt(fortune * 2 + 1));
}
});
initTools();
}
/**
* Called when a player uses 'pick block', calls new Entity and Block hooks.
*/
@@ -108,7 +108,7 @@ public class CraftingHelper
public static final IConditionSerializer CONDITION_FALSE = condition("false", json -> () -> false);
public static final IIngredientSerializer<IngredientNBT> INGREDIENT_NBT = register(new ResourceLocation("forge", "nbt"), new IngredientNBT.Serializer());
public static final IIngredientSerializer<CompoundIngredient> INGREDIENT_COMPOUND = register(new ResourceLocation("forge", "nbt"), new CompoundIngredient.Serializer());
public static final IIngredientSerializer<CompoundIngredient> INGREDIENT_COMPOUND = register(new ResourceLocation("forge", "compound"), new CompoundIngredient.Serializer());
public static final IIngredientSerializer<Ingredient> INGREDIENT_VANILLA = register(new ResourceLocation("minecraft", "item"), new IIngredientSerializer<Ingredient>() {
public Ingredient parse(PacketBuffer buffer) {
return Ingredient.func_209357_a(Stream.generate(() -> new Ingredient.SingleItemList(buffer.readItemStack())).limit(buffer.readVarInt()));
@@ -30,7 +30,10 @@ import net.minecraftforge.client.IRenderHandler;
public interface IForgeDimension
{
default Dimension getDimension() { return (Dimension) this; }
default Dimension getDimension()
{
return (Dimension) this;
}
/**
* Called from {@link World#initCapabilities()}, to gather capabilities for this
@@ -50,19 +53,21 @@ public interface IForgeDimension
}
/**
* The dimension's movement factor.
* Whenever a player or entity changes dimension from world A to world B, their coordinates are multiplied by
* The dimension's movement factor. Whenever a player or entity changes
* dimension from world A to world B, their coordinates are multiplied by
* worldA.provider.getMovementFactor() / worldB.provider.getMovementFactor()
* Example: Overworld factor is 1, nether factor is 8. Traveling from overworld to nether multiplies coordinates by 1/8.
* Example: Overworld factor is 1, nether factor is 8. Traveling from overworld
* to nether multiplies coordinates by 1/8.
*
* @return The movement factor
*/
default double getMovementFactor()
{
if (getDimension() instanceof NetherDimension)
{
return 8.0;
}
return 1.0;
if (getDimension() instanceof NetherDimension)
{
return 8.0;
}
return 1.0;
}
/**
@@ -96,4 +101,16 @@ public interface IForgeDimension
@OnlyIn(Dist.CLIENT)
void setWeatherRenderer(IRenderHandler renderer);
void resetRainAndThunder();
default boolean canDoLightning(net.minecraft.world.chunk.Chunk chunk)
{
return true;
}
default boolean canDoRainSnowIce(net.minecraft.world.chunk.Chunk chunk)
{
return true;
}
}
@@ -47,7 +47,6 @@ public interface IForgeFluidState
* @param material to test for.
* @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment.
*/
@Nullable
default boolean isEntityInside(IWorldReader world, BlockPos pos, Entity entity, double yToTest, Tag<Fluid> tag, boolean testingHead)
{
return getFluidState().func_206886_c().isEntityInside(getFluidState(), world, pos, entity, yToTest, tag, testingHead);