Patching and updates

This commit is contained in:
tterrag authored and cpw committed 2020-06-25 17:55:40 -04:00
1 parent 6d15febdb3
commit 631230b298
113 files changed
+1011 -3194

No files matched your search

@@ -369,80 +369,79 @@ public class BiomeDictionary
private static void registerVanillaBiomes()
{
addTypes(Biomes.OCEAN, OCEAN, OVERWORLD );
addTypes(Biomes.PLAINS, PLAINS, OVERWORLD );
addTypes(Biomes.DESERT, HOT, DRY, SANDY, OVERWORLD );
addTypes(Biomes.MOUNTAINS, MOUNTAIN, HILLS, OVERWORLD );
addTypes(Biomes.FOREST, FOREST, OVERWORLD );
addTypes(Biomes.TAIGA, COLD, CONIFEROUS, FOREST, OVERWORLD );
addTypes(Biomes.SWAMP, WET, SWAMP, OVERWORLD );
addTypes(Biomes.RIVER, RIVER, OVERWORLD );
addTypes(Biomes.field_235254_j_, HOT, DRY, NETHER );
addTypes(Biomes.THE_END, COLD, DRY, END );
addTypes(Biomes.FROZEN_OCEAN, COLD, OCEAN, SNOWY, OVERWORLD );
addTypes(Biomes.FROZEN_RIVER, COLD, RIVER, SNOWY, OVERWORLD );
addTypes(Biomes.SNOWY_TUNDRA, COLD, SNOWY, WASTELAND, OVERWORLD );
addTypes(Biomes.SNOWY_MOUNTAINS, COLD, SNOWY, MOUNTAIN, OVERWORLD );
addTypes(Biomes.MUSHROOM_FIELDS, MUSHROOM, RARE, OVERWORLD );
addTypes(Biomes.MUSHROOM_FIELD_SHORE, MUSHROOM, BEACH, RARE, OVERWORLD );
addTypes(Biomes.BEACH, BEACH, OVERWORLD );
addTypes(Biomes.DESERT_HILLS, HOT, DRY, SANDY, HILLS, OVERWORLD );
addTypes(Biomes.WOODED_HILLS, FOREST, HILLS, OVERWORLD );
addTypes(Biomes.TAIGA_HILLS, COLD, CONIFEROUS, FOREST, HILLS, OVERWORLD );
addTypes(Biomes.MOUNTAIN_EDGE, MOUNTAIN, OVERWORLD );
addTypes(Biomes.JUNGLE, HOT, WET, DENSE, JUNGLE, OVERWORLD );
addTypes(Biomes.JUNGLE_HILLS, HOT, WET, DENSE, JUNGLE, HILLS, OVERWORLD );
addTypes(Biomes.JUNGLE_EDGE, HOT, WET, JUNGLE, FOREST, RARE, OVERWORLD );
addTypes(Biomes.DEEP_OCEAN, OCEAN, OVERWORLD );
addTypes(Biomes.STONE_SHORE, BEACH, OVERWORLD );
addTypes(Biomes.SNOWY_BEACH, COLD, BEACH, SNOWY, OVERWORLD );
addTypes(Biomes.BIRCH_FOREST, FOREST, OVERWORLD );
addTypes(Biomes.BIRCH_FOREST_HILLS, FOREST, HILLS, OVERWORLD );
addTypes(Biomes.DARK_FOREST, SPOOKY, DENSE, FOREST, OVERWORLD );
addTypes(Biomes.SNOWY_TAIGA, COLD, CONIFEROUS, FOREST, SNOWY, OVERWORLD );
addTypes(Biomes.SNOWY_TAIGA_HILLS, COLD, CONIFEROUS, FOREST, SNOWY, HILLS, OVERWORLD );
addTypes(Biomes.GIANT_TREE_TAIGA, COLD, CONIFEROUS, FOREST, OVERWORLD );
addTypes(Biomes.GIANT_TREE_TAIGA_HILLS, COLD, CONIFEROUS, FOREST, HILLS, OVERWORLD );
addTypes(Biomes.WOODED_MOUNTAINS, MOUNTAIN, FOREST, SPARSE, OVERWORLD );
addTypes(Biomes.SAVANNA, HOT, SAVANNA, PLAINS, SPARSE, OVERWORLD );
addTypes(Biomes.SAVANNA_PLATEAU, HOT, SAVANNA, PLAINS, SPARSE, RARE, OVERWORLD, PLATEAU );
addTypes(Biomes.BADLANDS, MESA, SANDY, DRY, OVERWORLD );
addTypes(Biomes.WOODED_BADLANDS_PLATEAU, MESA, SANDY, DRY, SPARSE, OVERWORLD, PLATEAU );
addTypes(Biomes.BADLANDS_PLATEAU, MESA, SANDY, DRY, OVERWORLD, PLATEAU );
addTypes(Biomes.SMALL_END_ISLANDS, END );
addTypes(Biomes.END_MIDLANDS, END );
addTypes(Biomes.END_HIGHLANDS, END );
addTypes(Biomes.END_BARRENS, END );
addTypes(Biomes.WARM_OCEAN, OCEAN, HOT, OVERWORLD );
addTypes(Biomes.LUKEWARM_OCEAN, OCEAN, OVERWORLD );
addTypes(Biomes.COLD_OCEAN, OCEAN, COLD, OVERWORLD );
addTypes(Biomes.DEEP_WARM_OCEAN, OCEAN, HOT, OVERWORLD );
addTypes(Biomes.DEEP_LUKEWARM_OCEAN, OCEAN, OVERWORLD );
addTypes(Biomes.DEEP_COLD_OCEAN, OCEAN, COLD, OVERWORLD );
addTypes(Biomes.DEEP_FROZEN_OCEAN, OCEAN, COLD, OVERWORLD );
addTypes(Biomes.THE_VOID, VOID );
addTypes(Biomes.SUNFLOWER_PLAINS, PLAINS, RARE, OVERWORLD );
addTypes(Biomes.DESERT_LAKES, HOT, DRY, SANDY, RARE, OVERWORLD );
addTypes(Biomes.GRAVELLY_MOUNTAINS, MOUNTAIN, SPARSE, RARE, OVERWORLD );
addTypes(Biomes.FLOWER_FOREST, FOREST, HILLS, RARE, OVERWORLD );
addTypes(Biomes.TAIGA_MOUNTAINS, COLD, CONIFEROUS, FOREST, MOUNTAIN, RARE, OVERWORLD );
addTypes(Biomes.SWAMP_HILLS, WET, SWAMP, HILLS, RARE, OVERWORLD );
addTypes(Biomes.ICE_SPIKES, COLD, SNOWY, HILLS, RARE, OVERWORLD );
addTypes(Biomes.MODIFIED_JUNGLE, HOT, WET, DENSE, JUNGLE, MOUNTAIN, RARE, OVERWORLD, MODIFIED);
addTypes(Biomes.MODIFIED_JUNGLE_EDGE, HOT, SPARSE, JUNGLE, HILLS, RARE, OVERWORLD, MODIFIED );
addTypes(Biomes.TALL_BIRCH_FOREST, FOREST, DENSE, HILLS, RARE, OVERWORLD );
addTypes(Biomes.TALL_BIRCH_HILLS, FOREST, DENSE, MOUNTAIN, RARE, OVERWORLD );
addTypes(Biomes.DARK_FOREST_HILLS, SPOOKY, DENSE, FOREST, MOUNTAIN, RARE, OVERWORLD );
addTypes(Biomes.SNOWY_TAIGA_MOUNTAINS, COLD, CONIFEROUS, FOREST, SNOWY, MOUNTAIN, RARE, OVERWORLD);
addTypes(Biomes.GIANT_SPRUCE_TAIGA, DENSE, FOREST, RARE, OVERWORLD );
addTypes(Biomes.GIANT_SPRUCE_TAIGA_HILLS, DENSE, FOREST, HILLS, RARE, OVERWORLD );
addTypes(Biomes.MODIFIED_GRAVELLY_MOUNTAINS, MOUNTAIN, SPARSE, RARE, OVERWORLD, MODIFIED );
addTypes(Biomes.SHATTERED_SAVANNA, HOT, DRY, SPARSE, SAVANNA, MOUNTAIN, RARE, OVERWORLD);
addTypes(Biomes.SHATTERED_SAVANNA_PLATEAU, HOT, DRY, SPARSE, SAVANNA, HILLS, RARE, OVERWORLD, PLATEAU);
addTypes(Biomes.ERODED_BADLANDS, HOT, DRY, SPARSE, MOUNTAIN, RARE, OVERWORLD);
addTypes(Biomes.MODIFIED_WOODED_BADLANDS_PLATEAU, HOT, DRY, SPARSE, HILLS, RARE, OVERWORLD, PLATEAU, MODIFIED );
addTypes(Biomes.MODIFIED_BADLANDS_PLATEAU, HOT, DRY, SPARSE, MOUNTAIN, RARE, OVERWORLD, PLATEAU, MODIFIED);
addTypes(Biomes.OCEAN, OCEAN, OVERWORLD);
addTypes(Biomes.PLAINS, PLAINS, OVERWORLD);
addTypes(Biomes.DESERT, HOT, DRY, SANDY, OVERWORLD);
addTypes(Biomes.MOUNTAINS, MOUNTAIN, HILLS, OVERWORLD);
addTypes(Biomes.FOREST, FOREST, OVERWORLD);
addTypes(Biomes.TAIGA, COLD, CONIFEROUS, FOREST, OVERWORLD);
addTypes(Biomes.SWAMP, WET, SWAMP, OVERWORLD);
addTypes(Biomes.RIVER, RIVER, OVERWORLD);
addTypes(Biomes.field_235254_j_, HOT, DRY, NETHER);
addTypes(Biomes.THE_END, COLD, DRY, END);
addTypes(Biomes.FROZEN_OCEAN, COLD, OCEAN, SNOWY, OVERWORLD);
addTypes(Biomes.FROZEN_RIVER, COLD, RIVER, SNOWY, OVERWORLD);
addTypes(Biomes.SNOWY_TUNDRA, COLD, SNOWY, WASTELAND, OVERWORLD);
addTypes(Biomes.SNOWY_MOUNTAINS, COLD, SNOWY, MOUNTAIN, OVERWORLD);
addTypes(Biomes.MUSHROOM_FIELDS, MUSHROOM, RARE, OVERWORLD);
addTypes(Biomes.MUSHROOM_FIELD_SHORE, MUSHROOM, BEACH, RARE, OVERWORLD);
addTypes(Biomes.BEACH, BEACH, OVERWORLD);
addTypes(Biomes.DESERT_HILLS, HOT, DRY, SANDY, HILLS, OVERWORLD);
addTypes(Biomes.WOODED_HILLS, FOREST, HILLS, OVERWORLD);
addTypes(Biomes.TAIGA_HILLS, COLD, CONIFEROUS, FOREST, HILLS, OVERWORLD);
addTypes(Biomes.MOUNTAIN_EDGE, MOUNTAIN, OVERWORLD);
addTypes(Biomes.JUNGLE, HOT, WET, DENSE, JUNGLE, OVERWORLD);
addTypes(Biomes.JUNGLE_HILLS, HOT, WET, DENSE, JUNGLE, HILLS, OVERWORLD);
addTypes(Biomes.JUNGLE_EDGE, HOT, WET, JUNGLE, FOREST, RARE, OVERWORLD);
addTypes(Biomes.DEEP_OCEAN, OCEAN, OVERWORLD);
addTypes(Biomes.STONE_SHORE, BEACH, OVERWORLD);
addTypes(Biomes.SNOWY_BEACH, COLD, BEACH, SNOWY, OVERWORLD);
addTypes(Biomes.BIRCH_FOREST, FOREST, OVERWORLD);
addTypes(Biomes.BIRCH_FOREST_HILLS, FOREST, HILLS, OVERWORLD);
addTypes(Biomes.DARK_FOREST, SPOOKY, DENSE, FOREST, OVERWORLD);
addTypes(Biomes.SNOWY_TAIGA, COLD, CONIFEROUS, FOREST, SNOWY, OVERWORLD);
addTypes(Biomes.SNOWY_TAIGA_HILLS, COLD, CONIFEROUS, FOREST, SNOWY, HILLS, OVERWORLD);
addTypes(Biomes.GIANT_TREE_TAIGA, COLD, CONIFEROUS, FOREST, OVERWORLD);
addTypes(Biomes.GIANT_TREE_TAIGA_HILLS, COLD, CONIFEROUS, FOREST, HILLS, OVERWORLD);
addTypes(Biomes.WOODED_MOUNTAINS, MOUNTAIN, FOREST, SPARSE, OVERWORLD);
addTypes(Biomes.SAVANNA, HOT, SAVANNA, PLAINS, SPARSE, OVERWORLD);
addTypes(Biomes.SAVANNA_PLATEAU, HOT, SAVANNA, PLAINS, SPARSE, RARE, OVERWORLD, PLATEAU);
addTypes(Biomes.BADLANDS, MESA, SANDY, DRY, OVERWORLD);
addTypes(Biomes.WOODED_BADLANDS_PLATEAU, MESA, SANDY, DRY, SPARSE, OVERWORLD, PLATEAU);
addTypes(Biomes.BADLANDS_PLATEAU, MESA, SANDY, DRY, OVERWORLD, PLATEAU);
addTypes(Biomes.SMALL_END_ISLANDS, END);
addTypes(Biomes.END_MIDLANDS, END);
addTypes(Biomes.END_HIGHLANDS, END);
addTypes(Biomes.END_BARRENS, END);
addTypes(Biomes.WARM_OCEAN, OCEAN, HOT, OVERWORLD);
addTypes(Biomes.LUKEWARM_OCEAN, OCEAN, OVERWORLD);
addTypes(Biomes.COLD_OCEAN, OCEAN, COLD, OVERWORLD);
addTypes(Biomes.DEEP_WARM_OCEAN, OCEAN, HOT, OVERWORLD);
addTypes(Biomes.DEEP_LUKEWARM_OCEAN, OCEAN, OVERWORLD);
addTypes(Biomes.DEEP_COLD_OCEAN, OCEAN, COLD, OVERWORLD);
addTypes(Biomes.DEEP_FROZEN_OCEAN, OCEAN, COLD, OVERWORLD);
addTypes(Biomes.THE_VOID, VOID);
addTypes(Biomes.SUNFLOWER_PLAINS, PLAINS, RARE, OVERWORLD);
addTypes(Biomes.DESERT_LAKES, HOT, DRY, SANDY, RARE, OVERWORLD);
addTypes(Biomes.GRAVELLY_MOUNTAINS, MOUNTAIN, SPARSE, RARE, OVERWORLD);
addTypes(Biomes.FLOWER_FOREST, FOREST, HILLS, RARE, OVERWORLD);
addTypes(Biomes.TAIGA_MOUNTAINS, COLD, CONIFEROUS, FOREST, MOUNTAIN, RARE, OVERWORLD);
addTypes(Biomes.SWAMP_HILLS, WET, SWAMP, HILLS, RARE, OVERWORLD);
addTypes(Biomes.ICE_SPIKES, COLD, SNOWY, HILLS, RARE, OVERWORLD);
addTypes(Biomes.MODIFIED_JUNGLE, HOT, WET, DENSE, JUNGLE, MOUNTAIN, RARE, OVERWORLD, MODIFIED);
addTypes(Biomes.MODIFIED_JUNGLE_EDGE, HOT, SPARSE, JUNGLE, HILLS, RARE, OVERWORLD, MODIFIED);
addTypes(Biomes.TALL_BIRCH_FOREST, FOREST, DENSE, HILLS, RARE, OVERWORLD);
addTypes(Biomes.TALL_BIRCH_HILLS, FOREST, DENSE, MOUNTAIN, RARE, OVERWORLD);
addTypes(Biomes.DARK_FOREST_HILLS, SPOOKY, DENSE, FOREST, MOUNTAIN, RARE, OVERWORLD);
addTypes(Biomes.SNOWY_TAIGA_MOUNTAINS, COLD, CONIFEROUS, FOREST, SNOWY, MOUNTAIN, RARE, OVERWORLD);
addTypes(Biomes.GIANT_SPRUCE_TAIGA, DENSE, FOREST, RARE, OVERWORLD);
addTypes(Biomes.GIANT_SPRUCE_TAIGA_HILLS, DENSE, FOREST, HILLS, RARE, OVERWORLD);
addTypes(Biomes.MODIFIED_GRAVELLY_MOUNTAINS, MOUNTAIN, SPARSE, RARE, OVERWORLD, MODIFIED);
addTypes(Biomes.SHATTERED_SAVANNA, HOT, DRY, SPARSE, SAVANNA, MOUNTAIN, RARE, OVERWORLD);
addTypes(Biomes.SHATTERED_SAVANNA_PLATEAU, HOT, DRY, SPARSE, SAVANNA, HILLS, RARE, OVERWORLD, PLATEAU);
addTypes(Biomes.ERODED_BADLANDS, HOT, DRY, SPARSE, MOUNTAIN, RARE, OVERWORLD);
addTypes(Biomes.MODIFIED_WOODED_BADLANDS_PLATEAU, HOT, DRY, SPARSE, HILLS, RARE, OVERWORLD, PLATEAU, MODIFIED);
addTypes(Biomes.MODIFIED_BADLANDS_PLATEAU, HOT, DRY, SPARSE, MOUNTAIN, RARE, OVERWORLD, PLATEAU, MODIFIED);
if (DEBUG)
{
@@ -218,7 +218,8 @@ public class ForgeHooks
blocks.forEach(block -> blockToolSetter.accept(block, ToolType.PICKAXE, 0));
blocks = getPrivateValue(ShovelItem.class, null, 0);
blocks.forEach(block -> blockToolSetter.accept(block, ToolType.SHOVEL, 0));
blocks = getPrivateValue(AxeItem.class, null, 0);
//TODO Axes check Material and Blocks now.
blocks = getPrivateValue(AxeItem.class, null, 1);
blocks.forEach(block -> blockToolSetter.accept(block, ToolType.AXE, 0));
//This is taken from ItemAxe, if that changes update here.
@@ -796,7 +797,7 @@ public class ForgeHooks
}
@Nullable
public static LootTable loadLootTable(Gson gson, ResourceLocation name, JsonObject data, boolean custom, LootTableManager lootTableManager)
public static LootTable loadLootTable(Gson gson, ResourceLocation name, JsonElement data, boolean custom, LootTableManager lootTableManager)
{
Deque<LootTableContext> que = lootContext.get();
if (que == null)
@@ -821,10 +822,8 @@ public class ForgeHooks
if (!custom)
ret = ForgeEventFactory.loadLootTable(name, ret, lootTableManager);
/* TODO:
if (ret != null)
ret.freeze();
*/
if (ret != null)
ret.freeze();
return ret;
}
@@ -19,6 +19,8 @@
package net.minecraftforge.common;
import net.minecraft.entity.ai.attributes.Attribute;
import net.minecraft.entity.ai.attributes.RangedAttribute;
import net.minecraft.util.SoundEvent;
import net.minecraft.world.storage.IServerConfiguration;
import net.minecraft.world.storage.IWorldInfo;
@@ -33,6 +35,8 @@ import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import net.minecraftforge.fml.event.server.FMLServerStoppingEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.server.command.ConfigCommand;
import net.minecraftforge.server.command.ForgeCommand;
import net.minecraftforge.versions.forge.ForgeVersion;
@@ -84,6 +88,12 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
private static final Logger LOGGER = LogManager.getLogger();
private static final Marker FORGEMOD = MarkerManager.getMarker("FORGEMOD");
private static final DeferredRegister<Attribute> ATTRIBUTES = DeferredRegister.create(Attribute.class, "forge");
public static final RegistryObject<Attribute> SWIM_SPEED = ATTRIBUTES.register("swim_speed", () -> new RangedAttribute("forge.swimSpeed", 1.0D, 0.0D, 1024.0D).func_233753_a_(true));
public static final RegistryObject<Attribute> NAMETAG_DISTANCE = ATTRIBUTES.register("nametag_distance", () -> new RangedAttribute("forge.nameTagDistance", 64.0D, 0.0D, Float.MAX_VALUE).func_233753_a_(true));
public static final RegistryObject<Attribute> ENTITY_GRAVITY = ATTRIBUTES.register("entity_gravity", () -> new RangedAttribute("forge.entity_gravity", 0.08D, -8.0D, 8.0D).func_233753_a_(true));
private static ForgeMod INSTANCE;
public static ForgeMod getInstance()
{
@@ -101,6 +111,7 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
modEventBus.addListener(this::preInit);
modEventBus.addListener(this::gatherData);
modEventBus.register(this);
ATTRIBUTES.register(modEventBus);
MinecraftForge.EVENT_BUS.addListener(this::serverStarting);
MinecraftForge.EVENT_BUS.addListener(this::serverStopping);
MinecraftForge.EVENT_BUS.addGenericListener(SoundEvent.class, this::missingSoundMapping);
@@ -367,11 +367,10 @@ public interface IForgeBlock
*
* @param world The current world
* @param pos Block position in world
* @param exploder The entity that caused the explosion, can be null
* @param explosion The explosion
* @return The amount of the explosion absorbed.
*/
default float getExplosionResistance(BlockState state, IWorldReader world, BlockPos pos, @Nullable Entity exploder, Explosion explosion)
default float getExplosionResistance(BlockState state, IBlockReader world, BlockPos pos, Explosion explosion)
{
return this.getBlock().getExplosionResistance();
}
@@ -311,13 +311,12 @@ public interface IForgeBlockState
*
* @param world The current world
* @param pos Block position in world
* @param exploder The entity that caused the explosion, can be null
* @param explosion The explosion
* @return The amount of the explosion absorbed.
*/
default float getExplosionResistance(IWorldReader world, BlockPos pos, @Nullable Entity exploder, Explosion explosion)
default float getExplosionResistance(IBlockReader world, BlockPos pos, Explosion explosion)
{
return getBlockState().getBlock().getExplosionResistance(getBlockState(), world, pos, exploder, explosion);
return getBlockState().getBlock().getExplosionResistance(getBlockState(), world, pos, explosion);
}
/**
@@ -1,266 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2019.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*package net.minecraftforge.common.extensions;
import javax.annotation.Nullable;
import net.minecraft.client.audio.MusicTicker;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biomes;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.dimension.Dimension;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.dimension.NetherDimension;
import net.minecraft.world.storage.WorldInfo;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.IRenderHandler;
public interface IForgeDimension
{
default Dimension getDimension()
{
return (Dimension) this;
}
World getWorld();
/**
* Called from {@link World#initCapabilities()}, to gather capabilities for this
* world. It's safe to access world here since this is called after world is
* registered.
*
* On server, called directly after mapStorage and world data such as Scoreboard
* and VillageCollection are initialized. On client, called when world is
* constructed, just before world load event is called. Note that this method is
* always called before the world load event.
*
* @return initial holder for capabilities on the world
* /
default net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities()
{
return null;
}
/**
* 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.
*
* @return The movement factor
* /
default double getMovementFactor()
{
if (getDimension() instanceof NetherDimension)
{
return 8.0;
}
return 1.0;
}
@OnlyIn(Dist.CLIENT)
@Nullable
IRenderHandler getSkyRenderer();
@OnlyIn(Dist.CLIENT)
void setSkyRenderer(IRenderHandler skyRenderer);
@OnlyIn(Dist.CLIENT)
@Nullable
IRenderHandler getCloudRenderer();
@OnlyIn(Dist.CLIENT)
void setCloudRenderer(IRenderHandler renderer);
@OnlyIn(Dist.CLIENT)
@Nullable
IRenderHandler getWeatherRenderer();
@OnlyIn(Dist.CLIENT)
void setWeatherRenderer(IRenderHandler renderer);
/**
* Allows for manipulating the coloring of the lightmap texture.
* Will be called for each 16*16 combination of sky/block light values.
*
* @param partialTicks Progress between ticks.
* @param sunBrightness Current sun brightness.
* @param skyLight Sky light brightness factor.
* @param blockLight Block light brightness factor.
* @param colors The color values that will be used: [r, g, b].
*
* @see net.minecraft.client.renderer.GameRenderer#updateLightmap(float)
* /
default void getLightmapColors(float partialTicks, float sunBrightness, float skyLight, float blockLight, Vector3f colors) {}
void resetRainAndThunder();
default boolean canDoLightning(Chunk chunk)
{
return true;
}
default boolean canDoRainSnowIce(Chunk chunk)
{
return true;
}
/**
* Called on the client to get the music type to play when in this world type.
* At the time of calling, the client player and world are guaranteed to be non-null
* @return null to use vanilla logic, otherwise a MusicType to play in this world
* /
@Nullable
@OnlyIn(Dist.CLIENT)
default MusicTicker.MusicType getMusicType()
{
return null;
}
/**
* Determines if the player can sleep in this world (or if the bed should explode for example).
*
* @param player The player that is attempting to sleep
* @param pos The location where the player tries to sleep at (the position of the clicked on bed for example)
* @return the result of a player trying to sleep at the given location
* /
default SleepResult canSleepAt(net.minecraft.entity.player.PlayerEntity player, BlockPos pos)
{
return (getDimension().canRespawnHere() && getWorld().getBiome(pos) != Biomes.NETHER) ? SleepResult.ALLOW : SleepResult.BED_EXPLODES;
}
enum SleepResult
{
ALLOW,
DENY,
BED_EXPLODES;
}
default boolean isDaytime()
{
return getDimension().getType() == DimensionType.OVERWORLD && getWorld().getSkylightSubtracted() < 4;
}
/**
* Calculates the current moon phase factor.
* This factor is effective for slimes.
* (This method do not affect the moon rendering)
* * /
default float getCurrentMoonPhaseFactor(long time)
{
return Dimension.MOON_PHASE_FACTORS[this.getDimension().getMoonPhase(time)];
}
default void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful) { }
default void calculateInitialWeather()
{
getWorld().calculateInitialWeatherBody();
}
default void updateWeather(Runnable defaultLogic)
{
defaultLogic.run();
}
default long getSeed()
{
return getWorld().getWorldInfo().getSeed();
}
default long getWorldTime()
{
return getWorld().getWorldInfo().getDayTime();
}
default void setWorldTime(long time)
{
getWorld().getWorldInfo().setDayTime(time);
}
default BlockPos getSpawnPoint()
{
WorldInfo info = getWorld().getWorldInfo();
return new BlockPos(info.getSpawnX(), info.getSpawnY(), info.getSpawnZ());
}
default void setSpawnPoint(BlockPos pos)
{
getWorld().getWorldInfo().setSpawn(pos);
}
default boolean canMineBlock(PlayerEntity player, BlockPos pos)
{
return getWorld().canMineBlockBody(player, pos);
}
default boolean isHighHumidity(BlockPos pos)
{
return getWorld().getBiome(pos).isHighHumidity();
}
default int getHeight()
{
return 256;
}
default int getActualHeight()
{
return getDimension().isNether() ? 128 : 256;
}
default int getSeaLevel()
{
return 63;
}
/**
* Determine if the cursor on the map should 'spin' when rendered, like it does for the player in the nether.
*
* @param entity The entity holding the map, playername, or frame-ENTITYID
* @param x X Position
* @param z Z Position
* @param rotation the regular rotation of the marker
* @return True to 'spin' the cursor
* /
default boolean shouldMapSpin(String entity, double x, double z, double rotation)
{
return getDimension().getType() == DimensionType.THE_NETHER;
}
/**
* Determines the dimension the player will be respawned in, typically this brings them back to the overworld.
*
* @param player The player that is respawning
* @return The dimension to respawn the player in
* /
default DimensionType getRespawnDimension(ServerPlayerEntity player)
{
return player.getSpawnDimension();
}
}*/
@@ -33,6 +33,7 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraftforge.fluids.FluidAttributes;
@@ -94,11 +95,10 @@ public interface IForgeFluid
*
* @param world The current world
* @param pos Block position in world
* @param exploder The entity that caused the explosion, can be null
* @param explosion The explosion
* @return The amount of the explosion absorbed.
*/
default float getExplosionResistance(FluidState state, IWorldReader world, BlockPos pos, @Nullable Entity exploder, Explosion explosion)
default float getExplosionResistance(FluidState state, IBlockReader world, BlockPos pos, Explosion explosion)
{
return state.getExplosionResistance();
}
@@ -28,6 +28,7 @@ import net.minecraft.fluid.FluidState;
import net.minecraft.tags.Tag;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
public interface IForgeFluidState
@@ -61,15 +62,14 @@ public interface IForgeFluidState
*
* @param world The current world
* @param pos Block position in world
* @param exploder The entity that caused the explosion, can be null
* @param explosion The explosion
* @return The amount of the explosion absorbed.
*/
default float getExplosionResistance(IWorldReader world, BlockPos pos, @Nullable Entity exploder, Explosion explosion)
default float getExplosionResistance(IBlockReader world, BlockPos pos, Explosion explosion)
{
return getFluidState().getFluid().getExplosionResistance(getFluidState(), world, pos, exploder, explosion);
return getFluidState().getFluid().getExplosionResistance(getFluidState(), world, pos, explosion);
}
/**
* Queries if this fluidstate should render in a given layer.
* A custom {@link IBakedModel} can use {@link net.minecraftforge.client.MinecraftForgeClient#getRenderLayer()} to alter the model based on layer.
@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.client.extensions;
package net.minecraftforge.common.extensions;
public interface IForgeResourcePack
{
@@ -1,128 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2019.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*package net.minecraftforge.common.extensions;
import java.util.function.LongFunction;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.CreateBuffetWorldScreen;
import net.minecraft.client.gui.screen.CreateFlatWorldScreen;
import net.minecraft.client.gui.screen.CreateWorldScreen;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraft.world.WorldType;
import net.minecraft.world.gen.ChunkGenerator;
import net.minecraft.world.gen.IExtendedNoiseRandom;
import net.minecraft.world.gen.OverworldGenSettings;
import net.minecraft.world.gen.area.IArea;
import net.minecraft.world.gen.area.IAreaFactory;
import net.minecraft.world.gen.layer.AddBambooForestLayer;
import net.minecraft.world.gen.layer.BiomeLayer;
import net.minecraft.world.gen.layer.EdgeBiomeLayer;
import net.minecraft.world.gen.layer.ZoomLayer;
import net.minecraft.world.gen.layer.LayerUtil;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public interface IForgeWorldType
{
default WorldType getWorldType()
{
return (WorldType) this;
}
/**
* Called when 'Create New World' button is pressed before starting game
* /
default void onGUICreateWorldPress()
{
}
/**
* Called when the 'Customize' button is pressed on world creation GUI
*
* @param mc The Minecraft instance
* @param gui the createworld GUI
* /
@OnlyIn(Dist.CLIENT)
default void onCustomizeButton(Minecraft mc, CreateWorldScreen gui)
{
if (this == WorldType.FLAT)
mc.displayGuiScreen(new CreateFlatWorldScreen(gui, gui.chunkProviderSettingsJson));
else if (this == WorldType.BUFFET)
mc.displayGuiScreen(new CreateBuffetWorldScreen(gui, gui.chunkProviderSettingsJson));
}
default boolean handleSlimeSpawnReduction(java.util.Random random, IWorld world)
{
return this == WorldType.FLAT ? random.nextInt(4) != 1 : false;
}
default double getHorizon(World world)
{
return this == WorldType.FLAT ? 0.0D : 63.0D;
}
default double voidFadeMagnitude()
{
return this == WorldType.FLAT ? 1.0D : 0.03125D;
}
/**
* Get the height to render the clouds for this world type
*
* @return The height to render clouds at
* /
default float getCloudHeight()
{
return 128.0F;
}
@SuppressWarnings("deprecation")
default ChunkGenerator<?> createChunkGenerator(World world)
{
return world.dimension.createChunkGenerator();
}
/**
* Allows modifying the {@link IAreaFactory} used for this type's biome
* generation.
*
* @param <T> The type of {@link IArea}.
* @param <C> The type of {@link IContextExtended}.
*
* @param parentLayer The parent layer to feed into any layer you return
* @param chunkSettings The {@link OverworldGenSettings} used to create the
* {@link GenLayerBiome}.
* @param contextFactory A {@link LongFunction} factory to create contexts of
* the supplied size.
* @return An {@link IAreaFactory} that representing the Biomes to be generated.
* @see {@link GenLayerBiome}
* /
default <T extends IArea, C extends IExtendedNoiseRandom<T>> IAreaFactory<T> getBiomeLayer(IAreaFactory<T> parentLayer,
OverworldGenSettings chunkSettings, LongFunction<C> contextFactory)
{
parentLayer = (new BiomeLayer(getWorldType(), chunkSettings.getBiomeId())).apply(contextFactory.apply(200L), parentLayer);
parentLayer = AddBambooForestLayer.INSTANCE.apply(contextFactory.apply(1001L), parentLayer);
parentLayer = LayerUtil.repeat(1000L, ZoomLayer.NORMAL, parentLayer, 2, contextFactory);
parentLayer = EdgeBiomeLayer.INSTANCE.apply(contextFactory.apply(1000L), parentLayer);
return parentLayer;
}
}*/
@@ -73,6 +73,7 @@ import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.WorldSettings;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.storage.IServerWorldInfo;
import net.minecraft.world.storage.PlayerData;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -484,7 +485,7 @@ public class ForgeEventFactory
MinecraftForge.EVENT_BUS.post(new ExplosionEvent.Detonate(world, explosion, list));
}
public static boolean onCreateWorldSpawn(World world, WorldSettings settings)
public static boolean onCreateWorldSpawn(World world, IServerWorldInfo settings)
{
return MinecraftForge.EVENT_BUS.post(new WorldEvent.CreateSpawnPosition(world, settings));
}
@@ -32,6 +32,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld;
import net.minecraft.world.WorldSettings;
import net.minecraft.world.biome.Biome.SpawnListEntry;
import net.minecraft.world.storage.IServerWorldInfo;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
@@ -163,14 +164,14 @@ public class WorldEvent extends Event
@net.minecraftforge.eventbus.api.Cancelable
public static class CreateSpawnPosition extends WorldEvent
{
private final WorldSettings settings;
public CreateSpawnPosition(IWorld world, WorldSettings settings)
private final IServerWorldInfo settings;
public CreateSpawnPosition(IWorld world, IServerWorldInfo settings)
{
super(world);
this.settings = settings;
}
public WorldSettings getSettings()
public IServerWorldInfo getSettings()
{
return settings;
}
@@ -285,11 +285,6 @@ public class ModLoader
this.loadingWarnings.add(warning);
}
@Deprecated //Remove in 1.16
public void runDataGenerator(final Set<String> mods, final Path path, final Collection<Path> inputs, Collection<Path> existingPacks, final boolean serverGenerators, final boolean clientGenerators, final boolean devToolGenerators, final boolean reportsGenerator, final boolean structureValidator) {
runDataGenerator(mods, path, inputs, existingPacks, serverGenerators, clientGenerators, devToolGenerators, reportsGenerator, structureValidator, false);
}
public void runDataGenerator(final Set<String> mods, final Path path, final Collection<Path> inputs, Collection<Path> existingPacks, final boolean serverGenerators, final boolean clientGenerators, final boolean devToolGenerators, final boolean reportsGenerator, final boolean structureValidator, final boolean flat) {
if (mods.contains("minecraft") && mods.size() == 1) return;
LOGGER.info("Initializing Data Gatherer for mods {}", mods);
@@ -23,6 +23,7 @@ import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import net.minecraft.resources.IResource;
import net.minecraft.resources.IResourceManager;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.JSONUtils;
import net.minecraft.util.ResourceLocation;
@@ -80,16 +81,16 @@ public class LanguageHook
private static void loadLanguage(String langName, MinecraftServer server) {
String langFile = String.format("lang/%s.json", langName);
//TODO
// server.getResourceManager().getResourceNamespaces().forEach(namespace -> {
// try {
// ResourceLocation langResource = new ResourceLocation(namespace, langFile);
// loadLocaleData(server.getResourceManager().getAllResources(langResource));
// } catch (FileNotFoundException fnfe) {
// } catch (Exception exception) {
// LOGGER.warn("Skipped language file: {}:{}", namespace, langFile, exception);
// }
// });
IResourceManager resourceManager = server.getDataPackRegistries().func_240970_h_();
resourceManager.getResourceNamespaces().forEach(namespace -> {
try {
ResourceLocation langResource = new ResourceLocation(namespace, langFile);
loadLocaleData(resourceManager.getAllResources(langResource));
} catch (FileNotFoundException fnfe) {
} catch (Exception exception) {
LOGGER.warn("Skipped language file: {}:{}", namespace, langFile, exception);
}
});
}
@@ -31,7 +31,7 @@ import java.util.function.BiConsumer;
import java.util.function.Consumer;
import net.minecraft.resources.IPackNameDecorator;
import net.minecraft.world.storage.FolderNames;
import net.minecraft.world.storage.FolderName;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.Marker;
@@ -73,7 +73,7 @@ public class ServerLifecycleHooks
{
private static final Logger LOGGER = LogManager.getLogger();
private static final Marker SERVERHOOKS = MarkerManager.getMarker("SERVERHOOKS");
private static final FolderNames SERVERCONFIG = new FolderNames("serverconfig");
private static final FolderName SERVERCONFIG = new FolderName("serverconfig");
private static volatile CountDownLatch exitLatch = null;
private static MinecraftServer currentServer;
@@ -89,7 +89,6 @@ public class ServerLifecycleHooks
currentServer = server;
LogicalSidedProvider.setServer(()->server);
ConfigTracker.INSTANCE.loadConfigs(ModConfig.Type.SERVER, getServerConfigPath(server));
ResourcePackLoader.loadResourcePacks(currentServer.getResourcePacks(), ServerLifecycleHooks::buildPackFinder);
return !MinecraftForge.EVENT_BUS.post(new FMLServerAboutToStartEvent(server));
}
@@ -207,7 +206,9 @@ public class ServerLifecycleHooks
System.exit(retVal);
}
private static <T extends ResourcePackInfo> ResourcePackLoader.IPackInfoFinder<T> buildPackFinder(Map<ModFile, ? extends ModFileResourcePack> modResourcePacks, BiConsumer<? super ModFileResourcePack, ? super T> packSetter) {
//INTERNAL MODDERS DO NOT USE
@Deprecated
public static <T extends ResourcePackInfo> ResourcePackLoader.IPackInfoFinder<T> buildPackFinder(Map<ModFile, ? extends ModFileResourcePack> modResourcePacks, BiConsumer<? super ModFileResourcePack, ? super T> packSetter) {
return (packList, factory) -> serverPackFinder(modResourcePacks, packSetter, packList, factory);
}
@@ -22,6 +22,7 @@ package net.minecraftforge.registries;
import net.minecraft.block.Block;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.ai.attributes.Attribute;
import net.minecraft.entity.ai.brain.memory.MemoryModuleType;
import net.minecraft.entity.ai.brain.schedule.Activity;
import net.minecraft.entity.ai.brain.schedule.Schedule;
@@ -77,6 +78,7 @@ public class ForgeRegistries
public static final IForgeRegistry<ContainerType<?>> CONTAINERS = RegistryManager.ACTIVE.getRegistry(ContainerType.class);
public static final IForgeRegistry<PaintingType> PAINTING_TYPES = RegistryManager.ACTIVE.getRegistry(PaintingType.class);
public static final IForgeRegistry<IRecipeSerializer<?>> RECIPE_SERIALIZERS = RegistryManager.ACTIVE.getRegistry(IRecipeSerializer.class);
public static final IForgeRegistry<Attribute> ATTRIBUTES = RegistryManager.ACTIVE.getRegistry(Attribute.class);
public static final IForgeRegistry<StatType<?>> STAT_TYPES = RegistryManager.ACTIVE.getRegistry(StatType.class);
// Villages
@@ -27,6 +27,8 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.ai.attributes.Attribute;
import net.minecraft.entity.ai.attributes.GlobalEntityTypeAttributes;
import net.minecraft.entity.ai.brain.memory.MemoryModuleType;
import net.minecraft.entity.ai.brain.schedule.Activity;
import net.minecraft.entity.ai.brain.schedule.Schedule;
@@ -122,6 +124,7 @@ public class GameData
public static final ResourceLocation CONTAINERS = new ResourceLocation("menu");
public static final ResourceLocation PAINTING_TYPES = new ResourceLocation("motive"); // sic
public static final ResourceLocation RECIPE_SERIALIZERS = new ResourceLocation("recipe_serializer");
public static final ResourceLocation ATTRIBUTES = new ResourceLocation("attribute");
public static final ResourceLocation STAT_TYPES = new ResourceLocation("stat_type");
// Villages
@@ -193,6 +196,7 @@ public class GameData
makeRegistry(CONTAINERS, ContainerType.class).disableSaving().create();
makeRegistry(PAINTING_TYPES, PaintingType.class, new ResourceLocation("kebab")).create();
makeRegistry(RECIPE_SERIALIZERS, IRecipeSerializer.class).disableSaving().create();
makeRegistry(ATTRIBUTES, Attribute.class).onValidate(AttributeCallbacks.INSTANCE).disableSaving().disableSync().create();
makeRegistry(STAT_TYPES, StatType.class).create();
// Villagers
@@ -534,75 +538,17 @@ public class GameData
}
}
/*
private static class RecipeCallbacks implements IForgeRegistry.ValidateCallback<IRecipe>, IForgeRegistry.MissingFactory<IRecipe>
{
static final RecipeCallbacks INSTANCE = new RecipeCallbacks();
private static class AttributeCallbacks implements IForgeRegistry.ValidateCallback<Attribute> {
static final AttributeCallbacks INSTANCE = new AttributeCallbacks();
@Override
public void onValidate(IForgeRegistryInternal<IRecipe> owner, RegistryManager stage, int id, ResourceLocation key, IRecipe obj)
public void onValidate(IForgeRegistryInternal<Attribute> owner, RegistryManager stage, int id, ResourceLocation key, Attribute obj)
{
if (stage != RegistryManager.ACTIVE) return;
// verify the recipe output yields a registered item
Item item = obj.getRecipeOutput().getItem();
if (!stage.getRegistry(Item.class).containsValue(item))
{
throw new IllegalStateException(String.format("Recipe %s (%s) produces unregistered item %s (%s)", key, obj, item.getRegistryName(), item));
}
}
@Override
public IRecipe createMissing(ResourceLocation key, boolean isNetwork)
{
return isNetwork ? new DummyRecipe().setRegistryName(key) : null;
}
private static class DummyRecipe implements IRecipe
{
private static ItemStack result = new ItemStack(Items.DIAMOND, 64);
private ResourceLocation name;
@Override
public IRecipe setRegistryName(ResourceLocation name) {
this.name = name;
return this;
}
@Override public ResourceLocation getRegistryName() { return name; }
@Override public Class<IRecipe> getRegistryType() { return IRecipe.class; }
@Override public boolean matches(InventoryCrafting inv, World worldIn) { return false; } //dirt?
@Override public ItemStack getCraftingResult(InventoryCrafting inv) { return result; }
@Override public boolean canFit(int width, int height) { return false; }
@Override public ItemStack getRecipeOutput() { return result; }
@Override public boolean isDynamic() { return true; }
GlobalEntityTypeAttributes.func_233834_a_();
}
}
private static ForgeRegistry<EntityEntry> entityRegistry;
public static ForgeRegistry<EntityEntry> getEntityRegistry() { return entityRegistry; }
public static void registerEntity(int id, ResourceLocation key, Class<? extends Entity> clazz, String oldName)
{
RegistryNamespaced<ResourceLocation, EntityEntry> reg = getWrapper(EntityEntry.class);
reg.register(id, key, new EntityEntry(clazz, oldName));
}
private static class EntityCallbacks implements IForgeRegistry.AddCallback<EntityEntry>
{
static final EntityCallbacks INSTANCE = new EntityCallbacks();
@Override
public void onAdd(IForgeRegistryInternal<EntityEntry> owner, RegistryManager stage, int id, EntityEntry entry, @Nullable EntityEntry oldEntry)
{
if (entry instanceof EntityEntryBuilder.BuiltEntityEntry)
{
((EntityEntryBuilder.BuiltEntityEntry) entry).addedToRegistry();
}
if (entry.getEgg() != null)
EntityList.ENTITY_EGGS.put(entry.getRegistryName(), entry.getEgg());
}
}
}
*/
private static class SerializerCallbacks implements IForgeRegistry.AddCallback<DataSerializerEntry>, IForgeRegistry.ClearCallback<DataSerializerEntry>, IForgeRegistry.CreateCallback<DataSerializerEntry>
{
static final SerializerCallbacks INSTANCE = new SerializerCallbacks();