mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-25 14:34:28 +00:00
Patching and updates
This commit is contained in:
113 files changed
+1011
-3194
No files matched your search
@@ -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.
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
public interface IForgeResourcePack
|
||||
{
|
||||
default boolean isHidden()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}*/
|
||||
Reference in new issue
Block a user