mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-26 15:03:04 +00:00
Regenerate patches with relative headers. This should lower conflicts in future PRs.
Convert Forge to use Official mappings. Mojang released their obfuscation mappings but we have not used them up until now due to wanting to get their license to be more explicitly permissive. It is clear that their intent is to allow us to use their names for developing mods like this. See the full wording, and our interpretation here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
This commit is contained in:
1 parent
802298d99d
commit
a95b968c13
832 files changed
+4464
-4373
No files matched your search
@@ -59,7 +59,7 @@ public class BlockSnapshot
|
||||
private BlockSnapshot(RegistryKey<World> dim, IWorld world, BlockPos pos, BlockState state, @Nullable CompoundNBT nbt, int flags)
|
||||
{
|
||||
this.dim = dim;
|
||||
this.pos = pos.toImmutable();
|
||||
this.pos = pos.immutable();
|
||||
this.block = state;
|
||||
this.flags = flags;
|
||||
this.nbt = nbt;
|
||||
@@ -77,19 +77,19 @@ public class BlockSnapshot
|
||||
|
||||
public static BlockSnapshot create(RegistryKey<World> dim, IWorld world, BlockPos pos, int flag)
|
||||
{
|
||||
return new BlockSnapshot(dim, world, pos, world.getBlockState(pos), getTileNBT(world.getTileEntity(pos)), flag);
|
||||
return new BlockSnapshot(dim, world, pos, world.getBlockState(pos), getTileNBT(world.getBlockEntity(pos)), flag);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static CompoundNBT getTileNBT(@Nullable TileEntity te)
|
||||
{
|
||||
return te == null ? null : te.write(new CompoundNBT());
|
||||
return te == null ? null : te.save(new CompoundNBT());
|
||||
}
|
||||
|
||||
public BlockState getCurrentBlock()
|
||||
{
|
||||
IWorld world = getWorld();
|
||||
return world == null ? Blocks.AIR.getDefaultState() : world.getBlockState(this.pos);
|
||||
return world == null ? Blocks.AIR.defaultBlockState() : world.getBlockState(this.pos);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -98,7 +98,7 @@ public class BlockSnapshot
|
||||
IWorld world = this.world != null ? this.world.get() : null;
|
||||
if (world == null)
|
||||
{
|
||||
world = ServerLifecycleHooks.getCurrentServer().getWorld(this.dim);
|
||||
world = ServerLifecycleHooks.getCurrentServer().getLevel(this.dim);
|
||||
this.world = new WeakReference<IWorld>(world);
|
||||
}
|
||||
return world;
|
||||
@@ -112,7 +112,7 @@ public class BlockSnapshot
|
||||
@Nullable
|
||||
public TileEntity getTileEntity()
|
||||
{
|
||||
return getNbt() != null ? TileEntity.readTileEntity(getReplacedBlock(), getNbt()) : null;
|
||||
return getNbt() != null ? TileEntity.loadStatic(getReplacedBlock(), getNbt()) : null;
|
||||
}
|
||||
|
||||
public boolean restore()
|
||||
@@ -140,23 +140,23 @@ public class BlockSnapshot
|
||||
if (current != replaced)
|
||||
{
|
||||
if (force)
|
||||
world.setBlockState(pos, replaced, flags);
|
||||
world.setBlock(pos, replaced, flags);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
world.setBlockState(pos, replaced, flags);
|
||||
world.setBlock(pos, replaced, flags);
|
||||
if (world instanceof World)
|
||||
((World)world).notifyBlockUpdate(pos, current, replaced, flags);
|
||||
((World)world).sendBlockUpdated(pos, current, replaced, flags);
|
||||
|
||||
TileEntity te = null;
|
||||
if (getNbt() != null)
|
||||
{
|
||||
te = world.getTileEntity(pos);
|
||||
te = world.getBlockEntity(pos);
|
||||
if (te != null)
|
||||
{
|
||||
te.read(getReplacedBlock(), getNbt());
|
||||
te.markDirty();
|
||||
te.load(getReplacedBlock(), getNbt());
|
||||
te.setChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ public class BlockSnapshot
|
||||
{
|
||||
this.toString =
|
||||
"BlockSnapshot[" +
|
||||
"World:" + this.dim.getLocation() + ',' +
|
||||
"World:" + this.dim.location() + ',' +
|
||||
"Pos: " + this.pos + ',' +
|
||||
"State: " + this.block + ',' +
|
||||
"Flags: " + this.flags + ',' +
|
||||
|
||||
@@ -30,8 +30,8 @@ public class ChunkCoordComparator implements java.util.Comparator<ChunkPos>
|
||||
|
||||
public ChunkCoordComparator(ServerPlayerEntity entityplayer)
|
||||
{
|
||||
x = (int) entityplayer.getPosX() >> 4;
|
||||
z = (int) entityplayer.getPosZ() >> 4;
|
||||
x = (int) entityplayer.getX() >> 4;
|
||||
z = (int) entityplayer.getZ() >> 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,12 +29,12 @@ public class DummyWorldSaveData extends WorldSavedData {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(final CompoundNBT nbt) {
|
||||
public void load(final CompoundNBT nbt) {
|
||||
// NOOP
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT write(final CompoundNBT compound) {
|
||||
public CompoundNBT save(final CompoundNBT compound) {
|
||||
// NOOP
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -47,16 +47,16 @@ public class FakePlayer extends ServerPlayerEntity
|
||||
super(world.getServer(), world, name, new PlayerInteractionManager(world));
|
||||
}
|
||||
|
||||
@Override public Vector3d getPositionVec(){ return new Vector3d(0, 0, 0); }
|
||||
@Override public BlockPos getPosition(){ return BlockPos.ZERO; }
|
||||
@Override public void sendStatusMessage(ITextComponent chatComponent, boolean actionBar){}
|
||||
@Override public Vector3d position(){ return new Vector3d(0, 0, 0); }
|
||||
@Override public BlockPos blockPosition(){ return BlockPos.ZERO; }
|
||||
@Override public void displayClientMessage(ITextComponent chatComponent, boolean actionBar){}
|
||||
@Override public void sendMessage(ITextComponent component, UUID senderUUID) {}
|
||||
@Override public void addStat(Stat par1StatBase, int par2){}
|
||||
@Override public void awardStat(Stat par1StatBase, int par2){}
|
||||
//@Override public void openGui(Object mod, int modGuiId, World world, int x, int y, int z){}
|
||||
@Override public boolean isInvulnerableTo(DamageSource source){ return true; }
|
||||
@Override public boolean canAttackPlayer(PlayerEntity player){ return false; }
|
||||
@Override public void onDeath(DamageSource source){ return; }
|
||||
@Override public boolean canHarmPlayer(PlayerEntity player){ return false; }
|
||||
@Override public void die(DamageSource source){ return; }
|
||||
@Override public void tick(){ return; }
|
||||
@Override public void handleClientSettings(CClientSettingsPacket pkt){ return; }
|
||||
@Override public void updateOptions(CClientSettingsPacket pkt){ return; }
|
||||
@Override @Nullable public MinecraftServer getServer() { return ServerLifecycleHooks.getCurrentServer(); }
|
||||
}
|
||||
@@ -67,11 +67,11 @@ public class FakePlayerFactory
|
||||
|
||||
public static void unloadWorld(ServerWorld world)
|
||||
{
|
||||
fakePlayers.entrySet().removeIf(entry -> entry.getValue().world == world);
|
||||
if (MINECRAFT_PLAYER != null && MINECRAFT_PLAYER.get() != null && MINECRAFT_PLAYER.get().world == world) // This shouldn't be strictly necessary, but lets be aggressive.
|
||||
fakePlayers.entrySet().removeIf(entry -> entry.getValue().level == world);
|
||||
if (MINECRAFT_PLAYER != null && MINECRAFT_PLAYER.get() != null && MINECRAFT_PLAYER.get().level == world) // This shouldn't be strictly necessary, but lets be aggressive.
|
||||
{
|
||||
FakePlayer mc = MINECRAFT_PLAYER.get();
|
||||
if (mc != null && mc.world == world)
|
||||
if (mc != null && mc.level == world)
|
||||
{
|
||||
MINECRAFT_PLAYER = null;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public interface ITeleporter
|
||||
@Nullable
|
||||
default PortalInfo getPortalInfo(Entity entity, ServerWorld destWorld, Function<ServerWorld, PortalInfo> defaultPortalInfo)
|
||||
{
|
||||
return this.isVanilla() ? defaultPortalInfo.apply(destWorld) : new PortalInfo(entity.getPositionVec(), Vector3d.ZERO, entity.rotationYaw, entity.rotationPitch);
|
||||
return this.isVanilla() ? defaultPortalInfo.apply(destWorld) : new PortalInfo(entity.position(), Vector3d.ZERO, entity.yRot, entity.xRot);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -99,11 +99,11 @@ public class JsonUtils
|
||||
@Nullable
|
||||
public static CompoundNBT readNBT(JsonObject json, String key)
|
||||
{
|
||||
if (net.minecraft.util.JSONUtils.hasField(json, key))
|
||||
if (net.minecraft.util.JSONUtils.isValidNode(json, key))
|
||||
{
|
||||
try
|
||||
{
|
||||
return JsonToNBT.getTagFromJson(net.minecraft.util.JSONUtils.getString(json, key));
|
||||
return JsonToNBT.parseTag(net.minecraft.util.JSONUtils.getAsString(json, key));
|
||||
} catch (CommandSyntaxException e)
|
||||
{
|
||||
throw new JsonSyntaxException("Malformed NBT tag", e);
|
||||
|
||||
@@ -47,10 +47,10 @@ public class ReverseTagWrapper<T>
|
||||
public Set<ResourceLocation> getTagNames()
|
||||
{
|
||||
ITagCollection<T> collection = colSupplier.get();
|
||||
if (cache == null || colCache != collection.getIDTagMap()) // Identity equals.
|
||||
if (cache == null || colCache != collection.getAllTags()) // Identity equals.
|
||||
{
|
||||
this.cache = Collections.unmodifiableSet(new HashSet<>(collection.getOwningTags(target)));
|
||||
this.colCache = collection.getIDTagMap();
|
||||
this.cache = Collections.unmodifiableSet(new HashSet<>(collection.getMatchingTags(target)));
|
||||
this.colCache = collection.getAllTags();
|
||||
}
|
||||
return this.cache;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class WorldCapabilityData extends WorldSavedData
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(CompoundNBT nbt)
|
||||
public void load(CompoundNBT nbt)
|
||||
{
|
||||
this.capNBT = nbt;
|
||||
if (serializable != null)
|
||||
@@ -54,7 +54,7 @@ public class WorldCapabilityData extends WorldSavedData
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT write(CompoundNBT nbt)
|
||||
public CompoundNBT save(CompoundNBT nbt)
|
||||
{
|
||||
if (serializable != null)
|
||||
nbt = serializable.serializeNBT();
|
||||
|
||||
Reference in new issue
Block a user