Initial 1.16.2 Update

This commit is contained in:
LexManos committed 2020-08-13 00:35:08 -07:00
1 parent a3c4ffd2c1
commit fe43088c96
233 files changed
+1644 -2297

No files matched your search

@@ -16,7 +16,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* Biomes are completely redone in 1.16.2, reevaluate
package net.minecraftforge.common;
import java.util.*;
@@ -48,25 +48,25 @@ public class BiomeDictionary
private static final Map<String, Type> byName = new HashMap<String, Type>();
private static Collection<Type> allTypes = Collections.unmodifiableCollection(byName.values());
/*Temperature-based tags. Specifying neither implies a biome is temperate*/
/*Temperature-based tags. Specifying neither implies a biome is temperate* /
public static final Type HOT = new Type("HOT");
public static final Type COLD = new Type("COLD");
/*Tags specifying the amount of vegetation a biome has. Specifying neither implies a biome to have moderate amounts*/
//Tags specifying the amount of vegetation a biome has. Specifying neither implies a biome to have moderate amounts* /
public static final Type SPARSE = new Type("SPARSE");
public static final Type DENSE = new Type("DENSE");
/*Tags specifying how moist a biome is. Specifying neither implies the biome as having moderate humidity*/
//Tags specifying how moist a biome is. Specifying neither implies the biome as having moderate humidity* /
public static final Type WET = new Type("WET");
public static final Type DRY = new Type("DRY");
/*Tree-based tags, SAVANNA refers to dry, desert-like trees (Such as Acacia), CONIFEROUS refers to snowy trees (Such as Spruce) and JUNGLE refers to jungle trees.
* Specifying no tag implies a biome has temperate trees (Such as Oak)*/
* Specifying no tag implies a biome has temperate trees (Such as Oak)* /
public static final Type SAVANNA = new Type("SAVANNA");
public static final Type CONIFEROUS = new Type("CONIFEROUS");
public static final Type JUNGLE = new Type("JUNGLE");
/*Tags specifying the nature of a biome*/
/*Tags specifying the nature of a biome* /
public static final Type SPOOKY = new Type("SPOOKY");
public static final Type DEAD = new Type("DEAD");
public static final Type LUSH = new Type("LUSH");
@@ -80,10 +80,10 @@ public class BiomeDictionary
public static final Type RIVER = new Type("RIVER");
/**
* A general tag for all water-based biomes. Shown as present if OCEAN or RIVER are.
**/
** /
public static final Type WATER = new Type("WATER", OCEAN, RIVER);
/*Generic types which a biome can be*/
/*Generic types which a biome can be* /
public static final Type MESA = new Type("MESA");
public static final Type FOREST = new Type("FOREST");
public static final Type PLAINS = new Type("PLAINS");
@@ -96,7 +96,7 @@ public class BiomeDictionary
public static final Type BEACH = new Type("BEACH");
public static final Type VOID = new Type("VOID");
/*Tags specifying the dimension a biome generates in. Specifying none implies a biome that generates in a modded dimension*/
/*Tags specifying the dimension a biome generates in. Specifying none implies a biome that generates in a modded dimension* /
public static final Type OVERWORLD = new Type("OVERWORLD");
public static final Type NETHER = new Type("NETHER");
public static final Type END = new Type("END");
@@ -116,7 +116,7 @@ public class BiomeDictionary
/**
* Gets the name for this type.
*/
* /
public String getName()
{
return name;
@@ -143,7 +143,7 @@ public class BiomeDictionary
*
* @param name The name of this Type
* @return An instance of Type for this name.
*/
* /
public static Type getType(String name, Type... subTypes)
{
name = name.toUpperCase();
@@ -157,7 +157,7 @@ public class BiomeDictionary
/**
* @return An unmodifiable collection of all current biome types.
*/
* /
public static Collection<Type> getAll()
{
return allTypes;
@@ -192,7 +192,7 @@ public class BiomeDictionary
/**
* Adds the given types to the biome.
*
*/
* /
public static void addTypes(Biome biome, Type... types)
{
Preconditions.checkArgument(ForgeRegistries.BIOMES.containsValue(biome), "Cannot add types to unregistered biome %s", biome);
@@ -213,7 +213,7 @@ public class BiomeDictionary
/**
* Gets the set of biomes that have the given type.
*
*/
* /
@Nonnull
public static Set<Biome> getBiomes(Type type)
{
@@ -223,7 +223,7 @@ public class BiomeDictionary
/**
* Gets the set of types that have been added to the given biome.
*
*/
* /
@Nonnull
public static Set<Type> getTypes(Biome biome)
{
@@ -235,7 +235,7 @@ public class BiomeDictionary
* Checks if the two given biomes have types in common.
*
* @return returns true if a common type is found, false otherwise
*/
* /
public static boolean areSimilar(Biome biomeA, Biome biomeB)
{
for (Type type : getTypes(biomeA))
@@ -252,7 +252,7 @@ public class BiomeDictionary
/**
* Checks if the given type has been added to the given biome.
*
*/
* /
public static boolean hasType(Biome biome, Type type)
{
return getTypes(biome).contains(type);
@@ -261,7 +261,7 @@ public class BiomeDictionary
/**
* Checks if any type has been added to the given biome.
*
*/
* /
public static boolean hasAnyType(Biome biome)
{
return !getBiomeInfo(biome).types.isEmpty();
@@ -272,7 +272,7 @@ public class BiomeDictionary
* If a biome's types are requested and no types have been added to the biome so far, the biome's types
* will be determined and added using this method.
*
*/
* /
public static void makeBestGuess(Biome biome)
{
Type type = Type.fromVanilla(biome.getCategory());
@@ -337,7 +337,7 @@ public class BiomeDictionary
/**
* Ensure that at least one type has been added to the given biome.
*/
* /
static void ensureHasTypes(Biome biome)
{
if (!hasAnyType(biome))
@@ -369,79 +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)
{
@@ -452,3 +452,4 @@ public class BiomeDictionary
}
}
}
*/
@@ -16,7 +16,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* Biomes are completely redone in 1.16.2, reevaluate
package net.minecraftforge.common;
import java.util.ArrayList;
@@ -241,3 +241,4 @@ public class BiomeManager
}
}
}
*/
@@ -46,8 +46,6 @@ public class ForgeConfig
public final IntValue dimensionUnloadQueueDelay;
public final IntValue clumpingThreshold;
public final BooleanValue treatEmptyTagsAsAir;
public final BooleanValue fixAdvancementLoading;
@@ -101,12 +99,6 @@ public class ForgeConfig
.translation("forge.configgui.dimensionUnloadQueueDelay")
.defineInRange("dimensionUnloadQueueDelay", 0, 0, Integer.MAX_VALUE);
clumpingThreshold = builder
.comment("Controls the number threshold at which Packet51 is preferred over Packet52, default and minimum 64, maximum 1024.")
.translation("forge.configgui.clumpingThreshold")
.worldRestart()
.defineInRange("clumpingThreshold", 64, 64, 1024);
treatEmptyTagsAsAir = builder
.comment("Vanilla will treat crafting recipes using empty tags as air, and allow you to craft with nothing in that slot. This changes empty tags to use BARRIER as the item. To prevent crafting with air.")
.translation("forge.configgui.treatEmptyTagsAsAir")
@@ -318,9 +318,9 @@ public class ForgeHooks
return !MinecraftForge.EVENT_BUS.post(new LivingAttackEvent(entity, src, amount));
}
public static LivingKnockBackEvent onLivingKnockBack(LivingEntity target, Entity attacker, float strength, double ratioX, double ratioZ)
public static LivingKnockBackEvent onLivingKnockBack(LivingEntity target, float strength, double ratioX, double ratioZ)
{
LivingKnockBackEvent event = new LivingKnockBackEvent(target, attacker, strength, ratioX, ratioZ);
LivingKnockBackEvent event = new LivingKnockBackEvent(target, strength, ratioX, ratioZ);
MinecraftForge.EVENT_BUS.post(event);
return event;
}
@@ -19,18 +19,12 @@
package net.minecraftforge.common;
import java.util.Arrays;
import java.util.stream.Collectors;
import net.minecraft.block.Block;
import net.minecraft.item.DyeColor;
import net.minecraft.item.Item;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ITag;
import net.minecraft.tags.ItemTags;
import net.minecraft.util.RegistryKey;
import net.minecraft.util.registry.Registry;
import net.minecraftforge.common.util.ForgeNetworkTagManager;
import net.minecraftforge.registries.IForgeRegistryEntry;
public class Tags
{
@@ -52,10 +46,10 @@ public class Tags
public static final ITag.INamedTag<Block> DIRT = tag("dirt");
public static final ITag.INamedTag<Block> END_STONES = tag("end_stones");
public static final ITag.INamedTag<Block> FENCE_GATES = tag("fence_gates");
public static final ITag.INamedTag<Block> FENCE_GATES_WOODEN = defaulted("fence_gates/wooden", net.minecraft.block.Blocks.OAK_FENCE_GATE, net.minecraft.block.Blocks.BIRCH_FENCE_GATE, net.minecraft.block.Blocks.SPRUCE_FENCE_GATE, net.minecraft.block.Blocks.JUNGLE_FENCE_GATE, net.minecraft.block.Blocks.DARK_OAK_FENCE_GATE, net.minecraft.block.Blocks.ACACIA_FENCE_GATE);
public static final ITag.INamedTag<Block> FENCE_GATES_WOODEN = tag("fence_gates/wooden");
public static final ITag.INamedTag<Block> FENCES = tag("fences");
public static final ITag.INamedTag<Block> FENCES_NETHER_BRICK = tag("fences/nether_brick");
public static final ITag.INamedTag<Block> FENCES_WOODEN = defaulted("fences/wooden", net.minecraft.block.Blocks.OAK_FENCE, net.minecraft.block.Blocks.BIRCH_FENCE, net.minecraft.block.Blocks.SPRUCE_FENCE, net.minecraft.block.Blocks.JUNGLE_FENCE, net.minecraft.block.Blocks.DARK_OAK_FENCE, net.minecraft.block.Blocks.ACACIA_FENCE);
public static final ITag.INamedTag<Block> FENCES_WOODEN = tag("fences/wooden");
public static final ITag.INamedTag<Block> GLASS = tag("glass");
public static final ITag.INamedTag<Block> GLASS_BLACK = tag("glass/black");
@@ -130,12 +124,6 @@ public class Tags
{
return BlockTags.makeWrapperTag("forge:" + name);
}
@SuppressWarnings("deprecation")
private static ITag.INamedTag<Block> defaulted(String name, Block... values)
{
return ForgeNetworkTagManager.defaulted(Registry.field_239711_l_, tag(name), Arrays.asList(values).stream().map(e -> e.getRegistryName()).collect(Collectors.toSet()));
}
}
public static class Items
@@ -162,32 +150,32 @@ public class Tags
public static final ITag.INamedTag<Item> DUSTS_GLOWSTONE = tag("dusts/glowstone");
public static final ITag.INamedTag<Item> DYES = tag("dyes");
public static final ITag.INamedTag<Item> DYES_BLACK = tag("dyes/black");
public static final ITag.INamedTag<Item> DYES_RED = tag("dyes/red");
public static final ITag.INamedTag<Item> DYES_GREEN = tag("dyes/green");
public static final ITag.INamedTag<Item> DYES_BROWN = tag("dyes/brown");
public static final ITag.INamedTag<Item> DYES_BLUE = tag("dyes/blue");
public static final ITag.INamedTag<Item> DYES_PURPLE = tag("dyes/purple");
public static final ITag.INamedTag<Item> DYES_CYAN = tag("dyes/cyan");
public static final ITag.INamedTag<Item> DYES_LIGHT_GRAY = tag("dyes/light_gray");
public static final ITag.INamedTag<Item> DYES_GRAY = tag("dyes/gray");
public static final ITag.INamedTag<Item> DYES_PINK = tag("dyes/pink");
public static final ITag.INamedTag<Item> DYES_LIME = tag("dyes/lime");
public static final ITag.INamedTag<Item> DYES_YELLOW = tag("dyes/yellow");
public static final ITag.INamedTag<Item> DYES_LIGHT_BLUE = tag("dyes/light_blue");
public static final ITag.INamedTag<Item> DYES_MAGENTA = tag("dyes/magenta");
public static final ITag.INamedTag<Item> DYES_ORANGE = tag("dyes/orange");
public static final ITag.INamedTag<Item> DYES_WHITE = tag("dyes/white");
public static final ITag.INamedTag<Item> DYES_BLACK = DyeColor.BLACK.getTag();
public static final ITag.INamedTag<Item> DYES_RED = DyeColor.RED.getTag();
public static final ITag.INamedTag<Item> DYES_GREEN = DyeColor.GREEN.getTag();
public static final ITag.INamedTag<Item> DYES_BROWN = DyeColor.BROWN.getTag();
public static final ITag.INamedTag<Item> DYES_BLUE = DyeColor.BLUE.getTag();
public static final ITag.INamedTag<Item> DYES_PURPLE = DyeColor.PURPLE.getTag();
public static final ITag.INamedTag<Item> DYES_CYAN = DyeColor.CYAN.getTag();
public static final ITag.INamedTag<Item> DYES_LIGHT_GRAY = DyeColor.LIGHT_GRAY.getTag();
public static final ITag.INamedTag<Item> DYES_GRAY = DyeColor.GRAY.getTag();
public static final ITag.INamedTag<Item> DYES_PINK = DyeColor.PINK.getTag();
public static final ITag.INamedTag<Item> DYES_LIME = DyeColor.LIME.getTag();
public static final ITag.INamedTag<Item> DYES_YELLOW = DyeColor.YELLOW.getTag();
public static final ITag.INamedTag<Item> DYES_LIGHT_BLUE = DyeColor.LIGHT_BLUE.getTag();
public static final ITag.INamedTag<Item> DYES_MAGENTA = DyeColor.MAGENTA.getTag();
public static final ITag.INamedTag<Item> DYES_ORANGE = DyeColor.ORANGE.getTag();
public static final ITag.INamedTag<Item> DYES_WHITE = DyeColor.WHITE.getTag();
public static final ITag.INamedTag<Item> EGGS = tag("eggs");
public static final ITag.INamedTag<Item> END_STONES = tag("end_stones");
public static final ITag.INamedTag<Item> ENDER_PEARLS = tag("ender_pearls");
public static final ITag.INamedTag<Item> FEATHERS = tag("feathers");
public static final ITag.INamedTag<Item> FENCE_GATES = tag("fence_gates");
public static final ITag.INamedTag<Item> FENCE_GATES_WOODEN = defaulted("fence_gates/wooden", Blocks.FENCE_GATES_WOODEN);
public static final ITag.INamedTag<Item> FENCE_GATES_WOODEN = tag("fence_gates/wooden");
public static final ITag.INamedTag<Item> FENCES = tag("fences");
public static final ITag.INamedTag<Item> FENCES_NETHER_BRICK = tag("fences/nether_brick");
public static final ITag.INamedTag<Item> FENCES_WOODEN = defaulted("fences/wooden", Blocks.FENCES_WOODEN);
public static final ITag.INamedTag<Item> FENCES_WOODEN = tag("fences/wooden");
public static final ITag.INamedTag<Item> GEMS = tag("gems");
public static final ITag.INamedTag<Item> GEMS_DIAMOND = tag("gems/diamond");
public static final ITag.INamedTag<Item> GEMS_EMERALD = tag("gems/emerald");
@@ -293,11 +281,5 @@ public class Tags
{
return ItemTags.makeWrapperTag("forge:" + name);
}
@SuppressWarnings("deprecation")
private static ITag.INamedTag<Item> defaulted(String name, ITag.INamedTag<Block> parent)
{
return ForgeNetworkTagManager.defaulted(Registry.field_239714_o_, tag(name), RegistryKey.func_240903_a_(Registry.field_239711_l_, parent.func_230234_a_()));
}
}
}
@@ -23,8 +23,6 @@ import com.google.gson.JsonObject;
import net.minecraft.item.Item;
import net.minecraft.tags.ITag;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.Tag;
import net.minecraft.tags.TagCollectionManager;
import net.minecraft.util.JSONUtils;
import net.minecraft.util.ResourceLocation;
@@ -58,7 +56,7 @@ public class TagEmptyCondition implements ICondition
@Override
public boolean test()
{
ITag<Item> tag = TagCollectionManager.func_232928_e_().func_232925_b_().get(tag_name);
ITag<Item> tag = TagCollectionManager.func_242178_a().func_241836_b().get(tag_name);
return tag == null || tag.func_230236_b_().isEmpty();
}
@@ -119,6 +119,7 @@ public abstract class LanguageProvider implements IDataProvider {
add(key.getName(), name);
}
/*
public void addBiome(Supplier<? extends Biome> key, String name) {
add(key.get(), name);
}
@@ -126,6 +127,7 @@ public abstract class LanguageProvider implements IDataProvider {
public void add(Biome key, String name) {
add(key.getTranslationKey(), name);
}
*/
public void addEffect(Supplier<? extends Effect> key, String name) {
add(key.get(), name);
@@ -242,14 +242,15 @@ public interface IForgeBlock
* @param state The current state
* @param world The current world
* @param pos Block position in world
* @param orientation The direction the entity is facing while getting into bed.
* @param sleeper The sleeper or camera entity, null in some cases.
* @return The spawn position
*/
default Optional<Vector3d> getBedSpawnPosition(EntityType<?> entityType, BlockState state, IWorldReader world, BlockPos pos, @Nullable LivingEntity sleeper)
default Optional<Vector3d> getBedSpawnPosition(EntityType<?> entityType, BlockState state, IWorldReader world, BlockPos pos, float orientation, @Nullable LivingEntity sleeper)
{
if (world instanceof World)
{
return BedBlock.func_220172_a(entityType, world,pos,0);
return BedBlock.func_242652_a(entityType, world, pos, orientation);
}
return Optional.empty();
@@ -516,7 +517,7 @@ public interface IForgeBlock
* @param pos Block position in world
* @return True, to support being part of a nether portal frame, false otherwise.
*/
default boolean isPortalFrame(BlockState state, IWorldReader world, BlockPos pos)
default boolean isPortalFrame(BlockState state, IBlockReader world, BlockPos pos)
{
return state.isIn(Blocks.OBSIDIAN);
}
@@ -890,7 +891,7 @@ public interface IForgeBlock
{
return state.getBlock() instanceof BreakableBlock || state.getBlock() instanceof LeavesBlock;
}
/**
* Returns the state that this block should transform into when right clicked by a tool.
* For example: Used to determine if an axe can strip, a shovel can path, or a hoe can till.
@@ -195,12 +195,13 @@ public interface IForgeBlockState
*
* @param world The current world
* @param pos Block position in world
* @param orientation The direction the entity is facing while getting into bed.
* @param sleeper The sleeper or camera entity, null in some cases.
* @return The spawn position
*/
default Optional<Vector3d> getBedSpawnPosition(EntityType<?> type, IWorldReader world, BlockPos pos, @Nullable LivingEntity sleeper)
default Optional<Vector3d> getBedSpawnPosition(EntityType<?> type, IWorldReader world, BlockPos pos, float orientation, @Nullable LivingEntity sleeper)
{
return getBlockState().getBlock().getBedSpawnPosition(type, getBlockState(), world, pos, sleeper);
return getBlockState().getBlock().getBedSpawnPosition(type, getBlockState(), world, pos, orientation, sleeper);
}
/**
@@ -428,7 +429,7 @@ public interface IForgeBlockState
* @param pos Block position in world
* @return True, to support being part of a nether portal frame, false otherwise.
*/
default boolean isPortalFrame(IWorldReader world, BlockPos pos)
default boolean isPortalFrame(IBlockReader world, BlockPos pos)
{
return getBlockState().getBlock().isPortalFrame(getBlockState(), world, pos);
}
@@ -778,7 +779,7 @@ public interface IForgeBlockState
{
return getBlockState().getBlock().shouldDisplayFluidOverlay(getBlockState(), world, pos, fluidState);
}
/**
* Returns the state that this block should transform into when right clicked by a tool.
* For example: Used to determine if an axe can strip, a shovel can path, or a hoe can till.
@@ -56,28 +56,28 @@ public class BlockSnapshot
private WeakReference<IWorld> world;
private String toString = null;
private BlockSnapshot(IWorld world, BlockPos pos, BlockState state, @Nullable CompoundNBT nbt, int flags)
private BlockSnapshot(RegistryKey<World> dim, IWorld world, BlockPos pos, BlockState state, @Nullable CompoundNBT nbt, int flags)
{
this.dim = world.getWorld().func_234923_W_();
this.dim = dim;
this.pos = pos.toImmutable();
this.block = state;
this.flags = flags;
this.nbt = nbt;
this.world = new WeakReference<>(world);
this.world = new WeakReference<>(world);
if (DEBUG)
System.out.println("Created " + this.toString());
}
public static BlockSnapshot create(IWorld world, BlockPos pos)
public static BlockSnapshot create(RegistryKey<World> dim, IWorld world, BlockPos pos)
{
return create(world, pos, 3);
return create(dim, world, pos, 3);
}
public static BlockSnapshot create(IWorld world, BlockPos pos, int flag)
public static BlockSnapshot create(RegistryKey<World> dim, IWorld world, BlockPos pos, int flag)
{
return new BlockSnapshot(world, pos, world.getBlockState(pos), getTileNBT(world.getTileEntity(pos)), flag);
return new BlockSnapshot(dim, world, pos, world.getBlockState(pos), getTileNBT(world.getTileEntity(pos)), flag);
}
@Nullable
@@ -88,8 +88,8 @@ public class BlockSnapshot
public BlockState getCurrentBlock()
{
IWorld world = getWorld();
return world == null ? Blocks.AIR.getDefaultState() : world.getBlockState(this.pos);
IWorld world = getWorld();
return world == null ? Blocks.AIR.getDefaultState() : world.getBlockState(this.pos);
}
@Nullable
@@ -175,10 +175,10 @@ public class BlockSnapshot
final BlockSnapshot other = (BlockSnapshot) obj;
return this.dim.equals(other.dim) &&
this.pos.equals(other.pos) &&
this.block == other.block &&
this.flags == other.flags &&
Objects.equals(this.nbt, other.nbt);
this.pos.equals(other.pos) &&
this.block == other.block &&
this.flags == other.flags &&
Objects.equals(this.nbt, other.nbt);
}
@Override
@@ -196,18 +196,18 @@ public class BlockSnapshot
@Override
public String toString()
{
if (toString == null)
{
this.toString =
"BlockSnapshot[" +
"World:" + this.dim.func_240901_a_() + ',' +
"Pos: " + this.pos + ',' +
"State: " + this.block + ',' +
"Flags: " + this.flags + ',' +
"NBT: " + (this.nbt == null ? "null" : this.nbt.toString()) +
']';
}
return this.toString;
if (toString == null)
{
this.toString =
"BlockSnapshot[" +
"World:" + this.dim.func_240901_a_() + ',' +
"Pos: " + this.pos + ',' +
"State: " + this.block + ',' +
"Flags: " + this.flags + ',' +
"NBT: " + (this.nbt == null ? "null" : this.nbt.toString()) +
']';
}
return this.toString;
}
public BlockPos getPos() { return pos; }
@@ -1,128 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2020.
*
* 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.util;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
import com.google.common.collect.ImmutableSet;
import net.minecraft.tags.ITag;
import net.minecraft.tags.NetworkTagCollection;
import net.minecraft.tags.NetworkTagManager;
import net.minecraft.tags.Tag;
import net.minecraft.util.RegistryKey;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.registry.Registry;
@Deprecated //For Forge's internal use only.
public class ForgeNetworkTagManager extends NetworkTagManager
{
private static Map<RegistryKey<?>, Set<ResourceLocation>> defaults = new HashMap<>();
/**
* Returns a new instance of this tag manager, again, only exposed for Forge's Hook use.
*/
public static NetworkTagManager create()
{
return new ForgeNetworkTagManager();
}
/**
* This will provide default tags if the server side does not send us one.
* Note: If they DO send us a empty one, this DOES NOT override that.
* This is 100% intended to be only used by Forge tto make sure our tags behave correctly on vanilla servers for the edge cases where we use tags for in-game loogic.
* Notably: Furnace burnables.
*/
public static <T> ITag.INamedTag<T> defaulted(RegistryKey<Registry<T>> type, ITag.INamedTag<T> tag, Set<ResourceLocation> values)
{
defaults.put(RegistryKey.func_240903_a_(type, tag.func_230234_a_()), ImmutableSet.copyOf(values));
return tag;
}
/**
* Copies the resource key from the parent tag to a new one.
* This simplifies the item variants of block tags.
* WILL explode if the parent hasn't been defaulted.
*/
public static <T> ITag.INamedTag<T> defaulted(RegistryKey<Registry<T>> type, ITag.INamedTag<T> tag, RegistryKey<?> parent)
{
RegistryKey<T> regKey = RegistryKey.func_240903_a_(type, tag.func_230234_a_());
Set<ResourceLocation> other = defaults.get(parent);
if (other == null)
throw new IllegalStateException("Attempted to set nested default without setting parent: " + regKey + " -> " + parent);
defaults.put(regKey, other);
return tag;
}
private ForgeNetworkTagManager()
{
this.blocks = new ForgeNetworkTagCollection<>(Registry.BLOCK, "tags/blocks", "block");
this.items = new ForgeNetworkTagCollection<>(Registry.ITEM, "tags/items", "item");
this.fluids = new ForgeNetworkTagCollection<>(Registry.FLUID, "tags/fluids", "fluid");
this.entityTypes = new ForgeNetworkTagCollection<>(Registry.ENTITY_TYPE, "tags/entity_types", "entity_type");
}
private static class ForgeNetworkTagCollection<T> extends NetworkTagCollection<T>
{
private final ITag<T> EMPTY = Tag.func_241284_a_();
private final Registry<T> registry;
private final Map<ResourceLocation, ITag<T>> cache = new HashMap<>();
public ForgeNetworkTagCollection(Registry<T> registry, String path, String name)
{
super(registry, path, name);
this.registry = registry;
}
@Override
@Nullable
public ITag<T> get(ResourceLocation key)
{
ITag<T> ret = super.get(key);
if (ret == null)
{
ret = cache.get(key);
if (ret == null) {
RegistryKey<T> regKey = RegistryKey.func_240903_a_(this.registry.getRegistryKey(), key);
Set<ResourceLocation> defaults = ForgeNetworkTagManager.defaults.get(regKey);
if (defaults == null)
{
ret = EMPTY;
}
else
{
Set<T> values = defaults.stream().map(getEntryLookup()).filter(Optional::isPresent).map(Optional::get).collect(Collectors.toSet());
ret = Tag.func_241286_a_(values);
}
this.cache.put(key, ret);
}
}
return ret;
}
}
}
@@ -26,19 +26,19 @@ import java.util.Set;
import java.util.function.Supplier;
import net.minecraft.tags.ITag;
import net.minecraft.tags.TagCollection;
import net.minecraft.tags.ITagCollection;
import net.minecraft.util.ResourceLocation;
public class ReverseTagWrapper<T>
{
private final T target;
private final Supplier<TagCollection<T>> colSupplier;
private final Supplier<ITagCollection<T>> colSupplier;
//This map is immutable we track its identity change.
private Map<ResourceLocation, ITag<T>> colCache;
private Set<ResourceLocation> cache = null;
public ReverseTagWrapper(T target, Supplier<TagCollection<T>> colSupplier)
public ReverseTagWrapper(T target, Supplier<ITagCollection<T>> colSupplier)
{
this.target = target;
this.colSupplier = colSupplier;
@@ -46,11 +46,11 @@ public class ReverseTagWrapper<T>
public Set<ResourceLocation> getTagNames()
{
TagCollection<T> collection = colSupplier.get();
if (cache == null || colCache != collection.getTagMap()) // Identity equals.
ITagCollection<T> collection = colSupplier.get();
if (cache == null || colCache != collection.func_241833_a()) // Identity equals.
{
this.cache = Collections.unmodifiableSet(new HashSet<>(collection.getOwningTags(target)));
this.colCache = collection.getTagMap();
this.colCache = collection.func_241833_a();
}
return this.cache;
}