forked from SteamWar/SteamWar
Remove reflection from BauSystem
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
accessWidener v2 named
|
||||
|
||||
accessible field net/minecraft/server/level/ServerPlayerGameMode gameModeForPlayer Lnet/minecraft/world/level/GameType;
|
||||
accessible field org/bukkit/craftbukkit/block/CraftBlockState position Lnet/minecraft/core/BlockPos;
|
||||
accessible field org/bukkit/craftbukkit/block/CraftBlockState world Lorg/bukkit/craftbukkit/CraftWorld;
|
||||
mutable field org/bukkit/craftbukkit/block/CraftBlockState position Lnet/minecraft/core/BlockPos;
|
||||
mutable field org/bukkit/craftbukkit/block/CraftBlockState world Lorg/bukkit/craftbukkit/CraftWorld;
|
||||
accessible field net/minecraft/server/ServerTickRateManager remainingSprintTicks J
|
||||
@@ -102,7 +102,7 @@ public class NoClipCommand extends SWCommand implements Listener {
|
||||
}
|
||||
|
||||
private void setInternalGameMode(Player player, GameMode gameMode) {
|
||||
// ((CraftPlayer) player).getHandle().gameMode.gameModeForPlayer = GameType.byId(gameMode.getValue());
|
||||
((CraftPlayer) player).getHandle().gameMode.gameModeForPlayer = GameType.byId(gameMode.getValue());
|
||||
}
|
||||
|
||||
@Register(help = true)
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
package de.steamwar.bausystem.utils;
|
||||
|
||||
import de.steamwar.Reflection;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.experimental.UtilityClass;
|
||||
@@ -86,9 +85,6 @@ public class PlaceItemUtils {
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
private static final Reflection.Field<?> positionAccessor = Reflection.getField(CraftBlockState.class, BlockPos.class, 0);
|
||||
private static final Reflection.Field<?> worldAccessor = Reflection.getField(CraftBlockState.class, CraftWorld.class, 0);
|
||||
|
||||
/**
|
||||
* Attempt to place an {@link ItemStack} the {@link Player} is holding against a {@link Block} inside the World.
|
||||
* This can be easily used inside the {@link org.bukkit.event.player.PlayerInteractEvent} to mimik placing a
|
||||
@@ -288,8 +284,9 @@ public class PlaceItemUtils {
|
||||
} else {
|
||||
// If a BlockState is present set the Position and World to the Block you want to place
|
||||
Location blockLocation = block.getLocation();
|
||||
positionAccessor.set(blockState, new BlockPos(blockLocation.getBlockX(), blockLocation.getBlockY(), blockLocation.getBlockZ()));
|
||||
worldAccessor.set(blockState, blockLocation.getWorld());
|
||||
CraftBlockState craftBlockState = (CraftBlockState) blockState;
|
||||
craftBlockState.position = new BlockPos(blockLocation.getBlockX(), blockLocation.getBlockY(), blockLocation.getBlockZ());
|
||||
craftBlockState.world = (CraftWorld) blockLocation.getWorld();
|
||||
}
|
||||
|
||||
if (blockData.getMaterial().isSolid()) {
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
package de.steamwar.bausystem.utils;
|
||||
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.Reflection;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import net.minecraft.network.protocol.game.ClientboundTickingStatePacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
@@ -33,7 +32,6 @@ public class TickManager implements Listener {
|
||||
public static final TickManager impl = new TickManager();
|
||||
|
||||
private static final ServerTickRateManager manager = MinecraftServer.getServer().tickRateManager();
|
||||
private static final Reflection.Field<Long> remainingSprintTicks = Reflection.getField(ServerTickRateManager.class, long.class, 0);
|
||||
|
||||
private boolean blockTpsPacket = true;
|
||||
private int totalSteps;
|
||||
@@ -121,7 +119,7 @@ public class TickManager implements Listener {
|
||||
|
||||
public long getRemainingTicks() {
|
||||
if (isSprinting()) {
|
||||
return remainingSprintTicks.get(manager);
|
||||
return manager.remainingSprintTicks;
|
||||
} else {
|
||||
return manager.frozenTicksToRun();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user