13
0
geforkt von Mirrors/Paper

death to more obfhelpers

Dieser Commit ist enthalten in:
MiniDigger | Martin 2021-06-17 22:20:03 +02:00
Ursprung 62fabeca0c
Commit 4ac379cbd0
13 geänderte Dateien mit 28 neuen und 132 gelöschten Zeilen

Datei anzeigen

@ -202,3 +202,6 @@ public net.minecraft.world.entity.ExperienceOrb xpToDurability(I)I
# Implement an API for CanPlaceOn and CanDestroy NBT values
public net.minecraft.commands.arguments.blocks.BlockStateParser id
# Villager Restock API
public net.minecraft.world.entity.npc.Villager numberOfRestocksToday

Datei anzeigen

@ -5,18 +5,6 @@ Subject: [PATCH] Add a way to get translation keys for blocks, entities and
materials
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -0,0 +0,0 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> {
return Registry.ENTITY_TYPE.getKey(type);
}
+ @Deprecated public static Optional<EntityType<?>> getByName(String name) { return byString(name); } // Paper - OBFHELPER
public static Optional<EntityType<?>> byString(String id) {
return Registry.ENTITY_TYPE.getOptional(ResourceLocation.tryParse(id));
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@ -64,7 +52,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public String getTranslationKey(org.bukkit.entity.EntityType type) {
+ return net.minecraft.world.entity.EntityType.getByName(type.getName()).map(net.minecraft.world.entity.EntityType::getDescriptionId).orElse(null);
+ return net.minecraft.world.entity.EntityType.byString(type.getName()).map(net.minecraft.world.entity.EntityType::getDescriptionId).orElse(null);
+ }
+
+ @Override

Datei anzeigen

@ -61,18 +61,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
static class GossipEntry {
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -0,0 +0,0 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
this.numberOfRestocksToday = 0;
}
+ @Deprecated public GossipContainer getReputation() { return this.getGossips(); } // Paper - OBFHELPER
public GossipContainer getGossips() {
return this.gossips;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
@ -99,7 +87,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - Add villager reputation API
+ @Override
+ public Reputation getReputation(UUID uniqueId) {
+ net.minecraft.world.entity.ai.gossip.GossipContainer.EntityGossips rep = getHandle().getReputation().getReputations().get(uniqueId);
+ net.minecraft.world.entity.ai.gossip.GossipContainer.EntityGossips rep = getHandle().getGossips().getReputations().get(uniqueId);
+ if (rep == null) {
+ return new Reputation(Maps.newHashMap());
+ }
@ -109,7 +97,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public Map<UUID, Reputation> getReputations() {
+ return getHandle().getReputation().getReputations().entrySet()
+ return getHandle().getGossips().getReputations().entrySet()
+ .stream()
+ .collect(java.util.stream.Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().getPaperReputation()));
+ }
@ -117,7 +105,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Override
+ public void setReputation(UUID uniqueId, Reputation reputation) {
+ net.minecraft.world.entity.ai.gossip.GossipContainer.EntityGossips nmsReputation =
+ getHandle().getReputation().getReputations().computeIfAbsent(
+ getHandle().getGossips().getReputations().computeIfAbsent(
+ uniqueId,
+ key -> new net.minecraft.world.entity.ai.gossip.GossipContainer.EntityGossips()
+ );
@ -133,7 +121,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public void clearReputations() {
+ getHandle().getReputation().getReputations().clear();
+ getHandle().getGossips().getReputations().clear();
+ }
+ // Paper end
}

Datei anzeigen

@ -11,18 +11,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
@@ -0,0 +0,0 @@ public abstract class Raider extends PatrollingMonster {
public class ObtainRaidLeaderBannerGoal<T extends Raider> extends Goal {
- private final T mob;
+ private final T mob; @Deprecated private T getRaider() { return mob; } // Paper - obfhelper
public ObtainRaidLeaderBannerGoal(T entityraider) { // CraftBukkit - decompile error
this.mob = entityraider;
@@ -0,0 +0,0 @@ public abstract class Raider extends PatrollingMonster {
@Override
public boolean canUse() {
+ if (!getRaider().level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || !getRaider().canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items
+ if (!this.mob.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items
Raid raid = this.mob.getCurrentRaid();
if (this.mob.hasActiveRaid() && !this.mob.getCurrentRaid().isOver() && this.mob.canBeLeader() && !ItemStack.matches(this.mob.getItemBySlot(EquipmentSlot.HEAD), Raid.getLeaderBannerInstance())) {

Datei anzeigen

@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ getInt("entity-per-chunk-save-limit.ender_pearl", -1);
+ getInt("entity-per-chunk-save-limit.arrow", -1);
+ EntityType.getEntityNameList().forEach(name -> {
+ final EntityType<?> type = EntityType.getByName(name.getPath()).orElseThrow(() -> new IllegalStateException("Unknown Entity Type: " + name.toString()));
+ final EntityType<?> type = EntityType.byString(name.getPath()).orElseThrow(() -> new IllegalStateException("Unknown Entity Type: " + name.toString()));
+ final String path = ".entity-per-chunk-save-limit." + name.getPath();
+ final int value = config.getInt("world-settings." + worldName + path, config.getInt("world-settings.default" + path, -1)); // get without setting defaults
+ if (value != -1) entityPerChunkSaveLimits.put(type, value);

Datei anzeigen

@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (interaction == ReputationEventType.ZOMBIE_VILLAGER_CURED) {
+ // Paper start - fix MC-181190
+ if (level.paperConfig.fixCuringZombieVillagerDiscountExploit) {
+ final GossipContainer.EntityGossips playerReputation = this.getReputation().getReputations().get(entity.getUUID());
+ final GossipContainer.EntityGossips playerReputation = this.getGossips().getReputations().get(entity.getUUID());
+ if (playerReputation != null) {
+ playerReputation.remove(GossipType.MAJOR_POSITIVE);
+ playerReputation.remove(GossipType.MINOR_POSITIVE);

Datei anzeigen

@ -32,23 +32,13 @@ diff --git a/src/main/java/net/minecraft/world/level/block/RailState.java b/src/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/RailState.java
+++ b/src/main/java/net/minecraft/world/level/block/RailState.java
@@ -0,0 +0,0 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.RailShape;
public class RailState {
- private final Level level;
- private final BlockPos pos;
+ private final Level level; @Deprecated public final Level getWorld() { return this.level; } // Paper - OBFHELPER
+ private final BlockPos pos; @Deprecated public final BlockPos getPos() { return this.pos; } // Paper - OBFHELPER
private final BaseRailBlock block;
- private BlockState state;
+ private BlockState state; @Deprecated public final BlockState getRailState() { return this.state; } // Paper - OBFHELPER
@@ -0,0 +0,0 @@ public class RailState {
private final boolean isStraight;
private final List<BlockPos> connections = Lists.newArrayList();
+ // Paper start - prevent desync
+ public boolean isValid() {
+ return this.getWorld().getBlockState(this.getPos()).getBlock() == this.getRailState().getBlock();
+ return this.level.getBlockState(this.pos).getBlock() == this.state.getBlock();
+ }
+ // Paper end - prevent desync
+
@ -89,6 +79,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public BlockState getState() {
- return this.state;
+ return this.getWorld().getBlockState(this.getPos()); // Paper - prevent desync
+ return this.level.getBlockState(this.pos); // Paper - prevent desync
}
}

Datei anzeigen

@ -510,7 +510,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public PaperCustomGoal(Goal<T> handle) {
+ this.handle = handle;
+
+ this.setTypes(MobGoalHelper.paperToVanilla(handle.getTypes()));
+ this.setFlags(MobGoalHelper.paperToVanilla(handle.getTypes()));
+ if (this.getGoalTypes().size() == 0) {
+ this.getGoalTypes().addUnchecked(Flag.UNKNOWN_BEHAVIOR);
+ }
@ -810,12 +810,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public boolean shouldActivate() {
+ return handle.shouldActivate2();
+ return handle.canUse();
+ }
+
+ @Override
+ public boolean shouldStayActive() {
+ return handle.shouldStayActive2();
+ return handle.canContinueToUse();
+ }
+
+ @Override
@ -864,7 +864,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private final EnumSet<Goal.Flag> flags = EnumSet.noneOf(Goal.Flag.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be.
private final com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<net.minecraft.world.entity.ai.goal.Goal.Flag> goalTypes = new com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<>(Goal.Flag.class); // Paper - remove streams from pathfindergoalselector
- public abstract boolean canUse();
+ // Paper start make sure goaltypes is never empty
+ public Goal() {
+ if (this.goalTypes.size() == 0) {
@ -873,23 +872,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Paper end
+
+ public boolean canUse() { return this.shouldActivate(); } @Deprecated public boolean shouldActivate() { return false;} @Deprecated public boolean shouldActivate2() { return canUse(); } // Paper - OBFHELPER, for both directions...
- public boolean canContinueToUse() {
+ public boolean canContinueToUse() { return this.shouldStayActive(); } @Deprecated public boolean shouldStayActive2() { return canContinueToUse(); } @Deprecated public boolean shouldStayActive() { // Paper - OBFHELPER, for both directions...
return this.canUse();
}
public abstract boolean canUse();
public boolean canContinueToUse() {
@@ -0,0 +0,0 @@ public abstract class Goal {
public void tick() {
}
- public void setFlags(EnumSet<Goal.Flag> controls) {
+ @Deprecated public void setFlags(EnumSet<Goal.Flag> controls) { this.setTypes(controls); } public void setTypes(EnumSet<Goal.Flag> enumset) { // Paper - OBFHELPER
// Paper start - remove streams from pathfindergoalselector
this.goalTypes.clear();
- this.goalTypes.addAllUnchecked(controls);
+ this.goalTypes.addAllUnchecked(enumset);
this.goalTypes.addAllUnchecked(controls);
+ // make sure its never empty
+ if (this.goalTypes.size() == 0) {
+ this.goalTypes.addUnchecked(Flag.UNKNOWN_BEHAVIOR);

Datei anzeigen

@ -65,14 +65,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.CustomSpawner;
import net.minecraft.world.level.GameRules;
@@ -0,0 +0,0 @@ import net.minecraft.world.level.block.state.BlockState;
public class PatrolSpawner implements CustomSpawner {
- private int nextTick;
+ private int nextTick;@Deprecated private int getSpawnDelay() { return nextTick; } @Deprecated private void setSpawnDelay(int spawnDelay) { this.nextTick = spawnDelay; } // Paper - OBFHELPER
public PatrolSpawner() {}
@@ -0,0 +0,0 @@ public class PatrolSpawner implements CustomSpawner {
@Override
public int tick(ServerLevel world, boolean spawnMonsters, boolean spawnAnimals) {
@ -106,8 +99,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} else {
- this.nextTick += 12000 + random.nextInt(1200);
- long i = world.getDayTime() / 24000L;
+ setSpawnDelay(getSpawnDelay() - 1);
+ patrolSpawnDelay = getSpawnDelay();
+ this.nextTick--;
+ patrolSpawnDelay = this.nextTick;
+ }
+
+ if (patrolSpawnDelay > 0) {
@ -122,7 +115,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (world.paperConfig.patrolPerPlayerDelay) {
+ entityhuman.patrolSpawnDelay += world.paperConfig.patrolDelay + random.nextInt(1200);
+ } else {
+ setSpawnDelay(getSpawnDelay() + world.paperConfig.patrolDelay + random.nextInt(1200));
+ this.nextTick += world.paperConfig.patrolDelay + random.nextInt(1200);
+ }
- if (i >= 5L && world.isDay()) {

Datei anzeigen

@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - prevent headless pistons from forming
+ if (!com.destroystokyo.paper.PaperConfig.allowHeadlessPistons && iblockdata.getBlock() == Blocks.MOVING_PISTON) {
+ BlockEntity extension = this.level.getBlockEntity(blockposition);
+ if (extension instanceof PistonMovingBlockEntity && ((PistonMovingBlockEntity) extension).isHead()) {
+ if (extension instanceof PistonMovingBlockEntity && ((PistonMovingBlockEntity) extension).isSourcePiston()) {
+ Direction direction = iblockdata.getValue(PistonHeadBlock.FACING);
+ set.add(blockposition.relative(direction.getOpposite()));
+ }
@ -59,16 +59,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
d4 += d0 * 0.30000001192092896D;
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
@@ -0,0 +0,0 @@ public class PistonMovingBlockEntity extends BlockEntity {
return this.direction;
}
+ @Deprecated public final boolean isHead() { return this.isSourcePiston(); } // Paper - OBFHELPER
+
public boolean isSourcePiston() {
return this.isSourcePiston;
}

Datei anzeigen

@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+
+ private void processText() {
+ CompoundTag display = getSubTag("display");
+ CompoundTag display = getTagElement("display");
+ if (display != null) {
+ if (display.contains("Name", 8)) {
+ String json = display.getString("Name");
@ -61,11 +61,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.getItem().verifyTagAfterLoad(this.tag);
}
@@ -0,0 +0,0 @@ public final class ItemStack {
}
}
+ @Deprecated @Nullable public CompoundTag getSubTag(String s) { return getTagElement(s); } // Paper - OBFHELPER
@Nullable
public CompoundTag getTagElement(String key) {
return this.tag != null && this.tag.contains(key, 10) ? this.tag.getCompound(key) : null;

Datei anzeigen

@ -4,19 +4,6 @@ Date: Sun, 26 Apr 2020 23:49:01 -0400
Subject: [PATCH] Villager Restocks API
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -0,0 +0,0 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
private long lastGossipDecayTime;
private int villagerXp;
private long lastRestockGameTime;
- private int numberOfRestocksToday;
+ private int numberOfRestocksToday; @Deprecated public int getRestocksToday(){ return this.numberOfRestocksToday; } @Deprecated public void setRestocksToday(int restocksToday){ this.numberOfRestocksToday = restocksToday; } // Paper OBFHELPER
private long lastRestockCheckDayTime;
private boolean assignProfessionWhenSpawned;
private static final ImmutableList<MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.HOME, MemoryModuleType.JOB_SITE, MemoryModuleType.POTENTIAL_JOB_SITE, MemoryModuleType.MEETING_POINT, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.VISIBLE_VILLAGER_BABIES, MemoryModuleType.NEAREST_PLAYERS, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, MemoryModuleType.WALK_TARGET, new MemoryModuleType[]{MemoryModuleType.LOOK_TARGET, MemoryModuleType.INTERACTION_TARGET, MemoryModuleType.BREED_TARGET, MemoryModuleType.PATH, MemoryModuleType.DOORS_TO_CLOSE, MemoryModuleType.NEAREST_BED, MemoryModuleType.HURT_BY, MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.NEAREST_HOSTILE, MemoryModuleType.SECONDARY_JOB_SITE, MemoryModuleType.HIDING_PLACE, MemoryModuleType.HEARD_BELL_TIME, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.LAST_SLEPT, MemoryModuleType.LAST_WOKEN, MemoryModuleType.LAST_WORKED_AT_POI, MemoryModuleType.GOLEM_DETECTED_RECENTLY});
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
@ -28,12 +15,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start
+ @Override
+ public int getRestocksToday() {
+ return getHandle().getRestocksToday();
+ return getHandle().numberOfRestocksToday;
+ }
+
+ @Override
+ public void setRestocksToday(int restocksToday) {
+ getHandle().setRestocksToday(restocksToday);
+ getHandle().numberOfRestocksToday = restocksToday;
+ }
+ // Paper end
+

Datei anzeigen

@ -4,18 +4,6 @@ Date: Wed, 12 May 2021 03:21:22 -0700
Subject: [PATCH] call PortalCreateEvent players and end platform
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/core/BlockPos.java
+++ b/src/main/java/net/minecraft/core/BlockPos.java
@@ -0,0 +0,0 @@ public class BlockPos extends Vec3i {
return this.set(this.getX() + direction.getStepX() * distance, this.getY() + direction.getStepY() * distance, this.getZ() + direction.getStepZ() * distance);
}
+ @Deprecated public BlockPos.MutableBlockPos withOffset(int x, int y, int z) { return move(x, y, z); } // Paper - OBFHELPER
public BlockPos.MutableBlockPos move(int dx, int dy, int dz) {
return this.set(this.getX() + dx, this.getY() + dy, this.getZ() + dz);
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java