mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 19:59:42 +00:00
Update to 1.17
Update to Official classnames Patchwork Make the game compile and run Merge in the new HUD overlay API Merge in the new render properties API PEEL Use Gradle 7.2 snapshot to fix eclipse integration bug in 7.1, Would use 7.0 but FG needs 7.1 for some reason. New FML installer Update to 1.17.1 Co-authored-by: LexManos <[email protected]> Co-authored-by: SizableShrimp <[email protected]> Co-authored-by: cpw <[email protected]> Co-authored-by: Curle <[email protected]> Co-authored-by: Unnoen <[email protected]> Co-authored-by: covers1624 <[email protected]> Co-authored-by: DaemonUmbra <[email protected]> Co-authored-by: gigaherz <[email protected]> Signed-off-by: SizableShrimp <[email protected]>
This commit is contained in:
1 parent
064ae6961b
commit
be5446b91c
1990 files changed
+35661
-37544
No files matched your search
@@ -21,9 +21,9 @@ package net.minecraftforge.debug.chat;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.ParsedCommandNode;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.commands.CommandRuntimeException;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraftforge.event.CommandEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
@@ -41,9 +41,9 @@ public class CommandEventTest
|
||||
@SubscribeEvent
|
||||
public static void onCommand(CommandEvent event)
|
||||
{
|
||||
CommandDispatcher<CommandSource> dispatcher = event.getParseResults().getContext().getDispatcher();
|
||||
List<ParsedCommandNode<CommandSource>> nodes = event.getParseResults().getContext().getNodes();
|
||||
CommandSource source = event.getParseResults().getContext().getSource();
|
||||
CommandDispatcher<CommandSourceStack> dispatcher = event.getParseResults().getContext().getDispatcher();
|
||||
List<ParsedCommandNode<CommandSourceStack>> nodes = event.getParseResults().getContext().getNodes();
|
||||
CommandSourceStack source = event.getParseResults().getContext().getSource();
|
||||
|
||||
// test: when the /time command is used with no arguments, automatically add default arguments (/time set day)
|
||||
if (nodes.size() == 1 && nodes.get(0).getNode() == dispatcher.getRoot().getChild("time"))
|
||||
@@ -56,17 +56,18 @@ public class CommandEventTest
|
||||
if (nodes.size() > 0 && nodes.get(0).getNode() == dispatcher.getRoot().getChild("give"))
|
||||
{
|
||||
String msg = source.getTextName() + " used the give command: " + event.getParseResults().getReader().getString();
|
||||
source.getServer().getPlayerList().getPlayers().forEach(player -> player.sendMessage(new StringTextComponent(msg), player.getUUID()));
|
||||
source.getServer().getPlayerList().getPlayers().forEach(player -> player.sendMessage(new TextComponent(msg), player.getUUID()));
|
||||
return;
|
||||
}
|
||||
|
||||
// this is annoying so I disabled it
|
||||
// test: when the /kill command is used with no arguments, throw a custom exception
|
||||
if (nodes.size() == 1 && nodes.get(0).getNode() == dispatcher.getRoot().getChild("kill"))
|
||||
{
|
||||
event.setException(new CommandException(new StringTextComponent("You tried to use the /kill command with no arguments")));
|
||||
event.setCanceled(true);
|
||||
return;
|
||||
}
|
||||
// if (nodes.size() == 1 && nodes.get(0).getNode() == dispatcher.getRoot().getChild("kill"))
|
||||
// {
|
||||
// event.setException(new CommandRuntimeException(new TextComponent("You tried to use the /kill command with no arguments")));
|
||||
// event.setCanceled(true);
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,14 +20,14 @@
|
||||
package net.minecraftforge.debug.chat;
|
||||
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import net.minecraft.advancements.criterion.MinMaxBounds;
|
||||
import net.minecraft.command.arguments.EntityOptions;
|
||||
import net.minecraft.command.arguments.EntitySelector;
|
||||
import net.minecraft.command.arguments.EntitySelectorParser;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.advancements.critereon.MinMaxBounds;
|
||||
import net.minecraft.commands.arguments.selector.options.EntitySelectorOptions;
|
||||
import net.minecraft.commands.arguments.selector.EntitySelector;
|
||||
import net.minecraft.commands.arguments.selector.EntitySelectorParser;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraftforge.common.command.EntitySelectorManager;
|
||||
import net.minecraftforge.common.command.IEntitySelectorType;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
@@ -44,7 +44,7 @@ public class EntitySelectorTest
|
||||
|
||||
public void setup(FMLCommonSetupEvent event)
|
||||
{
|
||||
EntityOptions.register("health", this::healthArgument, parser -> true, new StringTextComponent("Selects entities based on their current health."));
|
||||
EntitySelectorOptions.register("health", this::healthArgument, parser -> true, new TextComponent("Selects entities based on their current health."));
|
||||
EntitySelectorManager.register("er", new ExampleCustomSelector());
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class EntitySelectorTest
|
||||
*/
|
||||
private void healthArgument(EntitySelectorParser parser) throws CommandSyntaxException
|
||||
{
|
||||
MinMaxBounds.FloatBound bound = MinMaxBounds.FloatBound.fromReader(parser.getReader());
|
||||
MinMaxBounds.Doubles bound = MinMaxBounds.Doubles.fromReader(parser.getReader());
|
||||
parser.addPredicate(entity -> entity instanceof LivingEntity && bound.matches(((LivingEntity) entity).getHealth()));
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class EntitySelectorTest
|
||||
parser.getReader().skip();
|
||||
parser.setSuggestions((builder, consumer) -> {
|
||||
builder.suggest(String.valueOf(']'));
|
||||
EntityOptions.suggestNames(parser, builder);
|
||||
EntitySelectorOptions.suggestNames(parser, builder);
|
||||
return builder.buildFuture();
|
||||
});
|
||||
|
||||
@@ -88,9 +88,9 @@ public class EntitySelectorTest
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent getSuggestionTooltip()
|
||||
public Component getSuggestionTooltip()
|
||||
{
|
||||
return new StringTextComponent("Example: Selects a random entity");
|
||||
return new TextComponent("Example: Selects a random entity");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,4 +22,4 @@
|
||||
package net.minecraftforge.debug.chat;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
Reference in new issue
Block a user