mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 02:20:01 +03:00
134 lines
4.7 KiB
Diff
134 lines
4.7 KiB
Diff
--- ../src-base/minecraft/net/minecraft/advancements/AdvancementRewards.java
|
|
+++ ../src-work/minecraft/net/minecraft/advancements/AdvancementRewards.java
|
|
@@ -11,6 +11,7 @@
|
|
import java.util.Arrays;
|
|
import net.minecraft.command.CommandResultStats;
|
|
import net.minecraft.command.FunctionObject;
|
|
+import net.minecraft.command.ICommandListener;
|
|
import net.minecraft.command.ICommandSender;
|
|
import net.minecraft.entity.Entity;
|
|
import net.minecraft.entity.item.EntityItem;
|
|
@@ -49,7 +50,7 @@
|
|
public void apply(final EntityPlayerMP player)
|
|
{
|
|
player.addExperience(this.experience);
|
|
- LootContext lootcontext = (new LootContext.Builder(player.getServerWorld())).withLootedEntity(player).build();
|
|
+ LootContext lootcontext = (new LootContext.Builder(player.getServerWorld())).withLootedEntity(player).withPlayer(player).withLuck(player.getLuck()).build(); // Forge: add player & luck to LootContext
|
|
boolean flag = false;
|
|
|
|
for (ResourceLocation resourcelocation : this.loot)
|
|
@@ -89,56 +90,67 @@
|
|
|
|
if (functionobject != null)
|
|
{
|
|
- ICommandSender icommandsender = new ICommandSender()
|
|
- {
|
|
- public String getName()
|
|
- {
|
|
- return player.getName();
|
|
- }
|
|
- public ITextComponent getDisplayName()
|
|
- {
|
|
- return player.getDisplayName();
|
|
- }
|
|
- public void sendMessage(ITextComponent component)
|
|
- {
|
|
- }
|
|
- public boolean canUseCommand(int permLevel, String commandName)
|
|
- {
|
|
- return permLevel <= 2;
|
|
- }
|
|
- public BlockPos getPosition()
|
|
- {
|
|
- return player.getPosition();
|
|
- }
|
|
- public Vec3d getPositionVector()
|
|
- {
|
|
- return player.getPositionVector();
|
|
- }
|
|
- public World getEntityWorld()
|
|
- {
|
|
- return player.world;
|
|
- }
|
|
- public Entity getCommandSenderEntity()
|
|
- {
|
|
- return player;
|
|
- }
|
|
- public boolean sendCommandFeedback()
|
|
- {
|
|
- return minecraftserver.worlds[0].getGameRules().getBoolean("commandBlockOutput");
|
|
- }
|
|
- public void setCommandStat(CommandResultStats.Type type, int amount)
|
|
- {
|
|
- player.setCommandStat(type, amount);
|
|
- }
|
|
- public MinecraftServer getServer()
|
|
- {
|
|
- return player.getServer();
|
|
- }
|
|
- };
|
|
+ ICommandSender icommandsender = new AdvancementCommandListener(player, minecraftserver);
|
|
+
|
|
minecraftserver.getFunctionManager().execute(functionobject, icommandsender);
|
|
}
|
|
+
|
|
}
|
|
|
|
+ public static class AdvancementCommandListener implements ICommandSender {
|
|
+
|
|
+ private final EntityPlayerMP player;
|
|
+ private final MinecraftServer minecraftserver;
|
|
+
|
|
+ public AdvancementCommandListener(EntityPlayerMP entityplayer, MinecraftServer minecraftserver) {
|
|
+ this.player = entityplayer;
|
|
+ this.minecraftserver = minecraftserver;
|
|
+ }
|
|
+
|
|
+ public String getName() {
|
|
+ return player.getName();
|
|
+ }
|
|
+
|
|
+ public ITextComponent getDisplayName() {
|
|
+ return player.getDisplayName();
|
|
+ }
|
|
+
|
|
+ public void sendMessage(ITextComponent component) {
|
|
+ }
|
|
+
|
|
+ public boolean canUseCommand(int permLevel, String commandName) {
|
|
+ return permLevel <= 2;
|
|
+ }
|
|
+
|
|
+ public BlockPos getPosition() {
|
|
+ return player.getPosition();
|
|
+ }
|
|
+
|
|
+ public Vec3d getPositionVector() {
|
|
+ return player.getPositionVector();
|
|
+ }
|
|
+
|
|
+ public World getEntityWorld() {
|
|
+ return player.world;
|
|
+ }
|
|
+
|
|
+ public Entity getCommandSenderEntity() {
|
|
+ return player;
|
|
+ }
|
|
+
|
|
+ public boolean sendCommandFeedback() {
|
|
+ return minecraftserver.worlds[0].getGameRules().getBoolean("commandBlockOutput");
|
|
+ }
|
|
+
|
|
+ public void setCommandStat(CommandResultStats.Type type, int amount) {
|
|
+ player.setCommandStat(type, amount);
|
|
+ }
|
|
+
|
|
+ public MinecraftServer getServer() {
|
|
+ return player.getServer();
|
|
+ }
|
|
+ }
|
|
+
|
|
public String toString()
|
|
{
|
|
return "AdvancementRewards{experience=" + this.experience + ", loot=" + Arrays.toString((Object[])this.loot) + ", recipes=" + Arrays.toString((Object[])this.recipes) + ", function=" + this.function + '}';
|