Setup and import of 1.16 YEET

This commit is contained in:
cpw committed 2020-06-25 17:55:38 -04:00
1 parent 56397043bb
commit 6d15febdb3
931 files changed
+18847 -9127

No files matched your search

@@ -377,7 +377,7 @@ public class BiomeDictionary
addTypes(Biomes.TAIGA, COLD, CONIFEROUS, FOREST, OVERWORLD );
addTypes(Biomes.SWAMP, WET, SWAMP, OVERWORLD );
addTypes(Biomes.RIVER, RIVER, OVERWORLD );
addTypes(Biomes.NETHER, HOT, DRY, NETHER );
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 );
@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common;
/*package net.minecraftforge.common;
import java.io.File;
import java.io.IOException;
@@ -63,6 +63,7 @@ import net.minecraft.world.chunk.listener.IChunkStatusListener;
import net.minecraft.world.server.ServerMultiWorld;
import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.storage.SaveFormat;
import net.minecraft.world.storage.SaveHandler;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.event.world.RegisterDimensionsEvent;
@@ -108,7 +109,7 @@ public class DimensionManager
* @param hasSkyLight does this dimension have a skylight?
* @param magnifier The biome generation processor
* @return the DimensionType for the dimension.
*/
* /
public static DimensionType registerOrGetDimension(ResourceLocation name, ModDimension type, PacketBuffer data, boolean hasSkyLight)
{
return REGISTRY.getValue(name).orElseGet(()->registerDimension(name, type, data, hasSkyLight));
@@ -125,7 +126,7 @@ public class DimensionManager
* @param hasSkyLight skylight for this dimension
* @param magnifier The biome generation processor
* @return the DimensionType for the dimension.
*/
* /
public static DimensionType registerDimension(ResourceLocation name, ModDimension type, PacketBuffer data, boolean hasSkyLight)
{
Validate.notNull(name, "Can not register a dimension with null name");
@@ -154,7 +155,7 @@ public class DimensionManager
* @param dim The dimension
* @param value True to keep loaded, false to allow unloading
* @return The old value for this dimension.
*/
* /
public static boolean keepLoaded(DimensionType dim, boolean value)
{
Validate.notNull(dim, "Dimension type must not be null");
@@ -168,7 +169,7 @@ public class DimensionManager
* Determines if the dimension will stay loaded in memory even if all chunks are unloaded.
* @param dim The dimension
* @return True if the dimension will stay loaded with no chunks loaded.
*/
* /
public static boolean keepLoaded(DimensionType dim)
{
Validate.notNull(dim, "Dimension type must not be null");
@@ -184,7 +185,7 @@ public class DimensionManager
* @param resetUnloadDelay True to reset the unload timer, which is a delay that is used to prevent constant world loading/unloading cycle.
* @param forceLoad True to attempt to load the dimension if the server has it unloaded.
* @return The world, null if unloaded and not loadable.
*/
* /
@Nullable
public static ServerWorld getWorld(MinecraftServer server, DimensionType dim, boolean resetUnloadDelay, boolean forceLoad)
{
@@ -219,7 +220,7 @@ public class DimensionManager
* Vanilla dimensions are not supported and will throw an exception.
*
* @param dim the dimension to delete
*/
* /
public static void markForDeletion(DimensionType dim)
{
if (dim.isVanilla())
@@ -248,7 +249,7 @@ public class DimensionManager
/**
* Deprecated, unregistering dimensions at runtime is not supported.
* @see DimensionManager#markForDeletion(DimensionType)
*/
* /
@Deprecated
public static void unregisterDimension(int id)
{
@@ -302,7 +303,7 @@ public class DimensionManager
/**
* Queues a dimension to unload, if it can be unloaded.
* @param world The world to unload
*/
* /
public static void unloadWorld(ServerWorld world)
{
if (world == null || !canUnloadWorld(world))
@@ -466,7 +467,7 @@ public class DimensionManager
.forEach(foldersScheduledForDeletion::add);
}
public static void processScheduledDeletions(SaveHandler saveHandler)
public static void processScheduledDeletions(SaveFormat.LevelSave levelSave)
{
List<String> toDelete = new ArrayList<>(foldersScheduledForDeletion);
foldersScheduledForDeletion.clear();
@@ -486,7 +487,7 @@ public class DimensionManager
}
for (String folderName : toDelete)
{
File folder = new File(saveHandler.getWorldDirectory(), folderName);
File folder = new File(levelSave.getWorldDir().toFile(), folderName);
try
{
FileUtils.deleteDirectory(folder);
@@ -613,4 +614,4 @@ public class DimensionManager
playerWorlds = players.getPlayers().stream().map(e -> e.world).collect(Collectors.toSet());
return changed;
}
}
}*/
@@ -26,7 +26,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunk;
@@ -36,6 +36,7 @@ import net.minecraftforge.common.ticket.SimpleTicket;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -43,7 +44,7 @@ import java.util.Set;
public class FarmlandWaterManager
{
private static boolean DEBUG = Boolean.parseBoolean(System.getProperty("forge.debugFarmlandWaterManager", "false"));
private static final Int2ObjectMap<Map<ChunkPos, ChunkTicketManager<Vec3d>>> customWaterHandler = new Int2ObjectOpenHashMap<>();
private static final Int2ObjectMap<Map<ChunkPos, ChunkTicketManager<Vector3d>>> customWaterHandler = new Int2ObjectOpenHashMap<>();
private static final Logger LOGGER = LogManager.getLogger();
/**
@@ -59,11 +60,11 @@ public class FarmlandWaterManager
* @return The ticket for your requested region.
*/
@SuppressWarnings("unchecked")
public static<T extends SimpleTicket<Vec3d>> T addCustomTicket(World world, T ticket, ChunkPos masterChunk, ChunkPos... additionalChunks)
public static<T extends SimpleTicket<Vector3d>> T addCustomTicket(World world, T ticket, ChunkPos masterChunk, ChunkPos... additionalChunks)
{
Preconditions.checkArgument(!world.isRemote, "Water region is only determined server-side");
Map<ChunkPos, ChunkTicketManager<Vec3d>> ticketMap = customWaterHandler.computeIfAbsent(world.getDimension().getType().getId(), id -> new MapMaker().weakValues().makeMap());
ChunkTicketManager<Vec3d>[] additionalTickets = new ChunkTicketManager[additionalChunks.length];
Map<ChunkPos, ChunkTicketManager<Vector3d>> ticketMap = Collections.emptyMap();// customWaterHandler.computeIfAbsent(world.getDimension().getType().getId(), id -> new MapMaker().weakValues().makeMap()); //TODO Dimensions
ChunkTicketManager<Vector3d>[] additionalTickets = new ChunkTicketManager[additionalChunks.length];
for (int i = 0; i < additionalChunks.length; i++)
additionalTickets[i] = ticketMap.computeIfAbsent(additionalChunks[i], ChunkTicketManager::new);
ticket.setManager(ticketMap.computeIfAbsent(masterChunk, ChunkTicketManager::new), additionalTickets);
@@ -116,7 +117,7 @@ public class FarmlandWaterManager
return addCustomTicket(world, new AABBTicket(aabb), masterPos, posSet.toArray(new ChunkPos[0]));
}
private static double getDistanceSq(ChunkPos pos, Vec3d vec3d)
private static double getDistanceSq(ChunkPos pos, Vector3d vec3d)
{
//See ChunkPos#getDistanceSq
double d0 = (double)(pos.x * 16 + 8);
@@ -132,11 +133,11 @@ public class FarmlandWaterManager
*/
public static boolean hasBlockWaterTicket(IWorldReader world, BlockPos pos)
{
ChunkTicketManager<Vec3d> ticketManager = getTicketManager(new ChunkPos(pos.getX() >> 4, pos.getZ() >> 4), world);
ChunkTicketManager<Vector3d> ticketManager = getTicketManager(new ChunkPos(pos.getX() >> 4, pos.getZ() >> 4), world);
if (ticketManager != null)
{
Vec3d posAsVec3d = new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
for (SimpleTicket<Vec3d> ticket : ticketManager.getTickets()) {
Vector3d posAsVec3d = new Vector3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
for (SimpleTicket<Vector3d> ticket : ticketManager.getTickets()) {
if (ticket.matches(posAsVec3d))
return true;
}
@@ -146,7 +147,7 @@ public class FarmlandWaterManager
static void removeTickets(IChunk chunk)
{
ChunkTicketManager<Vec3d> ticketManager = getTicketManager(chunk.getPos(), chunk.getWorldForge());
ChunkTicketManager<Vector3d> ticketManager = getTicketManager(chunk.getPos(), chunk.getWorldForge());
if (ticketManager != null)
{
if (DEBUG)
@@ -157,9 +158,9 @@ public class FarmlandWaterManager
}
}
private static ChunkTicketManager<Vec3d> getTicketManager(ChunkPos pos, IWorldReader world) {
private static ChunkTicketManager<Vector3d> getTicketManager(ChunkPos pos, IWorldReader world) {
Preconditions.checkArgument(!world.isRemote(), "Water region is only determined server-side");
Map<ChunkPos, ChunkTicketManager<Vec3d>> ticketMap = customWaterHandler.get(world.getDimension().getType().getId());
Map<ChunkPos, ChunkTicketManager<Vector3d>> ticketMap = Collections.emptyMap();//customWaterHandler.get(world.getDimension().getType().getId()); //TODO Dimensions
if (ticketMap == null)
{
return null;
@@ -47,7 +47,10 @@ import javax.annotation.Nullable;
import net.minecraft.advancements.Advancement;
import net.minecraft.block.Block;
import net.minecraft.fluid.*;
import net.minecraft.util.CachedBlockInfo;
import net.minecraft.loot.LootContext;
import net.minecraft.loot.LootTable;
import net.minecraft.loot.LootTableManager;
import net.minecraft.util.*;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen;
@@ -85,26 +88,17 @@ import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionUtils;
import net.minecraft.stats.Stats;
import net.minecraft.tags.Tag;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.*;
import net.minecraft.world.spawner.AbstractSpawner;
import net.minecraft.tileentity.FurnaceTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.IntIdentityHashBiMap;
import net.minecraft.util.JSONUtils;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.EntityRayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.event.ClickEvent;
import net.minecraft.world.Difficulty;
import net.minecraft.world.GameType;
@@ -112,10 +106,6 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.storage.loot.LootContext;
import net.minecraft.world.storage.loot.LootTable;
import net.minecraft.world.storage.loot.LootTableManager;
import net.minecraftforge.common.loot.IGlobalLootModifier;
import net.minecraftforge.common.loot.LootModifierManager;
import net.minecraftforge.common.util.BlockSnapshot;
@@ -175,7 +165,7 @@ public class ForgeHooks
public static boolean canHarvestBlock(@Nonnull BlockState state, @Nonnull PlayerEntity player, @Nonnull IBlockReader world, @Nonnull BlockPos pos)
{
//state = state.getActualState(world, pos);
if (state.getMaterial().isToolNotRequired())
if (state.func_235783_q_())
{
return true;
}
@@ -184,13 +174,13 @@ public class ForgeHooks
ToolType tool = state.getHarvestTool();
if (stack.isEmpty() || tool == null)
{
return player.canHarvestBlock(state);
return true; // TODO: player.canHarvestBlock(state);
}
int toolLevel = stack.getItem().getHarvestLevel(stack, tool, player, state);
if (toolLevel < 0)
{
return player.canHarvestBlock(state);
return true; //TODO: player.canHarvestBlock(state);
}
return ForgeEventFactory.doPlayerHarvestCheck(player, state, toolLevel >= state.getHarvestLevel());
@@ -256,7 +246,7 @@ public class ForgeHooks
if (state.isAir(world, pos))
return false;
if (isCreative && Screen.hasControlDown() && state.hasTileEntity())
if (isCreative && Screen.func_231172_r_() && state.hasTileEntity())
te = world.getTileEntity(pos);
result = state.getBlock().getPickBlock(state, target, world, pos, player);
@@ -467,7 +457,7 @@ public class ForgeHooks
// Includes ipv4 and domain pattern
// Matches an ip (xx.xxx.xx.xxx) or a domain (something.com) with or
// without a protocol or path.
ITextComponent ichat = null;
IFormattableTextComponent ichat = null;
Matcher matcher = URL_PATTERN.matcher(string);
int lastEnd = 0;
@@ -484,11 +474,11 @@ public class ForgeHooks
if (ichat == null)
ichat = new StringTextComponent(part);
else
ichat.appendText(part);
ichat.func_240702_b_(part);
}
lastEnd = end;
String url = string.substring(start, end);
ITextComponent link = new StringTextComponent(url);
IFormattableTextComponent link = new StringTextComponent(url);
try
{
@@ -500,7 +490,7 @@ public class ForgeHooks
if (ichat == null)
ichat = new StringTextComponent(url);
else
ichat.appendText(url);
ichat.func_240702_b_(url);
continue;
}
url = "http://" + url;
@@ -510,18 +500,16 @@ public class ForgeHooks
{
// Bad syntax bail out!
if (ichat == null) ichat = new StringTextComponent(url);
else ichat.appendText(url);
else ichat.func_240702_b_(url);
continue;
}
// Set the click event and append the link.
ClickEvent click = new ClickEvent(ClickEvent.Action.OPEN_URL, url);
link.getStyle().setClickEvent(click);
link.getStyle().setUnderlined(true);
link.getStyle().setColor(TextFormatting.BLUE);
link.func_230530_a_(link.getStyle().func_240715_a_(click).setUnderlined(true).func_240718_a_(Color.func_240744_a_(TextFormatting.BLUE)));
if (ichat == null)
ichat = new StringTextComponent("");
ichat.appendSibling(link);
ichat.func_230529_a_(link);
}
// Append the rest of the message.
@@ -529,7 +517,7 @@ public class ForgeHooks
if (ichat == null)
ichat = new StringTextComponent(end);
else if (end.length() > 0)
ichat.appendText(string.substring(lastEnd));
ichat.func_230529_a_(new StringTextComponent(string.substring(lastEnd)));
return ichat;
}
@@ -669,7 +657,7 @@ public class ForgeHooks
newBlock.onBlockAdded(world, snap.getPos(), oldBlock, false);
}
world.markAndNotifyBlock(snap.getPos(), null, oldBlock, newBlock, updateFlag);
world.markAndNotifyBlock(snap.getPos(), null, oldBlock, newBlock, updateFlag, 512);
}
player.addStat(Stats.ITEM_USED.get(item));
}
@@ -730,7 +718,7 @@ public class ForgeHooks
return stack.isEmpty() || !stack.getItem().onLeftClickEntity(stack, player, target);
}
public static boolean onTravelToDimension(Entity entity, DimensionType dimension)
public static boolean onTravelToDimension(Entity entity, RegistryKey<World> dimension)
{
EntityTravelToDimensionEvent event = new EntityTravelToDimensionEvent(entity, dimension);
MinecraftForge.EVENT_BUS.post(event);
@@ -747,11 +735,11 @@ public class ForgeHooks
public static ActionResultType onInteractEntityAt(PlayerEntity player, Entity entity, RayTraceResult ray, Hand hand)
{
Vec3d vec3d = ray.getHitVec().subtract(entity.getPositionVec());
Vector3d vec3d = ray.getHitVec().subtract(entity.getPositionVec());
return onInteractEntityAt(player, entity, vec3d, hand);
}
public static ActionResultType onInteractEntityAt(PlayerEntity player, Entity entity, Vec3d vec3d, Hand hand)
public static ActionResultType onInteractEntityAt(PlayerEntity player, Entity entity, Vector3d vec3d, Hand hand)
{
PlayerInteractEvent.EntityInteractSpecific evt = new PlayerInteractEvent.EntityInteractSpecific(player, hand, entity, vec3d);
MinecraftForge.EVENT_BUS.post(evt);
@@ -833,8 +821,10 @@ public class ForgeHooks
if (!custom)
ret = ForgeEventFactory.loadLootTable(name, ret, lootTableManager);
if (ret != null)
/* TODO:
if (ret != null)
ret.freeze();
*/
return ret;
}
@@ -1067,7 +1057,7 @@ public class ForgeHooks
}
@Override
public IFluidState getFluidState(BlockPos pos) {
public FluidState getFluidState(BlockPos pos) {
return Fluids.EMPTY.getDefaultState();
}
@@ -1085,6 +1075,7 @@ public class ForgeHooks
return res == Result.DEFAULT ? 0 : res == Result.DENY ? -1 : 1;
}
/*
@SuppressWarnings("deprecation")
public static <T> void deserializeTagAdditions(Tag.Builder<T> builder, Function<ResourceLocation, Optional<T>> valueGetter, JsonObject json)
{
@@ -1121,6 +1112,7 @@ public class ForgeHooks
}
}
}
*/
private static final Map<IDataSerializer<?>, DataSerializerEntry> serializerEntries = GameData.getSerializerMap();
//private static final ForgeRegistry<DataSerializerEntry> serializerRegistry = (ForgeRegistry<DataSerializerEntry>) ForgeRegistries.DATA_SERIALIZERS;
@@ -1189,10 +1181,12 @@ public class ForgeHooks
* @return The modified list
*/
public static List<ItemStack> modifyLoot(List<ItemStack> list, LootContext context) {
/*
LootModifierManager man = context.getWorld().getServer().getLootModifierManager();
for(IGlobalLootModifier mod : man.getAllLootMods()) {
list = mod.apply(list, context);
}
*/
return list;
}
@@ -89,12 +89,14 @@ public class ForgeInternalHandler
FarmlandWaterManager.removeTickets(event.getChunk());
}
/*
@SubscribeEvent
public void playerChangeDimension(PlayerEvent.PlayerChangedDimensionEvent event)
{
if (event.getPlayer() instanceof ServerPlayerEntity)
DimensionManager.rebuildPlayerMap(((ServerPlayerEntity)event.getPlayer()).server.getPlayerList(), true);
}
*/
@SubscribeEvent
public void playerLogin(PlayerEvent.PlayerLoggedInEvent event)
@@ -20,6 +20,9 @@
package net.minecraftforge.common;
import net.minecraft.util.SoundEvent;
import net.minecraft.world.storage.IServerConfiguration;
import net.minecraft.world.storage.IWorldInfo;
import net.minecraft.world.storage.SaveFormat;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.*;
@@ -44,8 +47,6 @@ import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.SaveHandler;
import net.minecraft.world.storage.WorldInfo;
import net.minecraftforge.common.crafting.CompoundIngredient;
import net.minecraftforge.common.crafting.ConditionalRecipe;
import net.minecraftforge.common.crafting.CraftingHelper;
@@ -144,22 +145,24 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
}
@Override
public CompoundNBT getDataForWriting(SaveHandler handler, WorldInfo info)
public CompoundNBT getDataForWriting(SaveFormat.LevelSave levelSave, IServerConfiguration serverInfo)
{
CompoundNBT forgeData = new CompoundNBT();
CompoundNBT dims = new CompoundNBT();
DimensionManager.writeRegistry(dims);
//TODO Dimensions
// DimensionManager.writeRegistry(dims);
if (!dims.isEmpty())
forgeData.put("dims", dims);
return forgeData;
}
@Override
public void readData(SaveHandler handler, WorldInfo info, CompoundNBT tag)
public void readData(SaveFormat.LevelSave levelSave, IServerConfiguration serverInfo, CompoundNBT tag)
{
if (tag.contains("dims", 10))
DimensionManager.readRegistry(tag.getCompound("dims"));
DimensionManager.processScheduledDeletions(handler);
//TODO Dimensions
// if (tag.contains("dims", 10))
// DimensionManager.readRegistry(tag.getCompound("dims"));
// DimensionManager.processScheduledDeletions(levelSave);
}
public void mappingChanged(FMLModIdMappingEvent evt)
@@ -178,8 +181,9 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
if (event.includeServer())
{
ForgeBlockTagsProvider blockTags = new ForgeBlockTagsProvider(gen);
gen.addProvider(new ForgeBlockTagsProvider(gen));
gen.addProvider(new ForgeItemTagsProvider(gen));
gen.addProvider(new ForgeItemTagsProvider(gen, blockTags));
gen.addProvider(new ForgeRecipeProvider(gen));
gen.addProvider(new ForgeLootTableProvider(gen));
}
@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common;
/*package net.minecraftforge.common;
import java.util.function.BiFunction;
@@ -34,7 +34,7 @@ import net.minecraftforge.registries.ForgeRegistryEntry;
* We used to be able to create custom Dimensions separate from DimensionType.
* But now that they are hard linked to a single instance, this is the new class that
* defines the 'template' for new dimensions.
*/
* /
public abstract class ModDimension extends ForgeRegistryEntry<ModDimension>
{
public abstract BiFunction<World, DimensionType, ? extends Dimension> getFactory();
@@ -45,7 +45,7 @@ public abstract class ModDimension extends ForgeRegistryEntry<ModDimension>
*
* @param buffer The data buffer to write to.
* @param network true when sent over the network, so you can only data needed by the client.
*/
* /
public void write(PacketBuffer buffer, boolean network){}
/**
@@ -54,7 +54,7 @@ public abstract class ModDimension extends ForgeRegistryEntry<ModDimension>
*
* @param buffer The data buffer to write to.
* @param network true when sent over the network, so you can only data needed by the client.
*/
* /
public void read(PacketBuffer buffer, boolean network){}
public IBiomeMagnifier getMagnifier() {
@@ -67,7 +67,7 @@ public abstract class ModDimension extends ForgeRegistryEntry<ModDimension>
*
* @param factory Factory for creating {@link Dimension} instances from DimType and World.
* @return A custom ModDimension with that factory.
*/
* /
public static ModDimension withFactory(BiFunction<World, DimensionType, ? extends Dimension> factory) {
return new ModDimension() {
@Override
@@ -76,4 +76,4 @@ public abstract class ModDimension extends ForgeRegistryEntry<ModDimension>
}
};
}
}
}*/
+200 -202
View File
@@ -22,229 +22,228 @@ package net.minecraftforge.common;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ITag;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.Tag;
import net.minecraft.util.ResourceLocation;
public class Tags
{
public static class Blocks
{
public static final Tag<Block> CHESTS = tag("chests");
public static final Tag<Block> CHESTS_ENDER = tag("chests/ender");
public static final Tag<Block> CHESTS_TRAPPED = tag("chests/trapped");
public static final Tag<Block> CHESTS_WOODEN = tag("chests/wooden");
public static final Tag<Block> COBBLESTONE = tag("cobblestone");
public static final Tag<Block> DIRT = tag("dirt");
public static final Tag<Block> END_STONES = tag("end_stones");
public static final Tag<Block> FENCE_GATES = tag("fence_gates");
public static final Tag<Block> FENCE_GATES_WOODEN = tag("fence_gates/wooden");
public static final Tag<Block> FENCES = tag("fences");
public static final Tag<Block> FENCES_NETHER_BRICK = tag("fences/nether_brick");
public static final Tag<Block> FENCES_WOODEN = tag("fences/wooden");
public static final ITag.INamedTag<Block> CHESTS = tag("chests");
public static final ITag.INamedTag<Block> CHESTS_ENDER = tag("chests/ender");
public static final ITag.INamedTag<Block> CHESTS_TRAPPED = tag("chests/trapped");
public static final ITag.INamedTag<Block> CHESTS_WOODEN = tag("chests/wooden");
public static final ITag.INamedTag<Block> COBBLESTONE = tag("cobblestone");
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 = 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 = tag("fences/wooden");
public static final Tag<Block> GLASS = tag("glass");
public static final Tag<Block> GLASS_BLACK = tag("glass/black");
public static final Tag<Block> GLASS_BLUE = tag("glass/blue");
public static final Tag<Block> GLASS_BROWN = tag("glass/brown");
public static final Tag<Block> GLASS_COLORLESS = tag("glass/colorless");
public static final Tag<Block> GLASS_CYAN = tag("glass/cyan");
public static final Tag<Block> GLASS_GRAY = tag("glass/gray");
public static final Tag<Block> GLASS_GREEN = tag("glass/green");
public static final Tag<Block> GLASS_LIGHT_BLUE = tag("glass/light_blue");
public static final Tag<Block> GLASS_LIGHT_GRAY = tag("glass/light_gray");
public static final Tag<Block> GLASS_LIME = tag("glass/lime");
public static final Tag<Block> GLASS_MAGENTA = tag("glass/magenta");
public static final Tag<Block> GLASS_ORANGE = tag("glass/orange");
public static final Tag<Block> GLASS_PINK = tag("glass/pink");
public static final Tag<Block> GLASS_PURPLE = tag("glass/purple");
public static final Tag<Block> GLASS_RED = tag("glass/red");
public static final Tag<Block> GLASS_WHITE = tag("glass/white");
public static final Tag<Block> GLASS_YELLOW = tag("glass/yellow");
public static final ITag.INamedTag<Block> GLASS = tag("glass");
public static final ITag.INamedTag<Block> GLASS_BLACK = tag("glass/black");
public static final ITag.INamedTag<Block> GLASS_BLUE = tag("glass/blue");
public static final ITag.INamedTag<Block> GLASS_BROWN = tag("glass/brown");
public static final ITag.INamedTag<Block> GLASS_COLORLESS = tag("glass/colorless");
public static final ITag.INamedTag<Block> GLASS_CYAN = tag("glass/cyan");
public static final ITag.INamedTag<Block> GLASS_GRAY = tag("glass/gray");
public static final ITag.INamedTag<Block> GLASS_GREEN = tag("glass/green");
public static final ITag.INamedTag<Block> GLASS_LIGHT_BLUE = tag("glass/light_blue");
public static final ITag.INamedTag<Block> GLASS_LIGHT_GRAY = tag("glass/light_gray");
public static final ITag.INamedTag<Block> GLASS_LIME = tag("glass/lime");
public static final ITag.INamedTag<Block> GLASS_MAGENTA = tag("glass/magenta");
public static final ITag.INamedTag<Block> GLASS_ORANGE = tag("glass/orange");
public static final ITag.INamedTag<Block> GLASS_PINK = tag("glass/pink");
public static final ITag.INamedTag<Block> GLASS_PURPLE = tag("glass/purple");
public static final ITag.INamedTag<Block> GLASS_RED = tag("glass/red");
public static final ITag.INamedTag<Block> GLASS_WHITE = tag("glass/white");
public static final ITag.INamedTag<Block> GLASS_YELLOW = tag("glass/yellow");
public static final Tag<Block> GLASS_PANES = tag("glass_panes");
public static final Tag<Block> GLASS_PANES_BLACK = tag("glass_panes/black");
public static final Tag<Block> GLASS_PANES_BLUE = tag("glass_panes/blue");
public static final Tag<Block> GLASS_PANES_BROWN = tag("glass_panes/brown");
public static final Tag<Block> GLASS_PANES_COLORLESS = tag("glass_panes/colorless");
public static final Tag<Block> GLASS_PANES_CYAN = tag("glass_panes/cyan");
public static final Tag<Block> GLASS_PANES_GRAY = tag("glass_panes/gray");
public static final Tag<Block> GLASS_PANES_GREEN = tag("glass_panes/green");
public static final Tag<Block> GLASS_PANES_LIGHT_BLUE = tag("glass_panes/light_blue");
public static final Tag<Block> GLASS_PANES_LIGHT_GRAY = tag("glass_panes/light_gray");
public static final Tag<Block> GLASS_PANES_LIME = tag("glass_panes/lime");
public static final Tag<Block> GLASS_PANES_MAGENTA = tag("glass_panes/magenta");
public static final Tag<Block> GLASS_PANES_ORANGE = tag("glass_panes/orange");
public static final Tag<Block> GLASS_PANES_PINK = tag("glass_panes/pink");
public static final Tag<Block> GLASS_PANES_PURPLE = tag("glass_panes/purple");
public static final Tag<Block> GLASS_PANES_RED = tag("glass_panes/red");
public static final Tag<Block> GLASS_PANES_WHITE = tag("glass_panes/white");
public static final Tag<Block> GLASS_PANES_YELLOW = tag("glass_panes/yellow");
public static final ITag.INamedTag<Block> GLASS_PANES = tag("glass_panes");
public static final ITag.INamedTag<Block> GLASS_PANES_BLACK = tag("glass_panes/black");
public static final ITag.INamedTag<Block> GLASS_PANES_BLUE = tag("glass_panes/blue");
public static final ITag.INamedTag<Block> GLASS_PANES_BROWN = tag("glass_panes/brown");
public static final ITag.INamedTag<Block> GLASS_PANES_COLORLESS = tag("glass_panes/colorless");
public static final ITag.INamedTag<Block> GLASS_PANES_CYAN = tag("glass_panes/cyan");
public static final ITag.INamedTag<Block> GLASS_PANES_GRAY = tag("glass_panes/gray");
public static final ITag.INamedTag<Block> GLASS_PANES_GREEN = tag("glass_panes/green");
public static final ITag.INamedTag<Block> GLASS_PANES_LIGHT_BLUE = tag("glass_panes/light_blue");
public static final ITag.INamedTag<Block> GLASS_PANES_LIGHT_GRAY = tag("glass_panes/light_gray");
public static final ITag.INamedTag<Block> GLASS_PANES_LIME = tag("glass_panes/lime");
public static final ITag.INamedTag<Block> GLASS_PANES_MAGENTA = tag("glass_panes/magenta");
public static final ITag.INamedTag<Block> GLASS_PANES_ORANGE = tag("glass_panes/orange");
public static final ITag.INamedTag<Block> GLASS_PANES_PINK = tag("glass_panes/pink");
public static final ITag.INamedTag<Block> GLASS_PANES_PURPLE = tag("glass_panes/purple");
public static final ITag.INamedTag<Block> GLASS_PANES_RED = tag("glass_panes/red");
public static final ITag.INamedTag<Block> GLASS_PANES_WHITE = tag("glass_panes/white");
public static final ITag.INamedTag<Block> GLASS_PANES_YELLOW = tag("glass_panes/yellow");
public static final Tag<Block> GRAVEL = tag("gravel");
public static final Tag<Block> NETHERRACK = tag("netherrack");
public static final Tag<Block> OBSIDIAN = tag("obsidian");
public static final Tag<Block> ORES = tag("ores");
public static final Tag<Block> ORES_COAL = tag("ores/coal");
public static final Tag<Block> ORES_DIAMOND = tag("ores/diamond");
public static final Tag<Block> ORES_EMERALD = tag("ores/emerald");
public static final Tag<Block> ORES_GOLD = tag("ores/gold");
public static final Tag<Block> ORES_IRON = tag("ores/iron");
public static final Tag<Block> ORES_LAPIS = tag("ores/lapis");
public static final Tag<Block> ORES_QUARTZ = tag("ores/quartz");
public static final Tag<Block> ORES_REDSTONE = tag("ores/redstone");
public static final ITag.INamedTag<Block> GRAVEL = tag("gravel");
public static final ITag.INamedTag<Block> NETHERRACK = tag("netherrack");
public static final ITag.INamedTag<Block> OBSIDIAN = tag("obsidian");
public static final ITag.INamedTag<Block> ORES = tag("ores");
public static final ITag.INamedTag<Block> ORES_COAL = tag("ores/coal");
public static final ITag.INamedTag<Block> ORES_DIAMOND = tag("ores/diamond");
public static final ITag.INamedTag<Block> ORES_EMERALD = tag("ores/emerald");
public static final ITag.INamedTag<Block> ORES_GOLD = tag("ores/gold");
public static final ITag.INamedTag<Block> ORES_IRON = tag("ores/iron");
public static final ITag.INamedTag<Block> ORES_LAPIS = tag("ores/lapis");
public static final ITag.INamedTag<Block> ORES_QUARTZ = tag("ores/quartz");
public static final ITag.INamedTag<Block> ORES_REDSTONE = tag("ores/redstone");
public static final Tag<Block> SAND = tag("sand");
public static final Tag<Block> SAND_COLORLESS = tag("sand/colorless");
public static final Tag<Block> SAND_RED = tag("sand/red");
public static final ITag.INamedTag<Block> SAND = tag("sand");
public static final ITag.INamedTag<Block> SAND_COLORLESS = tag("sand/colorless");
public static final ITag.INamedTag<Block> SAND_RED = tag("sand/red");
public static final Tag<Block> SANDSTONE = tag("sandstone");
public static final Tag<Block> STAINED_GLASS = tag("stained_glass");
public static final Tag<Block> STAINED_GLASS_PANES = tag("stained_glass_panes");
public static final Tag<Block> STONE = tag("stone");
public static final Tag<Block> STORAGE_BLOCKS = tag("storage_blocks");
public static final Tag<Block> STORAGE_BLOCKS_COAL = tag("storage_blocks/coal");
public static final Tag<Block> STORAGE_BLOCKS_DIAMOND = tag("storage_blocks/diamond");
public static final Tag<Block> STORAGE_BLOCKS_EMERALD = tag("storage_blocks/emerald");
public static final Tag<Block> STORAGE_BLOCKS_GOLD = tag("storage_blocks/gold");
public static final Tag<Block> STORAGE_BLOCKS_IRON = tag("storage_blocks/iron");
public static final Tag<Block> STORAGE_BLOCKS_LAPIS = tag("storage_blocks/lapis");
public static final Tag<Block> STORAGE_BLOCKS_QUARTZ = tag("storage_blocks/quartz");
public static final Tag<Block> STORAGE_BLOCKS_REDSTONE = tag("storage_blocks/redstone");
public static final ITag.INamedTag<Block> SANDSTONE = tag("sandstone");
public static final ITag.INamedTag<Block> STAINED_GLASS = tag("stained_glass");
public static final ITag.INamedTag<Block> STAINED_GLASS_PANES = tag("stained_glass_panes");
public static final ITag.INamedTag<Block> STONE = tag("stone");
public static final ITag.INamedTag<Block> STORAGE_BLOCKS = tag("storage_blocks");
public static final ITag.INamedTag<Block> STORAGE_BLOCKS_COAL = tag("storage_blocks/coal");
public static final ITag.INamedTag<Block> STORAGE_BLOCKS_DIAMOND = tag("storage_blocks/diamond");
public static final ITag.INamedTag<Block> STORAGE_BLOCKS_EMERALD = tag("storage_blocks/emerald");
public static final ITag.INamedTag<Block> STORAGE_BLOCKS_GOLD = tag("storage_blocks/gold");
public static final ITag.INamedTag<Block> STORAGE_BLOCKS_IRON = tag("storage_blocks/iron");
public static final ITag.INamedTag<Block> STORAGE_BLOCKS_LAPIS = tag("storage_blocks/lapis");
public static final ITag.INamedTag<Block> STORAGE_BLOCKS_QUARTZ = tag("storage_blocks/quartz");
public static final ITag.INamedTag<Block> STORAGE_BLOCKS_REDSTONE = tag("storage_blocks/redstone");
private static Tag<Block> tag(String name)
private static ITag.INamedTag<Block> tag(String name)
{
return new BlockTags.Wrapper(new ResourceLocation("forge", name));
return BlockTags.makeWrapperTag("forge:" + name);
}
}
public static class Items
{
public static final Tag<Item> ARROWS = tag("arrows");
public static final Tag<Item> BEACON_PAYMENT = tag("beacon_payment");
public static final Tag<Item> BONES = tag("bones");
public static final Tag<Item> BOOKSHELVES = tag("bookshelves");
public static final Tag<Item> CHESTS = tag("chests");
public static final Tag<Item> CHESTS_ENDER = tag("chests/ender");
public static final Tag<Item> CHESTS_TRAPPED = tag("chests/trapped");
public static final Tag<Item> CHESTS_WOODEN = tag("chests/wooden");
public static final Tag<Item> COBBLESTONE = tag("cobblestone");
public static final Tag<Item> CROPS = tag("crops");
public static final Tag<Item> CROPS_BEETROOT = tag("crops/beetroot");
public static final Tag<Item> CROPS_CARROT = tag("crops/carrot");
public static final Tag<Item> CROPS_NETHER_WART = tag("crops/nether_wart");
public static final Tag<Item> CROPS_POTATO = tag("crops/potato");
public static final Tag<Item> CROPS_WHEAT = tag("crops/wheat");
public static final Tag<Item> DUSTS = tag("dusts");
public static final Tag<Item> DUSTS_PRISMARINE = tag("dusts/prismarine");
public static final Tag<Item> DUSTS_REDSTONE = tag("dusts/redstone");
public static final Tag<Item> DUSTS_GLOWSTONE = tag("dusts/glowstone");
public static final ITag.INamedTag<Item> ARROWS = tag("arrows");
public static final ITag.INamedTag<Item> BEACON_PAYMENT = tag("beacon_payment");
public static final ITag.INamedTag<Item> BONES = tag("bones");
public static final ITag.INamedTag<Item> BOOKSHELVES = tag("bookshelves");
public static final ITag.INamedTag<Item> CHESTS = tag("chests");
public static final ITag.INamedTag<Item> CHESTS_ENDER = tag("chests/ender");
public static final ITag.INamedTag<Item> CHESTS_TRAPPED = tag("chests/trapped");
public static final ITag.INamedTag<Item> CHESTS_WOODEN = tag("chests/wooden");
public static final ITag.INamedTag<Item> COBBLESTONE = tag("cobblestone");
public static final ITag.INamedTag<Item> CROPS = tag("crops");
public static final ITag.INamedTag<Item> CROPS_BEETROOT = tag("crops/beetroot");
public static final ITag.INamedTag<Item> CROPS_CARROT = tag("crops/carrot");
public static final ITag.INamedTag<Item> CROPS_NETHER_WART = tag("crops/nether_wart");
public static final ITag.INamedTag<Item> CROPS_POTATO = tag("crops/potato");
public static final ITag.INamedTag<Item> CROPS_WHEAT = tag("crops/wheat");
public static final ITag.INamedTag<Item> DUSTS = tag("dusts");
public static final ITag.INamedTag<Item> DUSTS_PRISMARINE = tag("dusts/prismarine");
public static final ITag.INamedTag<Item> DUSTS_REDSTONE = tag("dusts/redstone");
public static final ITag.INamedTag<Item> DUSTS_GLOWSTONE = tag("dusts/glowstone");
public static final Tag<Item> DYES = tag("dyes");
public static final Tag<Item> DYES_BLACK = tag("dyes/black");
public static final Tag<Item> DYES_RED = tag("dyes/red");
public static final Tag<Item> DYES_GREEN = tag("dyes/green");
public static final Tag<Item> DYES_BROWN = tag("dyes/brown");
public static final Tag<Item> DYES_BLUE = tag("dyes/blue");
public static final Tag<Item> DYES_PURPLE = tag("dyes/purple");
public static final Tag<Item> DYES_CYAN = tag("dyes/cyan");
public static final Tag<Item> DYES_LIGHT_GRAY = tag("dyes/light_gray");
public static final Tag<Item> DYES_GRAY = tag("dyes/gray");
public static final Tag<Item> DYES_PINK = tag("dyes/pink");
public static final Tag<Item> DYES_LIME = tag("dyes/lime");
public static final Tag<Item> DYES_YELLOW = tag("dyes/yellow");
public static final Tag<Item> DYES_LIGHT_BLUE = tag("dyes/light_blue");
public static final Tag<Item> DYES_MAGENTA = tag("dyes/magenta");
public static final Tag<Item> DYES_ORANGE = tag("dyes/orange");
public static final Tag<Item> DYES_WHITE = tag("dyes/white");
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 Tag<Item> EGGS = tag("eggs");
public static final Tag<Item> END_STONES = tag("end_stones");
public static final Tag<Item> ENDER_PEARLS = tag("ender_pearls");
public static final Tag<Item> FEATHERS = tag("feathers");
public static final Tag<Item> FENCE_GATES = tag("fence_gates");
public static final Tag<Item> FENCE_GATES_WOODEN = tag("fence_gates/wooden");
public static final Tag<Item> FENCES = tag("fences");
public static final Tag<Item> FENCES_NETHER_BRICK = tag("fences/nether_brick");
public static final Tag<Item> FENCES_WOODEN = tag("fences/wooden");
public static final Tag<Item> GEMS = tag("gems");
public static final Tag<Item> GEMS_DIAMOND = tag("gems/diamond");
public static final Tag<Item> GEMS_EMERALD = tag("gems/emerald");
public static final Tag<Item> GEMS_LAPIS = tag("gems/lapis");
public static final Tag<Item> GEMS_PRISMARINE = tag("gems/prismarine");
public static final Tag<Item> GEMS_QUARTZ = tag("gems/quartz");
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 = 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 = 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");
public static final ITag.INamedTag<Item> GEMS_LAPIS = tag("gems/lapis");
public static final ITag.INamedTag<Item> GEMS_PRISMARINE = tag("gems/prismarine");
public static final ITag.INamedTag<Item> GEMS_QUARTZ = tag("gems/quartz");
public static final Tag<Item> GLASS = tag("glass");
public static final Tag<Item> GLASS_BLACK = tag("glass/black");
public static final Tag<Item> GLASS_BLUE = tag("glass/blue");
public static final Tag<Item> GLASS_BROWN = tag("glass/brown");
public static final Tag<Item> GLASS_COLORLESS = tag("glass/colorless");
public static final Tag<Item> GLASS_CYAN = tag("glass/cyan");
public static final Tag<Item> GLASS_GRAY = tag("glass/gray");
public static final Tag<Item> GLASS_GREEN = tag("glass/green");
public static final Tag<Item> GLASS_LIGHT_BLUE = tag("glass/light_blue");
public static final Tag<Item> GLASS_LIGHT_GRAY = tag("glass/light_gray");
public static final Tag<Item> GLASS_LIME = tag("glass/lime");
public static final Tag<Item> GLASS_MAGENTA = tag("glass/magenta");
public static final Tag<Item> GLASS_ORANGE = tag("glass/orange");
public static final Tag<Item> GLASS_PINK = tag("glass/pink");
public static final Tag<Item> GLASS_PURPLE = tag("glass/purple");
public static final Tag<Item> GLASS_RED = tag("glass/red");
public static final Tag<Item> GLASS_WHITE = tag("glass/white");
public static final Tag<Item> GLASS_YELLOW = tag("glass/yellow");
public static final ITag.INamedTag<Item> GLASS = tag("glass");
public static final ITag.INamedTag<Item> GLASS_BLACK = tag("glass/black");
public static final ITag.INamedTag<Item> GLASS_BLUE = tag("glass/blue");
public static final ITag.INamedTag<Item> GLASS_BROWN = tag("glass/brown");
public static final ITag.INamedTag<Item> GLASS_COLORLESS = tag("glass/colorless");
public static final ITag.INamedTag<Item> GLASS_CYAN = tag("glass/cyan");
public static final ITag.INamedTag<Item> GLASS_GRAY = tag("glass/gray");
public static final ITag.INamedTag<Item> GLASS_GREEN = tag("glass/green");
public static final ITag.INamedTag<Item> GLASS_LIGHT_BLUE = tag("glass/light_blue");
public static final ITag.INamedTag<Item> GLASS_LIGHT_GRAY = tag("glass/light_gray");
public static final ITag.INamedTag<Item> GLASS_LIME = tag("glass/lime");
public static final ITag.INamedTag<Item> GLASS_MAGENTA = tag("glass/magenta");
public static final ITag.INamedTag<Item> GLASS_ORANGE = tag("glass/orange");
public static final ITag.INamedTag<Item> GLASS_PINK = tag("glass/pink");
public static final ITag.INamedTag<Item> GLASS_PURPLE = tag("glass/purple");
public static final ITag.INamedTag<Item> GLASS_RED = tag("glass/red");
public static final ITag.INamedTag<Item> GLASS_WHITE = tag("glass/white");
public static final ITag.INamedTag<Item> GLASS_YELLOW = tag("glass/yellow");
public static final Tag<Item> GLASS_PANES = tag("glass_panes");
public static final Tag<Item> GLASS_PANES_BLACK = tag("glass_panes/black");
public static final Tag<Item> GLASS_PANES_BLUE = tag("glass_panes/blue");
public static final Tag<Item> GLASS_PANES_BROWN = tag("glass_panes/brown");
public static final Tag<Item> GLASS_PANES_COLORLESS = tag("glass_panes/colorless");
public static final Tag<Item> GLASS_PANES_CYAN = tag("glass_panes/cyan");
public static final Tag<Item> GLASS_PANES_GRAY = tag("glass_panes/gray");
public static final Tag<Item> GLASS_PANES_GREEN = tag("glass_panes/green");
public static final Tag<Item> GLASS_PANES_LIGHT_BLUE = tag("glass_panes/light_blue");
public static final Tag<Item> GLASS_PANES_LIGHT_GRAY = tag("glass_panes/light_gray");
public static final Tag<Item> GLASS_PANES_LIME = tag("glass_panes/lime");
public static final Tag<Item> GLASS_PANES_MAGENTA = tag("glass_panes/magenta");
public static final Tag<Item> GLASS_PANES_ORANGE = tag("glass_panes/orange");
public static final Tag<Item> GLASS_PANES_PINK = tag("glass_panes/pink");
public static final Tag<Item> GLASS_PANES_PURPLE = tag("glass_panes/purple");
public static final Tag<Item> GLASS_PANES_RED = tag("glass_panes/red");
public static final Tag<Item> GLASS_PANES_WHITE = tag("glass_panes/white");
public static final Tag<Item> GLASS_PANES_YELLOW = tag("glass_panes/yellow");
public static final ITag.INamedTag<Item> GLASS_PANES = tag("glass_panes");
public static final ITag.INamedTag<Item> GLASS_PANES_BLACK = tag("glass_panes/black");
public static final ITag.INamedTag<Item> GLASS_PANES_BLUE = tag("glass_panes/blue");
public static final ITag.INamedTag<Item> GLASS_PANES_BROWN = tag("glass_panes/brown");
public static final ITag.INamedTag<Item> GLASS_PANES_COLORLESS = tag("glass_panes/colorless");
public static final ITag.INamedTag<Item> GLASS_PANES_CYAN = tag("glass_panes/cyan");
public static final ITag.INamedTag<Item> GLASS_PANES_GRAY = tag("glass_panes/gray");
public static final ITag.INamedTag<Item> GLASS_PANES_GREEN = tag("glass_panes/green");
public static final ITag.INamedTag<Item> GLASS_PANES_LIGHT_BLUE = tag("glass_panes/light_blue");
public static final ITag.INamedTag<Item> GLASS_PANES_LIGHT_GRAY = tag("glass_panes/light_gray");
public static final ITag.INamedTag<Item> GLASS_PANES_LIME = tag("glass_panes/lime");
public static final ITag.INamedTag<Item> GLASS_PANES_MAGENTA = tag("glass_panes/magenta");
public static final ITag.INamedTag<Item> GLASS_PANES_ORANGE = tag("glass_panes/orange");
public static final ITag.INamedTag<Item> GLASS_PANES_PINK = tag("glass_panes/pink");
public static final ITag.INamedTag<Item> GLASS_PANES_PURPLE = tag("glass_panes/purple");
public static final ITag.INamedTag<Item> GLASS_PANES_RED = tag("glass_panes/red");
public static final ITag.INamedTag<Item> GLASS_PANES_WHITE = tag("glass_panes/white");
public static final ITag.INamedTag<Item> GLASS_PANES_YELLOW = tag("glass_panes/yellow");
public static final Tag<Item> GRAVEL = tag("gravel");
public static final Tag<Item> GUNPOWDER = tag("gunpowder");
public static final Tag<Item> HEADS = tag("heads");
public static final Tag<Item> INGOTS = tag("ingots");
public static final Tag<Item> INGOTS_BRICK = tag("ingots/brick");
public static final Tag<Item> INGOTS_GOLD = tag("ingots/gold");
public static final Tag<Item> INGOTS_IRON = tag("ingots/iron");
public static final Tag<Item> INGOTS_NETHER_BRICK = tag("ingots/nether_brick");
public static final Tag<Item> LEATHER = tag("leather");
public static final Tag<Item> MUSHROOMS = tag("mushrooms");
public static final Tag<Item> MUSIC_DISCS = tag("music_discs");
public static final Tag<Item> NETHER_STARS = tag("nether_stars");
public static final Tag<Item> NETHERRACK = tag("netherrack");
public static final Tag<Item> NUGGETS = tag("nuggets");
public static final Tag<Item> NUGGETS_GOLD = tag("nuggets/gold");
public static final Tag<Item> NUGGETS_IRON = tag("nuggets/iron");
public static final Tag<Item> OBSIDIAN = tag("obsidian");
public static final Tag<Item> ORES = tag("ores");
public static final Tag<Item> ORES_COAL = tag("ores/coal");
public static final Tag<Item> ORES_DIAMOND = tag("ores/diamond");
public static final Tag<Item> ORES_EMERALD = tag("ores/emerald");
public static final Tag<Item> ORES_GOLD = tag("ores/gold");
public static final Tag<Item> ORES_IRON = tag("ores/iron");
public static final Tag<Item> ORES_LAPIS = tag("ores/lapis");
public static final Tag<Item> ORES_QUARTZ = tag("ores/quartz");
public static final Tag<Item> ORES_REDSTONE = tag("ores/redstone");
public static final Tag<Item> RODS = tag("rods");
public static final Tag<Item> RODS_BLAZE = tag("rods/blaze");
public static final Tag<Item> RODS_WOODEN = tag("rods/wooden");
public static final ITag.INamedTag<Item> GRAVEL = tag("gravel");
public static final ITag.INamedTag<Item> GUNPOWDER = tag("gunpowder");
public static final ITag.INamedTag<Item> HEADS = tag("heads");
public static final ITag.INamedTag<Item> INGOTS = tag("ingots");
public static final ITag.INamedTag<Item> INGOTS_BRICK = tag("ingots/brick");
public static final ITag.INamedTag<Item> INGOTS_GOLD = tag("ingots/gold");
public static final ITag.INamedTag<Item> INGOTS_IRON = tag("ingots/iron");
public static final ITag.INamedTag<Item> INGOTS_NETHER_BRICK = tag("ingots/nether_brick");
public static final ITag.INamedTag<Item> LEATHER = tag("leather");
public static final ITag.INamedTag<Item> MUSHROOMS = tag("mushrooms");
public static final ITag.INamedTag<Item> MUSIC_DISCS = tag("music_discs");
public static final ITag.INamedTag<Item> NETHER_STARS = tag("nether_stars");
public static final ITag.INamedTag<Item> NETHERRACK = tag("netherrack");
public static final ITag.INamedTag<Item> NUGGETS = tag("nuggets");
public static final ITag.INamedTag<Item> NUGGETS_GOLD = tag("nuggets/gold");
public static final ITag.INamedTag<Item> NUGGETS_IRON = tag("nuggets/iron");
public static final ITag.INamedTag<Item> OBSIDIAN = tag("obsidian");
public static final ITag.INamedTag<Item> ORES = tag("ores");
public static final ITag.INamedTag<Item> ORES_COAL = tag("ores/coal");
public static final ITag.INamedTag<Item> ORES_DIAMOND = tag("ores/diamond");
public static final ITag.INamedTag<Item> ORES_EMERALD = tag("ores/emerald");
public static final ITag.INamedTag<Item> ORES_GOLD = tag("ores/gold");
public static final ITag.INamedTag<Item> ORES_IRON = tag("ores/iron");
public static final ITag.INamedTag<Item> ORES_LAPIS = tag("ores/lapis");
public static final ITag.INamedTag<Item> ORES_QUARTZ = tag("ores/quartz");
public static final ITag.INamedTag<Item> ORES_REDSTONE = tag("ores/redstone");
public static final ITag.INamedTag<Item> RODS = tag("rods");
public static final ITag.INamedTag<Item> RODS_BLAZE = tag("rods/blaze");
public static final ITag.INamedTag<Item> RODS_WOODEN = tag("rods/wooden");
public static final Tag<Item> SAND = tag("sand");
public static final Tag<Item> SAND_COLORLESS = tag("sand/colorless");
public static final Tag<Item> SAND_RED = tag("sand/red");
public static final ITag.INamedTag<Item> SAND = tag("sand");
public static final ITag.INamedTag<Item> SAND_COLORLESS = tag("sand/colorless");
public static final ITag.INamedTag<Item> SAND_RED = tag("sand/red");
public static final ITag.INamedTag<Item> SANDSTONE = tag("sandstone");
public static final ITag.INamedTag<Item> SEEDS = tag("seeds");
@@ -252,7 +251,6 @@ public class Tags
public static final ITag.INamedTag<Item> SEEDS_MELON = tag("seeds/melon");
public static final ITag.INamedTag<Item> SEEDS_PUMPKIN = tag("seeds/pumpkin");
public static final ITag.INamedTag<Item> SEEDS_WHEAT = tag("seeds/wheat");
public static final ITag.INamedTag<Item> SHEARS = tag("shears");
public static final ITag.INamedTag<Item> SLIMEBALLS = tag("slimeballs");
public static final ITag.INamedTag<Item> STAINED_GLASS = tag("stained_glass");
public static final ITag.INamedTag<Item> STAINED_GLASS_PANES = tag("stained_glass_panes");
@@ -268,9 +266,9 @@ public class Tags
public static final ITag.INamedTag<Item> STORAGE_BLOCKS_REDSTONE = tag("storage_blocks/redstone");
public static final ITag.INamedTag<Item> STRING = tag("string");
private static Tag<Item> tag(String name)
private static ITag.INamedTag<Item> tag(String name)
{
return new ItemTags.Wrapper(new ResourceLocation("forge", name));
return ItemTags.makeWrapperTag("forge:" + name);
}
}
}
@@ -53,7 +53,7 @@ public final class TimeValues
}
@Override
public String getName()
public String func_176610_l()
{
return "identity";
}
@@ -245,7 +245,7 @@ public final class TimeValues
}
@Override
public String getName()
public String func_176610_l()
{
return parameterName;
}
@@ -347,7 +347,7 @@ public final class TimeValues
}
else if(parameter instanceof IStringSerializable)
{
out.value("#" + ((IStringSerializable)parameter).getName());
out.value("#" + ((IStringSerializable)parameter).func_176610_l());
}
}
@@ -22,6 +22,7 @@ package net.minecraftforge.common.crafting.conditions;
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.util.JSONUtils;
@@ -56,8 +57,8 @@ public class TagEmptyCondition implements ICondition
@Override
public boolean test()
{
Tag<Item> tag = ItemTags.getCollection().get(tag_name);
return tag == null || tag.getAllElements().isEmpty();
ITag<Item> tag = ItemTags.getCollection().get(tag_name);
return tag == null || tag.func_230236_b_().isEmpty();
}
@Override
@@ -21,6 +21,7 @@ package net.minecraftforge.common.data;
import net.minecraft.data.DataGenerator;
import net.minecraft.item.DyeColor;
import net.minecraft.tags.ITag;
import net.minecraft.tags.Tag;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.Tags;
@@ -50,76 +51,76 @@ public class ForgeBlockTagsProvider extends BlockTagsProvider
public void registerTags()
{
super.registerTags();
filter = this.tagToBuilder.entrySet().stream().map(e -> e.getKey().getId()).collect(Collectors.toSet());
filter = this.tagToBuilder.entrySet().stream().map(e -> e.getKey()).collect(Collectors.toSet());
getBuilder(CHESTS).add(CHESTS_ENDER, CHESTS_TRAPPED, CHESTS_WOODEN);
getBuilder(CHESTS_ENDER).add(Blocks.ENDER_CHEST);
getBuilder(CHESTS_TRAPPED).add(Blocks.TRAPPED_CHEST);
getBuilder(CHESTS_WOODEN).add(Blocks.CHEST, Blocks.TRAPPED_CHEST);
getBuilder(COBBLESTONE).add(Blocks.COBBLESTONE, Blocks.INFESTED_COBBLESTONE, Blocks.MOSSY_COBBLESTONE);
getBuilder(DIRT).add(Blocks.DIRT, Blocks.GRASS_BLOCK, Blocks.COARSE_DIRT, Blocks.PODZOL, Blocks.MYCELIUM);
getBuilder(END_STONES).add(Blocks.END_STONE);
getBuilder(FENCE_GATES).add(FENCE_GATES_WOODEN);
getBuilder(FENCE_GATES_WOODEN).add(Blocks.OAK_FENCE_GATE, Blocks.SPRUCE_FENCE_GATE, Blocks.BIRCH_FENCE_GATE, Blocks.JUNGLE_FENCE_GATE, Blocks.ACACIA_FENCE_GATE, Blocks.DARK_OAK_FENCE_GATE);
getBuilder(FENCES).add(FENCES_NETHER_BRICK, FENCES_WOODEN);
getBuilder(FENCES_NETHER_BRICK).add(Blocks.NETHER_BRICK_FENCE);
getBuilder(FENCES_WOODEN).add(Blocks.OAK_FENCE, Blocks.SPRUCE_FENCE, Blocks.BIRCH_FENCE, Blocks.JUNGLE_FENCE, Blocks.ACACIA_FENCE, Blocks.DARK_OAK_FENCE);
getBuilder(GLASS).add(GLASS_COLORLESS, STAINED_GLASS);
getBuilder(GLASS_COLORLESS).add(Blocks.GLASS);
addColored(getBuilder(STAINED_GLASS)::add, GLASS, "{color}_stained_glass");
getBuilder(GLASS_PANES).add(GLASS_PANES_COLORLESS, STAINED_GLASS_PANES);
getBuilder(GLASS_PANES_COLORLESS).add(Blocks.GLASS_PANE);
addColored(getBuilder(STAINED_GLASS_PANES)::add, GLASS_PANES, "{color}_stained_glass_pane");
getBuilder(GRAVEL).add(Blocks.GRAVEL);
getBuilder(NETHERRACK).add(Blocks.NETHERRACK);
getBuilder(OBSIDIAN).add(Blocks.OBSIDIAN);
getBuilder(ORES).add(ORES_COAL, ORES_DIAMOND, ORES_EMERALD, ORES_GOLD, ORES_IRON, ORES_LAPIS, ORES_REDSTONE, ORES_QUARTZ);
getBuilder(ORES_COAL).add(Blocks.COAL_ORE);
getBuilder(ORES_DIAMOND).add(Blocks.DIAMOND_ORE);
getBuilder(ORES_EMERALD).add(Blocks.EMERALD_ORE);
getBuilder(ORES_GOLD).add(Blocks.GOLD_ORE);
getBuilder(ORES_IRON).add(Blocks.IRON_ORE);
getBuilder(ORES_LAPIS).add(Blocks.LAPIS_ORE);
getBuilder(ORES_QUARTZ).add(Blocks.NETHER_QUARTZ_ORE);
getBuilder(ORES_REDSTONE).add(Blocks.REDSTONE_ORE);
getBuilder(SAND).add(SAND_COLORLESS, SAND_RED);
getBuilder(SAND_COLORLESS).add(Blocks.SAND);
getBuilder(SAND_RED).add(Blocks.RED_SAND);
getBuilder(SANDSTONE).add(Blocks.SANDSTONE, Blocks.CUT_SANDSTONE, Blocks.CHISELED_SANDSTONE, Blocks.SMOOTH_SANDSTONE, Blocks.RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE, Blocks.SMOOTH_RED_SANDSTONE);
getBuilder(STONE).add(Blocks.ANDESITE, Blocks.DIORITE, Blocks.GRANITE, Blocks.INFESTED_STONE, Blocks.STONE, Blocks.POLISHED_ANDESITE, Blocks.POLISHED_DIORITE, Blocks.POLISHED_GRANITE);
getBuilder(STORAGE_BLOCKS).add(STORAGE_BLOCKS_COAL, STORAGE_BLOCKS_DIAMOND, STORAGE_BLOCKS_EMERALD, STORAGE_BLOCKS_GOLD, STORAGE_BLOCKS_IRON, STORAGE_BLOCKS_LAPIS, STORAGE_BLOCKS_QUARTZ, STORAGE_BLOCKS_REDSTONE);
getBuilder(STORAGE_BLOCKS_COAL).add(Blocks.COAL_BLOCK);
getBuilder(STORAGE_BLOCKS_DIAMOND).add(Blocks.DIAMOND_BLOCK);
getBuilder(STORAGE_BLOCKS_EMERALD).add(Blocks.EMERALD_BLOCK);
getBuilder(STORAGE_BLOCKS_GOLD).add(Blocks.GOLD_BLOCK);
getBuilder(STORAGE_BLOCKS_IRON).add(Blocks.IRON_BLOCK);
getBuilder(STORAGE_BLOCKS_LAPIS).add(Blocks.LAPIS_BLOCK);
getBuilder(STORAGE_BLOCKS_QUARTZ).add(Blocks.QUARTZ_BLOCK);
getBuilder(STORAGE_BLOCKS_REDSTONE).add(Blocks.REDSTONE_BLOCK);
func_240522_a_(CHESTS).addTags(CHESTS_ENDER, CHESTS_TRAPPED, CHESTS_WOODEN);
func_240522_a_(CHESTS_ENDER).func_240534_a_(Blocks.ENDER_CHEST);
func_240522_a_(CHESTS_TRAPPED).func_240534_a_(Blocks.TRAPPED_CHEST);
func_240522_a_(CHESTS_WOODEN).func_240534_a_(Blocks.CHEST, Blocks.TRAPPED_CHEST);
func_240522_a_(COBBLESTONE).func_240534_a_(Blocks.COBBLESTONE, Blocks.INFESTED_COBBLESTONE, Blocks.MOSSY_COBBLESTONE);
func_240522_a_(DIRT).func_240534_a_(Blocks.DIRT, Blocks.GRASS_BLOCK, Blocks.COARSE_DIRT, Blocks.PODZOL, Blocks.MYCELIUM);
func_240522_a_(END_STONES).func_240534_a_(Blocks.END_STONE);
func_240522_a_(FENCE_GATES).addTags(FENCE_GATES_WOODEN);
func_240522_a_(FENCE_GATES_WOODEN).func_240534_a_(Blocks.OAK_FENCE_GATE, Blocks.SPRUCE_FENCE_GATE, Blocks.BIRCH_FENCE_GATE, Blocks.JUNGLE_FENCE_GATE, Blocks.ACACIA_FENCE_GATE, Blocks.DARK_OAK_FENCE_GATE);
func_240522_a_(FENCES).addTags(FENCES_NETHER_BRICK, FENCES_WOODEN);
func_240522_a_(FENCES_NETHER_BRICK).func_240534_a_(Blocks.NETHER_BRICK_FENCE);
func_240522_a_(FENCES_WOODEN).func_240534_a_(Blocks.OAK_FENCE, Blocks.SPRUCE_FENCE, Blocks.BIRCH_FENCE, Blocks.JUNGLE_FENCE, Blocks.ACACIA_FENCE, Blocks.DARK_OAK_FENCE);
func_240522_a_(GLASS).addTags(GLASS_COLORLESS, STAINED_GLASS);
func_240522_a_(GLASS_COLORLESS).func_240534_a_(Blocks.GLASS);
addColored(func_240522_a_(STAINED_GLASS)::func_240534_a_, GLASS, "{color}_stained_glass");
func_240522_a_(GLASS_PANES).addTags(GLASS_PANES_COLORLESS, STAINED_GLASS_PANES);
func_240522_a_(GLASS_PANES_COLORLESS).func_240534_a_(Blocks.GLASS_PANE);
addColored(func_240522_a_(STAINED_GLASS_PANES)::func_240534_a_, GLASS_PANES, "{color}_stained_glass_pane");
func_240522_a_(GRAVEL).func_240534_a_(Blocks.GRAVEL);
func_240522_a_(NETHERRACK).func_240534_a_(Blocks.NETHERRACK);
func_240522_a_(OBSIDIAN).func_240534_a_(Blocks.OBSIDIAN);
func_240522_a_(ORES).addTags(ORES_COAL, ORES_DIAMOND, ORES_EMERALD, ORES_GOLD, ORES_IRON, ORES_LAPIS, ORES_REDSTONE, ORES_QUARTZ);
func_240522_a_(ORES_COAL).func_240534_a_(Blocks.COAL_ORE);
func_240522_a_(ORES_DIAMOND).func_240534_a_(Blocks.DIAMOND_ORE);
func_240522_a_(ORES_EMERALD).func_240534_a_(Blocks.EMERALD_ORE);
func_240522_a_(ORES_GOLD).func_240534_a_(Blocks.GOLD_ORE);
func_240522_a_(ORES_IRON).func_240534_a_(Blocks.IRON_ORE);
func_240522_a_(ORES_LAPIS).func_240534_a_(Blocks.LAPIS_ORE);
func_240522_a_(ORES_QUARTZ).func_240534_a_(Blocks.NETHER_QUARTZ_ORE);
func_240522_a_(ORES_REDSTONE).func_240534_a_(Blocks.REDSTONE_ORE);
func_240522_a_(SAND).addTags(SAND_COLORLESS, SAND_RED);
func_240522_a_(SAND_COLORLESS).func_240534_a_(Blocks.SAND);
func_240522_a_(SAND_RED).func_240534_a_(Blocks.RED_SAND);
func_240522_a_(SANDSTONE).func_240534_a_(Blocks.SANDSTONE, Blocks.CUT_SANDSTONE, Blocks.CHISELED_SANDSTONE, Blocks.SMOOTH_SANDSTONE, Blocks.RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE, Blocks.SMOOTH_RED_SANDSTONE);
func_240522_a_(STONE).func_240534_a_(Blocks.ANDESITE, Blocks.DIORITE, Blocks.GRANITE, Blocks.INFESTED_STONE, Blocks.STONE, Blocks.POLISHED_ANDESITE, Blocks.POLISHED_DIORITE, Blocks.POLISHED_GRANITE);
func_240522_a_(STORAGE_BLOCKS).addTags(STORAGE_BLOCKS_COAL, STORAGE_BLOCKS_DIAMOND, STORAGE_BLOCKS_EMERALD, STORAGE_BLOCKS_GOLD, STORAGE_BLOCKS_IRON, STORAGE_BLOCKS_LAPIS, STORAGE_BLOCKS_QUARTZ, STORAGE_BLOCKS_REDSTONE);
func_240522_a_(STORAGE_BLOCKS_COAL).func_240534_a_(Blocks.COAL_BLOCK);
func_240522_a_(STORAGE_BLOCKS_DIAMOND).func_240534_a_(Blocks.DIAMOND_BLOCK);
func_240522_a_(STORAGE_BLOCKS_EMERALD).func_240534_a_(Blocks.EMERALD_BLOCK);
func_240522_a_(STORAGE_BLOCKS_GOLD).func_240534_a_(Blocks.GOLD_BLOCK);
func_240522_a_(STORAGE_BLOCKS_IRON).func_240534_a_(Blocks.IRON_BLOCK);
func_240522_a_(STORAGE_BLOCKS_LAPIS).func_240534_a_(Blocks.LAPIS_BLOCK);
func_240522_a_(STORAGE_BLOCKS_QUARTZ).func_240534_a_(Blocks.QUARTZ_BLOCK);
func_240522_a_(STORAGE_BLOCKS_REDSTONE).func_240534_a_(Blocks.REDSTONE_BLOCK);
}
private void addColored(Consumer<Block> consumer, Tag<Block> group, String pattern)
private void addColored(Consumer<Block> consumer, ITag.INamedTag<Block> group, String pattern)
{
String prefix = group.getId().getPath().toUpperCase(Locale.ENGLISH) + '_';
String prefix = group.func_230234_a_().getPath().toUpperCase(Locale.ENGLISH) + '_';
for (DyeColor color : DyeColor.values())
{
ResourceLocation key = new ResourceLocation("minecraft", pattern.replace("{color}", color.getTranslationKey()));
Tag<Block> tag = getForgeTag(prefix + color.getTranslationKey());
ITag.INamedTag<Block> tag = getForgeTag(prefix + color.getTranslationKey());
Block block = ForgeRegistries.BLOCKS.getValue(key);
if (block == null || block == Blocks.AIR)
throw new IllegalStateException("Unknown vanilla block: " + key.toString());
getBuilder(tag).add(block);
func_240522_a_(tag).func_240534_a_(block);
consumer.accept(block);
}
}
@SuppressWarnings("unchecked")
private Tag<Block> getForgeTag(String name)
private ITag.INamedTag<Block> getForgeTag(String name)
{
try
{
name = name.toUpperCase(Locale.ENGLISH);
return (Tag<Block>)Tags.Blocks.class.getDeclaredField(name).get(null);
return (ITag.INamedTag<Block>)Tags.Blocks.class.getDeclaredField(name).get(null);
}
catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e)
{
@@ -1,6 +1,6 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2019.
* func_240521_a_right (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
@@ -12,7 +12,7 @@
* 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
* You should have received a func_240521_a_ 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
*/
@@ -26,11 +26,13 @@ import java.util.function.Consumer;
import java.util.stream.Collectors;
import net.minecraft.block.Block;
import net.minecraft.data.BlockTagsProvider;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.ItemTagsProvider;
import net.minecraft.item.DyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.tags.ITag;
import net.minecraft.tags.Tag;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.Tags;
@@ -40,16 +42,16 @@ public class ForgeItemTagsProvider extends ItemTagsProvider
{
private Set<ResourceLocation> filter = null;
public ForgeItemTagsProvider(DataGenerator gen)
public ForgeItemTagsProvider(DataGenerator gen, BlockTagsProvider blockTagProvider)
{
super(gen);
super(gen, blockTagProvider);
}
@Override
public void registerTags()
{
super.registerTags();
filter = this.tagToBuilder.entrySet().stream().map(e -> e.getKey().getId()).collect(Collectors.toSet());
filter = this.tagToBuilder.entrySet().stream().map(e -> e.getKey()).collect(Collectors.toSet());
func_240522_a_(Tags.Items.ARROWS).func_240534_a_(Items.ARROW, Items.TIPPED_ARROW, Items.SPECTRAL_ARROW);
func_240522_a_(Tags.Items.BEACON_PAYMENT).func_240534_a_(Items.EMERALD, Items.DIAMOND, Items.GOLD_INGOT, Items.IRON_INGOT);
@@ -128,7 +130,6 @@ public class ForgeItemTagsProvider extends ItemTagsProvider
func_240522_a_(Tags.Items.SEEDS_MELON).func_240534_a_(Items.MELON_SEEDS);
func_240522_a_(Tags.Items.SEEDS_PUMPKIN).func_240534_a_(Items.PUMPKIN_SEEDS);
func_240522_a_(Tags.Items.SEEDS_WHEAT).func_240534_a_(Items.WHEAT_SEEDS);
func_240522_a_(Tags.Items.SHEARS).func_240534_a_(Items.SHEARS);
func_240522_a_(Tags.Items.SLIMEBALLS).func_240534_a_(Items.SLIME_BALL);
func_240521_a_(Tags.Blocks.STAINED_GLASS, Tags.Items.STAINED_GLASS);
func_240521_a_(Tags.Blocks.STAINED_GLASS_PANES, Tags.Items.STAINED_GLASS_PANES);
@@ -145,41 +146,41 @@ public class ForgeItemTagsProvider extends ItemTagsProvider
func_240522_a_(Tags.Items.STRING).func_240534_a_(Items.STRING);
}
private void addColored(Consumer<Tag<Item>> consumer, Tag<Item> group, String pattern)
private void addColored(Consumer<ITag.INamedTag<Item>> consumer, ITag.INamedTag<Item> group, String pattern)
{
String prefix = group.getId().getPath().toUpperCase(Locale.ENGLISH) + '_';
String prefix = group.func_230234_a_().getPath().toUpperCase(Locale.ENGLISH) + '_';
for (DyeColor color : DyeColor.values())
{
ResourceLocation key = new ResourceLocation("minecraft", pattern.replace("{color}", color.getTranslationKey()));
Tag<Item> tag = getForgeItemTag(prefix + color.getTranslationKey());
ITag.INamedTag<Item> tag = getForgeItemTag(prefix + color.getTranslationKey());
Item item = ForgeRegistries.ITEMS.getValue(key);
if (item == null || item == Items.AIR)
throw new IllegalStateException("Unknown vanilla item: " + key.toString());
getBuilder(tag).add(item);
func_240522_a_(tag).func_240534_a_(item);
consumer.accept(tag);
}
}
private void copyColored(Tag<Block> blockGroup, Tag<Item> itemGroup)
private void func_240521_a_Colored(ITag.INamedTag<Block> blockGroup, ITag.INamedTag<Item> itemGroup)
{
String blockPre = blockGroup.getId().getPath().toUpperCase(Locale.ENGLISH) + '_';
String itemPre = itemGroup.getId().getPath().toUpperCase(Locale.ENGLISH) + '_';
String blockPre = blockGroup.func_230234_a_().getPath().toUpperCase(Locale.ENGLISH) + '_';
String itemPre = itemGroup.func_230234_a_().getPath().toUpperCase(Locale.ENGLISH) + '_';
for (DyeColor color : DyeColor.values())
{
Tag<Block> from = getForgeBlockTag(blockPre + color.getTranslationKey());
Tag<Item> to = getForgeItemTag(itemPre + color.getTranslationKey());
copy(from, to);
ITag.INamedTag<Block> from = getForgeBlockTag(blockPre + color.getTranslationKey());
ITag.INamedTag<Item> to = getForgeItemTag(itemPre + color.getTranslationKey());
func_240521_a_(from, to);
}
copy(getForgeBlockTag(blockPre + "colorless"), getForgeItemTag(itemPre + "colorless"));
func_240521_a_(getForgeBlockTag(blockPre + "colorless"), getForgeItemTag(itemPre + "colorless"));
}
@SuppressWarnings("unchecked")
private Tag<Block> getForgeBlockTag(String name)
private ITag.INamedTag<Block> getForgeBlockTag(String name)
{
try
{
name = name.toUpperCase(Locale.ENGLISH);
return (Tag<Block>)Tags.Blocks.class.getDeclaredField(name).get(null);
return (ITag.INamedTag<Block>)Tags.Blocks.class.getDeclaredField(name).get(null);
}
catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e)
{
@@ -188,12 +189,12 @@ public class ForgeItemTagsProvider extends ItemTagsProvider
}
@SuppressWarnings("unchecked")
private Tag<Item> getForgeItemTag(String name)
private ITag.INamedTag<Item> getForgeItemTag(String name)
{
try
{
name = name.toUpperCase(Locale.ENGLISH);
return (Tag<Item>)Tags.Items.class.getDeclaredField(name).get(null);
return (ITag.INamedTag<Item>)Tags.Items.class.getDeclaredField(name).get(null);
}
catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e)
{
@@ -45,6 +45,7 @@ import net.minecraft.item.crafting.Ingredient;
import net.minecraft.item.crafting.Ingredient.IItemList;
import net.minecraft.item.crafting.Ingredient.TagList;
import net.minecraft.item.crafting.Ingredient.SingleItemList;
import net.minecraft.tags.ITag;
import net.minecraft.tags.Tag;
import net.minecraft.util.IItemProvider;
import net.minecraft.util.ResourceLocation;
@@ -52,7 +53,7 @@ import net.minecraftforge.common.Tags;
public class ForgeRecipeProvider extends RecipeProvider
{
private Map<Item, Tag<Item>> replacements = new HashMap<>();
private Map<Item, ITag<Item>> replacements = new HashMap<>();
private Set<ResourceLocation> excludes = new HashSet<>();
public ForgeRecipeProvider(DataGenerator generatorIn)
@@ -65,7 +66,7 @@ public class ForgeRecipeProvider extends RecipeProvider
excludes.add(item.asItem().getRegistryName());
}
private void replace(IItemProvider item, Tag<Item> tag)
private void replace(IItemProvider item, ITag<Item> tag)
{
replacements.put(item.asItem(), tag);
}
@@ -158,7 +159,7 @@ public class ForgeRecipeProvider extends RecipeProvider
if (entry instanceof SingleItemList)
{
ItemStack stack = entry.getStacks().stream().findFirst().orElse(ItemStack.EMPTY);
Tag<Item> replacement = replacements.get(stack.getItem());
ITag<Item> replacement = replacements.get(stack.getItem());
if (replacement != null)
{
items.add(new TagList(replacement));
@@ -17,11 +17,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common.data;
//package net.minecraftforge.common.data;
import net.minecraft.tags.Tag.ITagEntry;
//import net.minecraft.tags.Tag.ITagEntry;
/**
* Marker class used by Forge to make a tag entry optional at runtime
*/
public interface IOptionalTagEntry<T> extends ITagEntry<T> {}
//public interface IOptionalTagEntry<T> extends ITagEntry<T> {}
@@ -0,0 +1,76 @@
package net.minecraftforge.common.extensions;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.BlockState;
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
import net.minecraft.state.properties.RailShape;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import javax.annotation.Nullable;
public interface IAbstractRailBlock
{
default AbstractBlock getAbstractBlock()
{
return (AbstractBlock)this;
}
/**
* Return true if the rail can make corners.
* Used by placement logic.
* @param world The world.
* @param pos Block's position in world
* @return True if the rail can make corners.
*/
boolean isFlexibleRail(BlockState state, IBlockReader world, BlockPos pos);
/**
* Returns true if the rail can make up and down slopes.
* Used by placement logic.
* @param world The world.
* @param pos Block's position in world
* @return True if the rail can make slopes.
*/
default boolean canMakeSlopes(BlockState state, IBlockReader world, BlockPos pos)
{
return true;
}
/**
* Return the rail's direction.
* Can be used to make the cart think the rail is a different shape,
* for example when making diamond junctions or switches.
* The cart parameter will often be null unless it it called from EntityMinecart.
*
* @param world The world.
* @param pos Block's position in world
* @param state The BlockState
* @param cart The cart asking for the metadata, null if it is not called by EntityMinecart.
* @return The direction.
*/
RailShape getRailDirection(BlockState state, IBlockReader world, BlockPos pos, @Nullable AbstractMinecartEntity cart);
/**
* Returns the max speed of the rail at the specified position.
* @param world The world.
* @param cart The cart on the rail, may be null.
* @param pos Block's position in world
* @return The max speed of the current rail.
*/
default float getRailMaxSpeed(BlockState state, World world, BlockPos pos, net.minecraft.entity.item.minecart.AbstractMinecartEntity cart)
{
return 0.4f;
}
/**
* This function is called by any minecart that passes over this rail.
* It is called once per update tick that the minecart is on the rail.
* @param world The world.
* @param cart The cart on the rail.
* @param pos Block's position in world
*/
default void onMinecartPass(BlockState state, World world, BlockPos pos, net.minecraft.entity.item.minecart.AbstractMinecartEntity cart){}
}
@@ -26,18 +26,8 @@ import java.util.function.Predicate;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.block.BedBlock;
import net.minecraft.block.FarmlandBlock;
import net.minecraft.block.FenceGateBlock;
import net.minecraft.block.FireBlock;
import net.minecraft.block.HorizontalBlock;
import net.minecraft.block.IBeaconBeamColorProvider;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.SoundType;
import net.minecraft.block.StainedGlassBlock;
import net.minecraft.block.*;
import net.minecraft.block.material.Material;
import net.minecraft.block.BlockState;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.enchantment.EnchantmentHelper;
@@ -50,13 +40,12 @@ import net.minecraft.entity.boss.dragon.EnderDragonEntity;
import net.minecraft.entity.boss.WitherEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.WitherSkullEntity;
import net.minecraft.fluid.IFluidState;
import net.minecraft.block.Blocks;
import net.minecraft.fluid.FluidState;
import net.minecraft.potion.Effects;
import net.minecraft.item.DyeColor;
import net.minecraft.item.ItemStack;
import net.minecraft.pathfinding.PathNodeType;
import net.minecraft.state.IProperty;
import net.minecraft.state.Property;
import net.minecraft.state.properties.BedPart;
import net.minecraft.tags.BlockTags;
import net.minecraft.tileentity.TileEntity;
@@ -66,20 +55,14 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.IWorldWriter;
import net.minecraft.world.World;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.*;
import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.dimension.EndDimension;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.Tags;
import net.minecraftforge.common.ToolType;
@SuppressWarnings("deprecation")
@@ -212,7 +195,7 @@ public interface IForgeBlock
* @param fluid The current fluid state at current position
* @return True if the block is actually destroyed.
*/
default boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, IFluidState fluid)
default boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, FluidState fluid)
{
getBlock().onBlockHarvested(world, pos, state, player);
return world.setBlockState(pos, fluid.getBlockState(), world.isRemote ? 11 : 3);
@@ -259,7 +242,7 @@ public interface IForgeBlock
* @param sleeper The sleeper or camera entity, null in some cases.
* @return The spawn position
*/
default Optional<Vec3d> getBedSpawnPosition(EntityType<?> entityType, BlockState state, IWorldReader world, BlockPos pos, @Nullable LivingEntity sleeper)
default Optional<Vector3d> getBedSpawnPosition(EntityType<?> entityType, BlockState state, IWorldReader world, BlockPos pos, @Nullable LivingEntity sleeper)
{
if (world instanceof World)
{
@@ -347,7 +330,7 @@ public interface IForgeBlock
*/
default boolean canBeReplacedByLeaves(BlockState state, IWorldReader world, BlockPos pos)
{
return isAir(state, world, pos) || state.isIn(BlockTags.LEAVES);
return isAir(state, world, pos) || state.func_235714_a_(BlockTags.LEAVES);
}
/**
@@ -360,7 +343,7 @@ public interface IForgeBlock
*/
default boolean canBeReplacedByLogs(BlockState state, IWorldReader world, BlockPos pos)
{
return (isAir(state, world, pos) || state.isIn(BlockTags.LEAVES)) || this == Blocks.GRASS_BLOCK || state.isIn(net.minecraftforge.common.Tags.Blocks.DIRT)
return (isAir(state, world, pos) || state.func_235714_a_(BlockTags.LEAVES)) || this == Blocks.GRASS_BLOCK || state.func_235714_a_(Tags.Blocks.DIRT)
|| getBlock().isIn(BlockTags.LOGS) || getBlock().isIn(BlockTags.SAPLINGS) || this == Blocks.VINE;
}
@@ -536,7 +519,7 @@ public interface IForgeBlock
*/
default void onPlantGrow(BlockState state, IWorld world, BlockPos pos, BlockPos source)
{
if (state.isIn(net.minecraftforge.common.Tags.Blocks.DIRT))
if (state.func_235714_a_(Tags.Blocks.DIRT))
world.setBlockState(pos, Blocks.DIRT.getDefaultState(), 2);
}
@@ -632,7 +615,7 @@ public interface IForgeBlock
@Nullable
default Direction[] getValidRotations(BlockState state, IBlockReader world, BlockPos pos)
{
for (IProperty<?> prop : state.getProperties())
for (Property<?> prop : state.func_235904_r_())
{
if ((prop.getName().equals("facing") || prop.getName().equals("rotation")) && prop.getValueClass() == Direction.class)
{
@@ -668,14 +651,14 @@ public interface IForgeBlock
@SuppressWarnings("unchecked")
default boolean recolorBlock(BlockState state, IWorld world, BlockPos pos, Direction facing, DyeColor color)
{
for (IProperty<?> prop : state.getProperties())
for (Property<?> prop : state.func_235904_r_())
{
if (prop.getName().equals("color") && prop.getValueClass() == DyeColor.class)
{
DyeColor current = (DyeColor)state.get(prop);
if (current != color && prop.getAllowedValues().contains(color))
{
world.setBlockState(pos, state.with(((IProperty<DyeColor>)prop), color), 3);
world.setBlockState(pos, state.with(((Property<DyeColor>)prop), color), 3);
return true;
}
}
@@ -801,7 +784,7 @@ public interface IForgeBlock
* @return The new fog color.
*/
@OnlyIn(Dist.CLIENT)
default Vec3d getFogColor(BlockState state, IWorldReader world, BlockPos pos, Entity entity, Vec3d originalColor, float partialTicks)
default Vector3d getFogColor(BlockState state, IWorldReader world, BlockPos pos, Entity entity, Vector3d originalColor, float partialTicks)
{
if (state.getMaterial() == Material.WATER)
{
@@ -817,11 +800,11 @@ public interface IForgeBlock
f12 = f12 * 0.3F + 0.6F;
}
}
return new Vec3d(0.02F + f12, 0.02F + f12, 0.2F + f12);
return new Vector3d(0.02F + f12, 0.02F + f12, 0.2F + f12);
}
else if (state.getMaterial() == Material.LAVA)
{
return new Vec3d(0.6F, 0.1F, 0.0F);
return new Vector3d(0.6F, 0.1F, 0.0F);
}
return originalColor;
}
@@ -837,7 +820,7 @@ public interface IForgeBlock
* @param viewpoint the viewpoint
* @return the block state that should be 'seen'
*/
default BlockState getStateAtViewpoint(BlockState state, IBlockReader world, BlockPos pos, Vec3d viewpoint)
default BlockState getStateAtViewpoint(BlockState state, IBlockReader world, BlockPos pos, Vector3d viewpoint)
{
return state;
}
@@ -983,15 +966,9 @@ public interface IForgeBlock
* @param side The face that the fire is coming from
* @return True if this block sustains fire, meaning it will never go out.
*/
default boolean isFireSource(BlockState state, IBlockReader world, BlockPos pos, Direction side)
default boolean isFireSource(BlockState state, IWorldReader world, BlockPos pos, Direction side)
{
if (side != Direction.UP)
return false;
if (getBlock() == Blocks.NETHERRACK || getBlock() == Blocks.MAGMA_BLOCK)
return true;
if (world instanceof IWorldReader && ((IWorldReader)world).getDimension() instanceof EndDimension && getBlock() == Blocks.BEDROCK)
return true;
return false;
return state.func_235714_a_(world.func_230315_m_().func_241515_q_());
}
/**
@@ -1006,7 +983,7 @@ public interface IForgeBlock
{
if (entity instanceof EnderDragonEntity)
{
return !BlockTags.DRAGON_IMMUNE.contains(this.getBlock());
return !BlockTags.DRAGON_IMMUNE.func_230235_a_(this.getBlock());
}
else if ((entity instanceof WitherEntity) ||
(entity instanceof WitherSkullEntity))
@@ -1029,7 +1006,7 @@ public interface IForgeBlock
* @return A result that suits your block
*/
@Nullable
default RayTraceResult getRayTraceResult(BlockState state, World world, BlockPos pos, Vec3d start, Vec3d end, RayTraceResult original)
default RayTraceResult getRayTraceResult(BlockState state, World world, BlockPos pos, Vector3d start, Vector3d end, RayTraceResult original)
{
return original;
}
@@ -1081,8 +1058,8 @@ public interface IForgeBlock
* @param fluidState The state of the fluid
* @return Whether the fluid overlay texture should be used
*/
default boolean shouldDisplayFluidOverlay(BlockState state, ILightReader world, BlockPos pos, IFluidState fluidState)
default boolean shouldDisplayFluidOverlay(BlockState state, IBlockDisplayReader world, BlockPos pos, FluidState fluidState)
{
return state.getBlock() == Blocks.GLASS || state.getBlock() instanceof StainedGlassBlock;
return state.getBlock() instanceof BreakableBlock || state.getBlock() instanceof StainedGlassBlock;
}
}
@@ -26,14 +26,13 @@ import javax.annotation.Nullable;
import net.minecraft.block.*;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.entity.Entity;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.EntitySpawnPlacementRegistry.PlacementType;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.IFluidState;
import net.minecraft.fluid.FluidState;
import net.minecraft.item.DyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -42,13 +41,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.*;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -162,7 +156,7 @@ public interface IForgeBlockState
* @param fluid The current fluid and block state for the position in the world.
* @return True if the block is actually destroyed.
*/
default boolean removedByPlayer(World world, BlockPos pos, PlayerEntity player, boolean willHarvest, IFluidState fluid)
default boolean removedByPlayer(World world, BlockPos pos, PlayerEntity player, boolean willHarvest, FluidState fluid)
{
return getBlockState().getBlock().removedByPlayer(getBlockState(), world, pos, player, willHarvest, fluid);
}
@@ -204,7 +198,7 @@ public interface IForgeBlockState
* @param sleeper The sleeper or camera entity, null in some cases.
* @return The spawn position
*/
default Optional<Vec3d> getBedSpawnPosition(EntityType<?> type, IWorldReader world, BlockPos pos, @Nullable LivingEntity sleeper)
default Optional<Vector3d> getBedSpawnPosition(EntityType<?> type, IWorldReader world, BlockPos pos, @Nullable LivingEntity sleeper)
{
return getBlockState().getBlock().getBedSpawnPosition(type, getBlockState(), world, pos, sleeper);
}
@@ -673,7 +667,7 @@ public interface IForgeBlockState
* @return The new fog color.
*/
@OnlyIn(Dist.CLIENT)
default Vec3d getFogColor(IWorldReader world, BlockPos pos, Entity entity, Vec3d originalColor, float partialTicks)
default Vector3d getFogColor(IWorldReader world, BlockPos pos, Entity entity, Vector3d originalColor, float partialTicks)
{
return getBlockState().getBlock().getFogColor(getBlockState(), world, pos, entity, originalColor, partialTicks);
}
@@ -688,7 +682,7 @@ public interface IForgeBlockState
* @param viewpoint the viewpoint
* @return the block state that should be 'seen'
*/
default BlockState getStateAtViewpoint(IBlockReader world, BlockPos pos, Vec3d viewpoint)
default BlockState getStateAtViewpoint(IBlockReader world, BlockPos pos, Vector3d viewpoint)
{
return getBlockState().getBlock().getStateAtViewpoint(getBlockState(), world, pos, viewpoint);
}
@@ -816,7 +810,7 @@ public interface IForgeBlockState
* @param side The face that the fire is coming from
* @return True if this block sustains fire, meaning it will never go out.
*/
default boolean isFireSource(IBlockReader world, BlockPos pos, Direction side)
default boolean isFireSource(IWorldReader world, BlockPos pos, Direction side)
{
return getBlockState().getBlock().isFireSource(getBlockState(), world, pos, side);
}
@@ -920,7 +914,7 @@ public interface IForgeBlockState
* @param fluidState The state of the fluid
* @return Whether the fluid overlay texture should be used
*/
default boolean shouldDisplayFluidOverlay(ILightReader world, BlockPos pos, IFluidState fluidState)
default boolean shouldDisplayFluidOverlay(IBlockDisplayReader world, BlockPos pos, FluidState fluidState)
{
return getBlockState().getBlock().shouldDisplayFluidOverlay(getBlockState(), world, pos, fluidState);
}
@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common.extensions;
/*package net.minecraftforge.common.extensions;
import javax.annotation.Nullable;
@@ -59,7 +59,7 @@ public interface IForgeDimension
* always called before the world load event.
*
* @return initial holder for capabilities on the world
*/
* /
default net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities()
{
return null;
@@ -73,7 +73,7 @@ public interface IForgeDimension
* to nether multiplies coordinates by 1/8.
*
* @return The movement factor
*/
* /
default double getMovementFactor()
{
if (getDimension() instanceof NetherDimension)
@@ -115,7 +115,7 @@ public interface IForgeDimension
* @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();
@@ -134,7 +134,7 @@ public interface IForgeDimension
* 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()
@@ -148,7 +148,7 @@ public interface IForgeDimension
* @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;
@@ -170,7 +170,7 @@ public interface IForgeDimension
* 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)];
@@ -247,7 +247,7 @@ public interface IForgeDimension
* @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;
@@ -258,9 +258,9 @@ public interface IForgeDimension
*
* @param player The player that is respawning
* @return The dimension to respawn the player in
*/
* /
default DimensionType getRespawnDimension(ServerPlayerEntity player)
{
return player.getSpawnDimension();
}
}
}*/
@@ -22,6 +22,7 @@ package net.minecraftforge.common.extensions;
import java.util.ArrayList;
import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.DisplayEffectsScreen;
import net.minecraft.item.ItemStack;
@@ -64,25 +65,27 @@ public interface IForgeEffect {
*
* @param effect the active PotionEffect
* @param gui the gui instance
* @param mStack The MatrixStack
* @param x the x coordinate
* @param y the y coordinate
* @param z the z level
*/
@OnlyIn(Dist.CLIENT)
default void renderInventoryEffect(EffectInstance effect, DisplayEffectsScreen<?> gui, int x, int y, float z) { }
default void renderInventoryEffect(EffectInstance effect, DisplayEffectsScreen<?> gui, MatrixStack mStack, int x, int y, float z) { }
/**
* Called to draw the this Potion onto the player's ingame HUD when it's active.
* This can be used to e.g. render Potion icons from your own texture.
* @param effect the active PotionEffect
* @param gui the gui instance
* @param mStack The MatrixStack
* @param x the x coordinate
* @param y the y coordinate
* @param z the z level
* @param alpha the alpha value, blinks when the potion is about to run out
*/
@OnlyIn(Dist.CLIENT)
default void renderHUDEffect(EffectInstance effect, AbstractGui gui, int x, int y, float z, float alpha) { }
default void renderHUDEffect(EffectInstance effect, AbstractGui gui, MatrixStack mStack, int x, int y, float z, float alpha) { }
/**
* Get a fresh list of items that can cure this Potion.
@@ -21,6 +21,7 @@ package net.minecraftforge.common.extensions;
import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.DisplayEffectsScreen;
import net.minecraft.item.ItemStack;
@@ -66,13 +67,14 @@ public interface IForgeEffectInstance {
* This can be used to e.g. render Potion icons from your own texture.
*
* @param gui the gui instance
* @param mStack The MatrixStack
* @param x the x coordinate
* @param y the y coordinate
* @param z the z level
*/
@OnlyIn(Dist.CLIENT)
default void renderInventoryEffect(DisplayEffectsScreen<?> gui, int x, int y, float z) {
getEffectInstance().getPotion().renderInventoryEffect(getEffectInstance(), gui, x, y, z);
default void renderInventoryEffect(DisplayEffectsScreen<?> gui, MatrixStack mStack, int x, int y, float z) {
getEffectInstance().getPotion().renderInventoryEffect(getEffectInstance(), gui, mStack, x, y, z);
}
/**
@@ -80,14 +82,15 @@ public interface IForgeEffectInstance {
* This can be used to e.g. render Potion icons from your own texture.
*
* @param gui the gui instance
* @param mStack The MatrixStack
* @param x the x coordinate
* @param y the y coordinate
* @param z the z level
* @param alpha the alpha value, blinks when the potion is about to run out
*/
@OnlyIn(Dist.CLIENT)
default void renderHUDEffect(AbstractGui gui, int x, int y, float z, float alpha) {
getEffectInstance().getPotion().renderHUDEffect(getEffectInstance(), gui, x, y, z, alpha);
default void renderHUDEffect(AbstractGui gui, MatrixStack mStack, int x, int y, float z, float alpha) {
getEffectInstance().getPotion().renderHUDEffect(getEffectInstance(), gui, mStack, x, y, z, alpha);
}
/***
@@ -56,7 +56,7 @@ public interface IForgeEntityMinecart
int y = MathHelper.floor(getMinecart().getPosY());
int z = MathHelper.floor(getMinecart().getPosZ());
BlockPos pos = new BlockPos(x, y - 1, z);
if (getMinecart().world.getBlockState(pos).isIn(BlockTags.RAILS)) pos = pos.down();
if (getMinecart().world.getBlockState(pos).func_235714_a_(BlockTags.RAILS)) pos = pos.down();
return pos;
}
@@ -27,7 +27,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.entity.Entity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.IFluidState;
import net.minecraft.fluid.FluidState;
import net.minecraft.tags.Tag;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
@@ -54,7 +54,7 @@ public interface IForgeFluid
* @param tag Fluid category
* @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment.
*/
default boolean isEntityInside(IFluidState state, IWorldReader world, BlockPos pos, Entity entity, double yToTest, Tag<Fluid> tag, boolean testingHead)
default boolean isEntityInside(FluidState state, IWorldReader world, BlockPos pos, Entity entity, double yToTest, Tag<Fluid> tag, boolean testingHead)
{
return state.isTagged(tag) && yToTest < (double)(pos.getY() + state.getActualHeight(world, pos) + 0.11111111F);
}
@@ -70,7 +70,7 @@ public interface IForgeFluid
* @return null for default behavior, true if the box is within the material, false if it was not.
*/
@Nullable
default Boolean isAABBInsideMaterial(IFluidState state, IWorldReader world, BlockPos pos, AxisAlignedBB boundingBox, Material materialIn)
default Boolean isAABBInsideMaterial(FluidState state, IWorldReader world, BlockPos pos, AxisAlignedBB boundingBox, Material materialIn)
{
return null;
}
@@ -84,7 +84,7 @@ public interface IForgeFluid
* @return null for default behavior, true if the box is within the material, false if it was not.
*/
@Nullable
default Boolean isAABBInsideLiquid(IFluidState state, IWorldReader world, BlockPos pos, AxisAlignedBB boundingBox)
default Boolean isAABBInsideLiquid(FluidState state, IWorldReader world, BlockPos pos, AxisAlignedBB boundingBox)
{
return null;
}
@@ -98,7 +98,7 @@ public interface IForgeFluid
* @param explosion The explosion
* @return The amount of the explosion absorbed.
*/
default float getExplosionResistance(IFluidState state, IWorldReader world, BlockPos pos, @Nullable Entity exploder, Explosion explosion)
default float getExplosionResistance(FluidState state, IWorldReader world, BlockPos pos, @Nullable Entity exploder, Explosion explosion)
{
return state.getExplosionResistance();
}
@@ -24,7 +24,7 @@ import javax.annotation.Nullable;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.entity.Entity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.IFluidState;
import net.minecraft.fluid.FluidState;
import net.minecraft.tags.Tag;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
@@ -32,9 +32,9 @@ import net.minecraft.world.IWorldReader;
public interface IForgeFluidState
{
default IFluidState getFluidState()
default FluidState getFluidState()
{
return (IFluidState)this;
return (FluidState)this;
}
/**
@@ -45,7 +45,7 @@ public interface IForgeFluidState
* @param pos position thats being tested.
* @param entity that is being tested.
* @param yToTest, primarily for testingHead, which sends the the eye level of the entity, other wise it sends a y that can be tested vs liquid height.
* @param material to test for.
* @param tag to test for.
* @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment.
*/
default boolean isEntityInside(IWorldReader world, BlockPos pos, Entity entity, double yToTest, Tag<Fluid> tag, boolean testingHead)
@@ -33,6 +33,7 @@ import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.Attribute;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
@@ -48,6 +49,8 @@ import net.minecraft.util.ActionResultType;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.IFormattableTextComponent;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -68,7 +71,7 @@ public interface IForgeItem
* ItemStack sensitive version of getItemAttributeModifiers
*/
@SuppressWarnings("deprecation")
default Multimap<String, AttributeModifier> getAttributeModifiers(EquipmentSlotType slot, ItemStack stack)
default Multimap<Attribute, AttributeModifier> getAttributeModifiers(EquipmentSlotType slot, ItemStack stack)
{
return getItem().getAttributeModifiers(slot);
}
@@ -95,7 +98,7 @@ public interface IForgeItem
* @param displayName the name that will be displayed unless it is changed in
* this method.
*/
default String getHighlightTip(ItemStack item, String displayName)
default ITextComponent getHighlightTip(ItemStack item, ITextComponent displayName)
{
return displayName;
}
@@ -616,7 +619,7 @@ public interface IForgeItem
*/
default boolean isBeaconPayment(ItemStack stack)
{
return Tags.Items.BEACON_PAYMENT.contains(stack.getItem());
return Tags.Items.BEACON_PAYMENT.func_230235_a_(stack.getItem());
}
/**
@@ -703,12 +706,13 @@ public interface IForgeItem
return null;
}
default ImmutableMap<String, ITimeValue> getAnimationParameters(final ItemStack stack, final World world, final LivingEntity 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();
}
//TODO, properties dont exist anymore
// default ImmutableMap<String, ITimeValue> getAnimationParameters(final ItemStack stack, final World world, final LivingEntity 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();
// }
/**
* Can this Item disable a shield
@@ -39,6 +39,8 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.stats.Stats;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.IFormattableTextComponent;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
@@ -358,7 +360,7 @@ public interface IForgeItemStack extends ICapabilitySerializable<CompoundNBT>
* @param displayName the name that will be displayed unless it is changed in
* this method.
*/
default String getHighlightTip(String displayName)
default ITextComponent getHighlightTip(ITextComponent displayName)
{
return getStack().getItem().getHighlightTip(getStack(), displayName);
}
@@ -19,24 +19,25 @@
package net.minecraftforge.common.extensions;
import java.util.Arrays;
import java.util.Collection;
import java.util.Optional;
import java.util.function.Function;
import javax.annotation.Nonnull;
import com.google.gson.JsonArray;
import net.minecraft.tags.Tag;
import net.minecraft.tags.TagCollection;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.data.IOptionalTagEntry;
import net.minecraft.data.TagsProvider;
import net.minecraft.tags.ITag;
public interface IForgeTagBuilder<T>
{
default Tag.Builder<T> addOptional(final TagCollection<T> collection, final ResourceLocation... locations)
default TagsProvider.Builder<T> getBuilder() {
return (TagsProvider.Builder<T>) this;
}
default TagsProvider.Builder<T> addTags(ITag.INamedTag<T>... values) {
TagsProvider.Builder<T> builder = getBuilder();
for (ITag.INamedTag<T> value : values) {
builder.func_240531_a_(value);
}
return builder;
}
/*default Tag.Builder<T> addOptional(final TagCollection<T> collection, final ResourceLocation... locations)
{
return addOptional(collection, Arrays.asList(locations));
}
@@ -104,5 +105,5 @@ public interface IForgeTagBuilder<T>
};
return ((Tag.Builder<T>)this).add(new TagTarget<>(tag));
}
}*/
}
@@ -43,7 +43,14 @@ public interface IForgeTileEntity extends ICapabilitySerializable<CompoundNBT>
@Override
default void deserializeNBT(CompoundNBT nbt)
{
getTileEntity().read(nbt);
//TODO re-evaluate
deserializeNBT(null, nbt);
}
// @Override TODO re-evaluate
default void deserializeNBT(BlockState state, CompoundNBT nbt)
{
getTileEntity().func_230337_a_(state, nbt);
}
@Override
@@ -72,9 +79,9 @@ public interface IForgeTileEntity extends ICapabilitySerializable<CompoundNBT>
*
* @param tag The {@link NBTTagCompound} sent from {@link #getUpdateTag()}
*/
default void handleUpdateTag(CompoundNBT tag)
default void handleUpdateTag(BlockState state, CompoundNBT tag)
{
getTileEntity().read(tag);
getTileEntity().func_230337_a_(state, tag);
}
/**
@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common.extensions;
/*package net.minecraftforge.common.extensions;
import java.util.function.LongFunction;
@@ -50,7 +50,7 @@ public interface IForgeWorldType
/**
* Called when 'Create New World' button is pressed before starting game
*/
* /
default void onGUICreateWorldPress()
{
}
@@ -60,7 +60,7 @@ public interface IForgeWorldType
*
* @param mc The Minecraft instance
* @param gui the createworld GUI
*/
* /
@OnlyIn(Dist.CLIENT)
default void onCustomizeButton(Minecraft mc, CreateWorldScreen gui)
{
@@ -89,7 +89,7 @@ public interface IForgeWorldType
* Get the height to render the clouds for this world type
*
* @return The height to render clouds at
*/
* /
default float getCloudHeight()
{
return 128.0F;
@@ -115,7 +115,7 @@ public interface IForgeWorldType
* 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)
{
@@ -125,4 +125,4 @@ public interface IForgeWorldType
parentLayer = EdgeBiomeLayer.INSTANCE.apply(contextFactory.apply(1000L), parentLayer);
return parentLayer;
}
}
}*/
@@ -21,8 +21,8 @@ package net.minecraftforge.common.loot;
import com.google.gson.JsonObject;
import net.minecraft.loot.conditions.ILootCondition;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.conditions.ILootCondition;
import net.minecraftforge.registries.GameData;
import net.minecraftforge.registries.IForgeRegistryEntry;
@@ -24,7 +24,7 @@ import java.util.List;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import net.minecraft.world.storage.loot.LootContext;
import net.minecraft.loot.LootContext;
/**
* Implementation that defines what a global loot modifier must implement in order to be functional.
@@ -25,9 +25,9 @@ import java.util.function.Predicate;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import net.minecraft.world.storage.loot.LootContext;
import net.minecraft.world.storage.loot.conditions.ILootCondition;
import net.minecraft.world.storage.loot.conditions.LootConditionManager;
import net.minecraft.loot.LootContext;
import net.minecraft.loot.conditions.ILootCondition;
import net.minecraft.loot.conditions.LootConditionManager;
/**
* A base implementation of a Global Loot Modifier for modders to extend.
@@ -30,6 +30,10 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
import net.minecraft.loot.conditions.ILootCondition;
import net.minecraft.loot.conditions.LootConditionManager;
import net.minecraft.loot.functions.ILootFunction;
import net.minecraft.loot.functions.LootFunctionManager;
import org.apache.commons.io.IOUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -48,15 +52,11 @@ import net.minecraft.resources.IResource;
import net.minecraft.resources.IResourceManager;
import net.minecraft.util.JSONUtils;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.conditions.ILootCondition;
import net.minecraft.world.storage.loot.conditions.LootConditionManager;
import net.minecraft.world.storage.loot.functions.ILootFunction;
import net.minecraft.world.storage.loot.functions.LootFunctionManager;
import net.minecraftforge.registries.ForgeRegistries;
public class LootModifierManager extends JsonReloadListener {
public static final Logger LOGGER = LogManager.getLogger();
private static final Gson GSON_INSTANCE = (new GsonBuilder()).registerTypeHierarchyAdapter(ILootFunction.class, new LootFunctionManager.Serializer()).registerTypeHierarchyAdapter(ILootCondition.class, new LootConditionManager.Serializer()).create();
private static final Gson GSON_INSTANCE = (new GsonBuilder()).registerTypeHierarchyAdapter(ILootFunction.class, LootFunctionManager.func_237450_a_()).registerTypeHierarchyAdapter(ILootCondition.class, LootConditionManager.func_237474_a_()).create();
private Map<ResourceLocation, IGlobalLootModifier> registeredLootModifiers = ImmutableMap.of();
private static final String folder = "loot_modifiers";
@@ -66,7 +66,7 @@ public class LootModifierManager extends JsonReloadListener {
}
@Override
protected void apply(Map<ResourceLocation, JsonObject> resourceList, IResourceManager resourceManagerIn, IProfiler profilerIn) {
protected void apply(Map<ResourceLocation, JsonElement> resourceList, IResourceManager resourceManagerIn, IProfiler profilerIn) {
Builder<ResourceLocation, IGlobalLootModifier> builder = ImmutableMap.builder();
//old way (for reference)
/*Map<IGlobalLootModifier, ResourceLocation> toLocation = new HashMap<IGlobalLootModifier, ResourceLocation>();
@@ -116,7 +116,8 @@ public class LootModifierManager extends JsonReloadListener {
finalLocations.forEach(location -> {
try {
IGlobalLootModifier modifier = deserializeModifier(location, resourceList.get(location));
builder.put(location, modifier);
if(modifier != null)
builder.put(location, modifier);
} catch (Exception exception) {
LOGGER.error("Couldn't parse loot modifier {}", location, exception);
}
@@ -125,7 +126,9 @@ public class LootModifierManager extends JsonReloadListener {
this.registeredLootModifiers = immutablemap;
}
private IGlobalLootModifier deserializeModifier(ResourceLocation location, JsonObject object) {
private IGlobalLootModifier deserializeModifier(ResourceLocation location, JsonElement element) {
if (!element.isJsonObject()) return null;
JsonObject object = element.getAsJsonObject();
ILootCondition[] lootConditions = GSON_INSTANCE.fromJson(object.get("conditions"), ILootCondition[].class);
// For backward compatibility with the initial implementation, fall back to using the location as the type.
@@ -23,10 +23,10 @@ import java.lang.reflect.Type;
import java.util.Map;
import com.google.gson.*;
import net.minecraft.client.renderer.*;
import net.minecraft.util.math.MathHelper;
import net.minecraft.client.renderer.model.ItemTransformVec3f;
import net.minecraft.util.math.vector.*;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -21,7 +21,7 @@ package net.minecraftforge.common.model.animation;
import java.io.IOException;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.client.renderer.model.IModelTransform;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraft.client.renderer.model.ModelResourceLocation;
@@ -61,7 +61,7 @@ import javax.annotation.Nullable;
public final class Clips
{
private static final Logger LOGGER = LogManager.getLogger();
/**
* Clip that does nothing.
*/
@@ -82,7 +82,7 @@ public final class Clips
}
@Override
public String getName()
public String func_176610_l()
{
return "identity";
}
@@ -416,7 +416,7 @@ public final class Clips
}
@Override
public String getName()
public String func_176610_l()
{
return clipName;
}
@@ -475,7 +475,7 @@ public final class Clips
// IdentityClip + ClipReference
if(clip instanceof IStringSerializable)
{
out.value("#" + ((IStringSerializable)clip).getName());
out.value("#" + ((IStringSerializable)clip).func_176610_l());
return;
}
else if(clip instanceof TimeClip)
@@ -19,9 +19,9 @@
package net.minecraftforge.common.model.animation;
import java.util.Optional;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.client.renderer.TransformationMatrix;
import java.util.Optional;
/**
* Model part that's a part of the hierarchical skeleton.
@@ -19,7 +19,7 @@
package net.minecraftforge.common.model.animation;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.util.math.vector.TransformationMatrix;
/**
* Returns Local joint pose; animation clip for specific model part.
@@ -19,7 +19,7 @@
package net.minecraftforge.common.model.animation;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.util.math.vector.TransformationMatrix;
/**
* Various implementations of IJointClip.
@@ -20,11 +20,11 @@
package net.minecraftforge.common.ticket;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import javax.annotation.Nonnull;
public class AABBTicket extends SimpleTicket<Vec3d>
public class AABBTicket extends SimpleTicket<Vector3d>
{
@Nonnull
public final AxisAlignedBB axisAlignedBB;
@@ -35,7 +35,7 @@ public class AABBTicket extends SimpleTicket<Vec3d>
}
@Override
public boolean matches(Vec3d toMatch)
public boolean matches(Vector3d toMatch)
{
return this.axisAlignedBB.contains(toMatch);
}
@@ -29,7 +29,6 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.fml.server.ServerLifecycleHooks;
import net.minecraftforge.registries.ForgeRegistries;
@@ -66,7 +65,7 @@ public class BlockSnapshot
public BlockSnapshot(IWorld world, BlockPos pos, BlockState state, @Nullable CompoundNBT nbt)
{
this.setWorld(world);
this.dimId = world.getDimension().getType().getId();
this.dimId = 0; //world.getDimension().getType().getId(); //TODO
this.pos = pos.toImmutable();
this.setReplacedBlock(state);
this.registryName = state.getBlock().getRegistryName();
@@ -74,7 +73,7 @@ public class BlockSnapshot
this.nbt = nbt;
if (DEBUG)
{
System.out.printf("Created BlockSnapshot - [World: %s ][Location: %d,%d,%d ][Block: %s ][Meta: %d ]", world.getWorldInfo().getWorldName(), pos.getX(), pos.getY(), pos.getZ(), getRegistryName(), getMeta());
System.out.printf("Created BlockSnapshot - [World: %s ][Location: %d,%d,%d ][Block: %s ][Meta: %d ]", world.getWorldInfo()/*TODO .getWorldName()*/, pos.getX(), pos.getY(), pos.getZ(), getRegistryName(), getMeta());
}
}
@@ -136,7 +135,8 @@ public class BlockSnapshot
IWorld world = this.world != null ? this.world.get() : null;
if (world == null)
{
world = ServerLifecycleHooks.getCurrentServer().getWorld(DimensionType.getById(getDimId()));
//TODO
//world = ServerLifecycleHooks.getCurrentServer().getWorld(DimensionType.getById(getDimId()));
this.world = new WeakReference<IWorld>(world);
}
return world;
@@ -154,7 +154,7 @@ public class BlockSnapshot
@Nullable
public TileEntity getTileEntity()
{
return getNbt() != null ? TileEntity.create(getNbt()) : null;
return getNbt() != null ? TileEntity.func_235657_b_(getReplacedBlock(), getNbt()) : null;
}
public boolean restore()
@@ -201,14 +201,14 @@ public class BlockSnapshot
te = world.getTileEntity(pos);
if (te != null)
{
te.read(getNbt());
te.func_230337_a_(getReplacedBlock(), getNbt());
te.markDirty();
}
}
if (DEBUG)
{
System.out.printf("Restored BlockSnapshot with data [World: %s ][Location: %d,%d,%d ][State: %s ][Block: %s ][TileEntity: %s ][force: %s ][notifyNeighbors: %s]", world.getWorldInfo().getWorldName(), pos.getX(), pos.getY(), pos.getZ(), replaced, replaced.getBlock().delegate.name(), te, force, notifyNeighbors);
System.out.printf("Restored BlockSnapshot with data [World: %s ][Location: %d,%d,%d ][State: %s ][Block: %s ][TileEntity: %s ][force: %s ][notifyNeighbors: %s]", world.getWorldInfo()/*TODO .getWorldName()*/, pos.getX(), pos.getY(), pos.getZ(), replaced, replaced.getBlock().delegate.name(), te, force, notifyNeighbors);
}
return true;
}
@@ -31,12 +31,14 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.server.management.PlayerInteractionManager;
import net.minecraft.stats.Stat;
import net.minecraft.util.DamageSource;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.fml.server.ServerLifecycleHooks;
import java.util.UUID;
//Preliminary, simple Fake Player class
public class FakePlayer extends ServerPlayerEntity
{
@@ -45,9 +47,10 @@ public class FakePlayer extends ServerPlayerEntity
super(world.getServer(), world, name, new PlayerInteractionManager(world));
}
@Override public Vec3d getPositionVector(){ return new Vec3d(0, 0, 0); }
@Override public Vector3d getPositionVec(){ return new Vector3d(0, 0, 0); }
@Override public BlockPos func_233580_cy_(){ return BlockPos.ZERO; }
@Override public void sendStatusMessage(ITextComponent chatComponent, boolean actionBar){}
@Override public void sendMessage(ITextComponent component) {}
@Override public void sendMessage(ITextComponent component, UUID p_145747_2_) {}
@Override public void addStat(Stat par1StatBase, int par2){}
//@Override public void openGui(Object mod, int modGuiId, World world, int x, int y, int z){}
@Override public boolean isInvulnerableTo(DamageSource source){ return true; }
@@ -24,7 +24,6 @@ import java.util.function.Function;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.world.dimension.Dimension;
import net.minecraft.world.server.ServerWorld;
/**
@@ -21,35 +21,36 @@ package net.minecraftforge.common.util;
import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.function.IntSupplier;
import java.util.function.Supplier;
import net.minecraft.tags.ITag;
import net.minecraft.tags.TagCollection;
import net.minecraft.util.ResourceLocation;
public class ReverseTagWrapper<T>
{
private final T target;
private final IntSupplier genSupplier;
private final Supplier<TagCollection<T>> colSupplier;
private int generation = -1;
//This map is immutable we track its identity change.
private Map<ResourceLocation, ITag<T>> colCache;
private Set<ResourceLocation> cache = null;
public ReverseTagWrapper(T target, IntSupplier genSupplier, Supplier<TagCollection<T>> colSupplier)
public ReverseTagWrapper(T target, Supplier<TagCollection<T>> colSupplier)
{
this.target = target;
this.genSupplier = genSupplier;
this.colSupplier = colSupplier;
}
public Set<ResourceLocation> getTagNames()
{
if (cache == null || generation != genSupplier.getAsInt())
TagCollection<T> collection = colSupplier.get();
if (cache == null || colCache != collection.getTagMap()) // Identity equals.
{
this.cache = Collections.unmodifiableSet(new HashSet<>(colSupplier.get().getOwningTags(target)));
this.generation = genSupplier.getAsInt();
this.cache = Collections.unmodifiableSet(new HashSet<>(collection.getOwningTags(target)));
this.colCache = collection.getTagMap();
}
return this.cache;
}
@@ -22,7 +22,6 @@ package net.minecraftforge.common.util;
import javax.annotation.Nullable;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.world.dimension.Dimension;
import net.minecraft.world.storage.WorldSavedData;
public class WorldCapabilityData extends WorldSavedData
@@ -68,7 +67,7 @@ public class WorldCapabilityData extends WorldSavedData
return true;
}
public void setCapabilities(Dimension provider, INBTSerializable<CompoundNBT> capabilities)
public void setCapabilities(INBTSerializable<CompoundNBT> capabilities)
{
this.serializable = capabilities;
if (this.capNBT != null && serializable != null)