Skip to content

Commit

Permalink
Merge branch 'version/7.2.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
me4502 committed Oct 9, 2023
2 parents 2a09aaf + deb04a5 commit 1a96b0a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion worldedit-forge/build.gradle.kts
Expand Up @@ -16,7 +16,7 @@ val minecraftVersion = "1.20.2"
val nextMajorMinecraftVersion: String = minecraftVersion.split('.').let { (useless, major) ->
"$useless.${major.toInt() + 1}"
}
val forgeVersion = "48.0.1"
val forgeVersion = "48.0.20"

val apiClasspath = configurations.create("apiClasspath") {
isCanBeResolved = true
Expand Down
Expand Up @@ -20,34 +20,46 @@
package com.sk89q.worldedit.forge;

import com.mojang.authlib.GameProfile;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ClientInformation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.MenuProvider;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.stats.Stat;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.HumanoidArm;
import net.minecraft.world.entity.player.ChatVisiblity;
import net.minecraftforge.common.util.FakePlayer;

import java.util.OptionalInt;
import java.util.UUID;
import javax.annotation.Nullable;

public class WorldEditFakePlayer extends FakePlayer {
private static final GameProfile FAKE_GAME_PROFILE = new GameProfile(UUID.nameUUIDFromBytes("worldedit".getBytes()), "[WorldEdit]");
public class WorldEditFakePlayer extends ServerPlayer {
private static final GameProfile FAKE_WORLDEDIT_PROFILE = new GameProfile(UUID.nameUUIDFromBytes("worldedit".getBytes()), "[WorldEdit]");
private static final ClientInformation FAKE_CLIENT_INFO = new ClientInformation(
"en_US", 16, ChatVisiblity.FULL, true, 0, HumanoidArm.LEFT, false, false
);

public WorldEditFakePlayer(ServerLevel world) {
super(world, FAKE_GAME_PROFILE, FAKE_CLIENT_INFO);
super(world.getServer(), world, FAKE_WORLDEDIT_PROFILE, FAKE_CLIENT_INFO);
}

@Override
public boolean canEat(boolean checkHunger) {
return true;
public void tick() {
}

@Override
public void awardStat(Stat<?> stat, int incrementer) {
}

@Override
public OptionalInt openMenu(@Nullable MenuProvider menuProvider) {
return OptionalInt.empty();
public void awardStat(Stat<?> stat) {
}

@Override
public void displayClientMessage(Component message, boolean actionBar) {
super.displayClientMessage(message, actionBar);
}

@Override
public boolean isInvulnerableTo(DamageSource damageSource) {
return true;
}
}

0 comments on commit 1a96b0a

Please sign in to comment.