mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-22 05:02:18 +00:00
Initial 1.13.2 update. Major thing to note is that Dimensions have been completely revamped.
DimensionType is not unique per Dimension. See DimensionManager for more details. Vanilla now has a chunk loading system, so Forge's will need to be deprecated/adapted.
This commit is contained in:
1 parent
9a1688599a
commit
ca72710937
361 files changed
+3166
-3547
No files matched your search
@@ -38,7 +38,7 @@ import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.particle.ParticleManager;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
|
||||
@@ -26,7 +26,7 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.particle.ParticleManager;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
@@ -24,6 +24,7 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.client.audio.MusicTicker;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
@@ -31,6 +32,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
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.dimension.OverworldDimension;
|
||||
import net.minecraft.world.storage.WorldInfo;
|
||||
@@ -44,7 +46,7 @@ public interface IForgeDimension
|
||||
{
|
||||
return (Dimension) this;
|
||||
}
|
||||
|
||||
|
||||
World getWorld();
|
||||
|
||||
/**
|
||||
@@ -81,7 +83,7 @@ public interface IForgeDimension
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If this method returns true, then chunks received by the client will
|
||||
* have {@link net.minecraft.world.chunk.Chunk#resetRelightChecks} called
|
||||
@@ -98,17 +100,6 @@ public interface IForgeDimension
|
||||
return !(this instanceof OverworldDimension);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the providers current dimension ID, used in default getSaveFolder()
|
||||
* Added to allow default providers to be registered for multiple dimensions.
|
||||
* This is to denote the exact dimension ID opposed to the 'type' in WorldType
|
||||
*
|
||||
* @param id Dimension ID
|
||||
*/
|
||||
void setId(int id);
|
||||
|
||||
int getId();
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Nullable
|
||||
IRenderHandler getSkyRenderer();
|
||||
@@ -129,7 +120,7 @@ public interface IForgeDimension
|
||||
|
||||
@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.
|
||||
@@ -140,7 +131,7 @@ public interface IForgeDimension
|
||||
* @param blockLight Block light brightness factor.
|
||||
* @param colors The color values that will be used: [r, g, b].
|
||||
*
|
||||
* @see net.minecraft.client.renderer.EntityRenderer#updateLightmap(float)
|
||||
* @see net.minecraft.client.renderer.GameRenderer#updateLightmap(float)
|
||||
*/
|
||||
default void getLightmapColors(float partialTicks, float sunBrightness, float skyLight, float blockLight, float[] colors) {}
|
||||
|
||||
@@ -167,7 +158,7 @@ public interface IForgeDimension
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determines if the player can sleep in this world (or if the bed should explode for example).
|
||||
*
|
||||
@@ -316,11 +307,6 @@ public interface IForgeDimension
|
||||
return getWorld().getWorldInfo().getTerrainType().getHorizon(getWorld());
|
||||
}
|
||||
|
||||
default String getSaveFolder()
|
||||
{
|
||||
return getId() == 0 ? null : "DIM" + getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the cursor on the map should 'spin' when rendered, like it does for the player in the nether.
|
||||
*
|
||||
@@ -332,7 +318,7 @@ public interface IForgeDimension
|
||||
*/
|
||||
default boolean shouldMapSpin(String entity, double x, double z, double rotation)
|
||||
{
|
||||
return getId() < 0;
|
||||
return getDimension().getType() == DimensionType.NETHER;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -341,7 +327,7 @@ public interface IForgeDimension
|
||||
* @param player The player that is respawning
|
||||
* @return The dimension to respawn the player in
|
||||
*/
|
||||
default int getRespawnDimension(net.minecraft.entity.player.EntityPlayerMP player)
|
||||
default DimensionType getRespawnDimension(EntityPlayerMP player)
|
||||
{
|
||||
return player.getSpawnDimension();
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ package net.minecraftforge.common.extensions;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
|
||||
@@ -21,7 +21,7 @@ package net.minecraftforge.common.extensions;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -36,7 +37,6 @@ import net.minecraft.entity.passive.HorseArmorType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
@@ -44,14 +44,13 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.registry.RegistrySimple;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
import net.minecraftforge.common.animation.ITimeValue;
|
||||
|
||||
// TODO review most of the methods in this "patch"
|
||||
public interface IForgeItem
|
||||
@@ -679,16 +678,10 @@ public interface IForgeItem
|
||||
return null;
|
||||
}
|
||||
|
||||
default com.google.common.collect.ImmutableMap<String, net.minecraftforge.common.animation.ITimeValue> getAnimationParameters(final ItemStack stack,
|
||||
final World world, final EntityLivingBase entity)
|
||||
default ImmutableMap<String, ITimeValue> getAnimationParameters(final ItemStack stack, final World world, final EntityLivingBase entity)
|
||||
{
|
||||
com.google.common.collect.ImmutableMap.Builder<String, net.minecraftforge.common.animation.ITimeValue> builder = com.google.common.collect.ImmutableMap
|
||||
.builder();
|
||||
for (ResourceLocation location : ((RegistrySimple<ResourceLocation, IItemPropertyGetter>) getItem().properties).getKeys())
|
||||
{
|
||||
final IItemPropertyGetter parameter = getItem().properties.get(location);
|
||||
builder.put(location.toString(), input -> parameter.call(stack, world, entity));
|
||||
}
|
||||
com.google.common.collect.ImmutableMap.Builder<String, ITimeValue> builder = ImmutableMap.builder();
|
||||
getItem().properties.forEach((k,v) -> builder.put(k.toString(), input -> v.call(stack, world, entity)));
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,17 +19,6 @@
|
||||
|
||||
package net.minecraftforge.common.extensions;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSetMultimap;
|
||||
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
|
||||
public interface IForgeWorld extends ICapabilityProvider
|
||||
@@ -40,23 +29,4 @@ public interface IForgeWorld extends ICapabilityProvider
|
||||
* of one of there entities.
|
||||
*/
|
||||
public static double MAX_ENTITY_RADIUS = 2.0D;
|
||||
|
||||
default ImmutableSetMultimap<ChunkPos, ForgeChunkManager.Ticket> getPersistentChunks()
|
||||
{
|
||||
return ForgeChunkManager.getPersistentChunksFor((World)this);
|
||||
}
|
||||
|
||||
default Iterator<Chunk> getPersistentChunkIterable(Iterator<Chunk> chunkIterator)
|
||||
{
|
||||
@SuppressWarnings("resource")
|
||||
World world = (World)this;
|
||||
final ImmutableSetMultimap<ChunkPos, Ticket> persistentChunksFor = getPersistentChunks();
|
||||
final ImmutableSet.Builder<Chunk> builder = ImmutableSet.builder();
|
||||
world.profiler.startSection("forcedChunkLoading");
|
||||
builder.addAll(persistentChunksFor.keys().stream().filter(Objects::nonNull).map(input -> world.getChunk(input.x, input.z)).iterator());
|
||||
world.profiler.endStartSection("regularChunkLoading");
|
||||
builder.addAll(chunkIterator);
|
||||
world.profiler.endSection();
|
||||
return builder.build().iterator();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user