func_217304_m() {
- return StreamSupport.stream(BlockPos.func_191531_b(this.field_212816_F.func_180334_c(), 0, this.field_212816_F.func_180333_d(), this.field_212816_F.func_180332_e(), 255, this.field_212816_F.func_180330_f()).spliterator(), false).filter((p_217312_1_) -> {
-- return this.func_180495_p(p_217312_1_).func_185906_d() != 0;
-+ return this.func_180495_p(p_217312_1_).getLightValue(func_177412_p(), p_217312_1_) != 0;
- });
- }
-
-@@ -699,9 +714,9 @@
- private TileEntity func_212815_a(BlockPos p_212815_1_, CompoundNBT p_212815_2_) {
- TileEntity tileentity;
- if ("DUMMY".equals(p_212815_2_.func_74779_i("id"))) {
-- Block block = this.func_180495_p(p_212815_1_).func_177230_c();
-- if (block instanceof ITileEntityProvider) {
-- tileentity = ((ITileEntityProvider)block).func_196283_a_(this.field_76637_e);
-+ BlockState state = this.func_180495_p(p_212815_1_);
-+ if (state.hasTileEntity()) {
-+ tileentity = state.createTileEntity(this.field_76637_e);
- } else {
- tileentity = null;
- field_150817_t.warn("Tried to load a DUMMY block entity @ {} but found not block entity block {} at location", p_212815_1_, this.func_180495_p(p_212815_1_));
-@@ -790,4 +805,30 @@
- QUEUED,
- CHECK;
- }
-+
-+ /**
-+ * FOR INTERNAL USE ONLY
-+ *
-+ * Only public for use in {@link AnvilChunkLoader}.
-+ */
-+ @java.lang.Deprecated
-+ @javax.annotation.Nullable
-+ public final CompoundNBT writeCapsToNBT() {
-+ return this.serializeCaps();
-+ }
-+
-+ /**
-+ * FOR INTERNAL USE ONLY
-+ *
-+ * Only public for use in {@link AnvilChunkLoader}.
-+ */
-+ @java.lang.Deprecated
-+ public final void readCapsFromNBT(CompoundNBT tag) {
-+ this.deserializeCaps(tag);
-+ }
-+
-+ @Override
-+ public World getWorldForge() {
-+ return func_177412_p();
-+ }
- }
diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModAnnotation.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModAnnotation.java
index 351da16fd..9eee8380b 100644
--- a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModAnnotation.java
+++ b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModAnnotation.java
@@ -70,12 +70,6 @@ public class ModAnnotation
this.asmType = asmType;
this.member = member;
}
-
- @Deprecated // TODO 1.16 remove this
- public ModAnnotation(ElementType type, Type asmType, ModAnnotation parent)
- {
- this(asmType, parent);
- }
public ModAnnotation(Type asmType, ModAnnotation parent)
{
diff --git a/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java b/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java
index c865a688f..37175324e 100644
--- a/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java
+++ b/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java
@@ -225,72 +225,6 @@ public class GuiScreenEvent extends Event
}
}
- @Deprecated // Remove in 1.16
- public static class ActionPerformedEvent extends GuiScreenEvent
- {
- private Button button;
- private List buttonList;
-
- public ActionPerformedEvent(Screen gui, Button button, List buttonList)
- {
- super(gui);
- this.setButton(button);
- this.setButtonList(new ArrayList(buttonList));
- }
-
- /**
- * The button that was clicked.
- */
- public Button getButton()
- {
- return button;
- }
-
- public void setButton(Button button)
- {
- this.button = button;
- }
-
- /**
- * A COPY of the {@link #buttonList} field from the GuiScreen referenced by {@link #gui}.
- */
- public List getButtonList()
- {
- return buttonList;
- }
-
- public void setButtonList(List buttonList)
- {
- this.buttonList = buttonList;
- }
-
- /**
- * This event fires once it has been determined that a GuiButton object has been clicked.
- * Cancel this event to bypass {@link GuiScreen#actionPerformed(GuiButton)}.
- * Replace button with a different button from buttonList to have that button's action executed.
- */
- @Cancelable
- public static class Pre extends ActionPerformedEvent
- {
- public Pre(Screen gui, Button button, List buttonList)
- {
- super(gui, button, buttonList);
- }
- }
-
- /**
- * This event fires after {@link GuiScreen#actionPerformed(GuiButton)} provided that the active
- * screen has not been changed as a result of {@link GuiScreen#actionPerformed(GuiButton)}.
- */
- public static class Post extends ActionPerformedEvent
- {
- public Post(Screen gui, Button button, List buttonList)
- {
- super(gui, button, buttonList);
- }
- }
- }
-
public static abstract class MouseInputEvent extends GuiScreenEvent
{
private final double mouseX;
diff --git a/src/main/java/net/minecraftforge/client/settings/KeyModifier.java b/src/main/java/net/minecraftforge/client/settings/KeyModifier.java
index e188e4ca9..c30492614 100644
--- a/src/main/java/net/minecraftforge/client/settings/KeyModifier.java
+++ b/src/main/java/net/minecraftforge/client/settings/KeyModifier.java
@@ -28,6 +28,8 @@ import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.InputMappings;
+import net.minecraft.util.text.ITextComponent;
+import net.minecraft.util.text.TranslationTextComponent;
import org.lwjgl.glfw.GLFW;
public enum KeyModifier {
@@ -53,11 +55,10 @@ public enum KeyModifier {
}
@Override
- public String getLocalizedComboName(InputMappings.Input key, Supplier defaultLogic)
+ public ITextComponent getCombinedName(InputMappings.Input key, Supplier defaultLogic)
{
- String keyName = defaultLogic.get();
String localizationFormatKey = Minecraft.IS_RUNNING_ON_MAC ? "forge.controlsgui.control.mac" : "forge.controlsgui.control";
- return I18n.format(localizationFormatKey, keyName);
+ return new TranslationTextComponent(localizationFormatKey).func_240702_b_(" + ").func_230529_a_(defaultLogic.get());
}
},
SHIFT {
@@ -74,9 +75,9 @@ public enum KeyModifier {
}
@Override
- public String getLocalizedComboName(InputMappings.Input key, Supplier defaultLogic)
+ public ITextComponent getCombinedName(InputMappings.Input key, Supplier defaultLogic)
{
- return I18n.format("forge.controlsgui.shift", defaultLogic.get());
+ return new TranslationTextComponent("forge.controlsgui.shift").func_240702_b_(" + ").func_230529_a_(defaultLogic.get());
}
},
ALT {
@@ -93,9 +94,9 @@ public enum KeyModifier {
}
@Override
- public String getLocalizedComboName(InputMappings.Input keyCode, Supplier defaultLogic)
+ public ITextComponent getCombinedName(InputMappings.Input keyCode, Supplier defaultLogic)
{
- return I18n.format("forge.controlsgui.alt", defaultLogic.get());
+ return new TranslationTextComponent("forge.controlsgui.alt").func_240702_b_(" + ").func_230529_a_(defaultLogic.get());
}
},
NONE {
@@ -122,7 +123,7 @@ public enum KeyModifier {
}
@Override
- public String getLocalizedComboName(InputMappings.Input key, Supplier defaultLogic)
+ public ITextComponent getCombinedName(InputMappings.Input key, Supplier defaultLogic)
{
return defaultLogic.get();
}
@@ -170,5 +171,5 @@ public enum KeyModifier {
public abstract boolean isActive(@Nullable IKeyConflictContext conflictContext);
- public abstract String getLocalizedComboName(InputMappings.Input key, Supplier defaultLogic);
+ public abstract ITextComponent getCombinedName(InputMappings.Input key, Supplier defaultLogic);
}
diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java
index 8613575e3..1ccc7ada8 100644
--- a/src/main/java/net/minecraftforge/common/ForgeHooks.java
+++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java
@@ -29,8 +29,9 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
+import java.util.Objects;
import java.util.Set;
+import java.util.function.Consumer;
import java.util.function.Function;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -39,6 +40,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Queues;
import com.google.common.collect.Sets;
import com.google.gson.Gson;
+import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
@@ -50,6 +52,7 @@ import net.minecraft.fluid.*;
import net.minecraft.loot.LootContext;
import net.minecraft.loot.LootTable;
import net.minecraft.loot.LootTableManager;
+import net.minecraft.tags.ITag;
import net.minecraft.util.*;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft;
@@ -87,7 +90,6 @@ import net.minecraft.network.play.server.SChangeBlockPacket;
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;
@@ -106,8 +108,7 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
-import net.minecraftforge.common.loot.IGlobalLootModifier;
-import net.minecraftforge.common.loot.LootModifierManager;
+import net.minecraftforge.common.data.IOptionalTagEntry;
import net.minecraftforge.common.util.BlockSnapshot;
import net.minecraftforge.event.AnvilUpdateEvent;
import net.minecraftforge.event.DifficultyChangeEvent;
@@ -1074,9 +1075,7 @@ public class ForgeHooks
return res == Result.DEFAULT ? 0 : res == Result.DENY ? -1 : 1;
}
- /*
- @SuppressWarnings("deprecation")
- public static void deserializeTagAdditions(Tag.Builder builder, Function> valueGetter, JsonObject json)
+ public static void deserializeTagAdditions(List list, JsonObject json, List allList)
{
if (json.has("optional"))
{
@@ -1084,9 +1083,9 @@ public class ForgeHooks
{
String s = JSONUtils.getString(entry, "value");
if (!s.startsWith("#"))
- builder.addOptional(valueGetter, Collections.singleton(new ResourceLocation(s)));
+ list.add(ForgeHooks.makeOptionalTag(true, Collections.singleton(new ResourceLocation(s))));
else
- builder.addOptionalTag(new ResourceLocation(s.substring(1)));
+ list.add(ForgeHooks.makeOptionalTag(false, Collections.singleton(new ResourceLocation(s.substring(1)))));
}
}
@@ -1095,23 +1094,15 @@ public class ForgeHooks
for (JsonElement entry : JSONUtils.getJsonArray(json, "remove"))
{
String s = JSONUtils.getString(entry, "value");
+ ITag.ITagEntry dummy;
if (!s.startsWith("#"))
- {
- T value = valueGetter.apply(new ResourceLocation(s)).orElse(null);
- if (value != null)
- {
- Tag.ITagEntry dummyEntry = new Tag.ListEntry<>(Collections.singleton(value));
- builder.remove(dummyEntry);
- }
- } else
- {
- Tag.ITagEntry dummyEntry = new Tag.TagEntry<>(new ResourceLocation(s.substring(1)));
- builder.remove(dummyEntry);
- }
+ dummy = new ITag.ItemEntry(new ResourceLocation(s));
+ else
+ dummy = new ITag.TagEntry(new ResourceLocation(s.substring(1)));
+ allList.removeIf(e -> e.func_232968_a_().equals(dummy));
}
}
}
- */
private static final Map, DataSerializerEntry> serializerEntries = GameData.getSerializerMap();
//private static final ForgeRegistry serializerRegistry = (ForgeRegistry) ForgeRegistries.DATA_SERIALIZERS;
@@ -1189,4 +1180,61 @@ public class ForgeHooks
return list;
}
+ @Deprecated//INTERNAL
+ public static IOptionalTagEntry makeOptionalTag(boolean items, Collection locations) {
+ return items ? new OptionalItemTarget(locations) : new OptionalTagTarget(locations);
+ }
+
+ private static class OptionalTagTarget implements IOptionalTagEntry
+ {
+
+ private final Collection referents;
+
+ public OptionalTagTarget(Collection referents)
+ {
+ this.referents = referents;
+ }
+
+ @Override
+ public boolean func_230238_a_(Function> tagLookup, Function itemLookup, Consumer collector)
+ {
+ referents.stream()
+ .map(tagLookup)
+ .filter(Objects::nonNull)
+ .map(ITag::func_230236_b_)
+ .flatMap(List::stream)
+ .forEach(collector);
+ return true;
+ }
+
+ @Override
+ public void func_230237_a_(JsonArray array)
+ {
+ referents.stream().map(e -> "#" + e).forEach(array::add);
+ }
+ }
+
+ private static class OptionalItemTarget implements IOptionalTagEntry
+ {
+
+ private final Collection locations;
+
+ public OptionalItemTarget(Collection locations)
+ {
+ this.locations = locations;
+ }
+
+ @Override
+ public