mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 19:59:42 +00:00
46 files changed
+149
-141
No files matched your search
@@ -67,15 +67,15 @@ public final class FMLWorldPersistenceHook implements WorldPersistenceHooks.Worl
|
||||
mod.putString("ModVersion", MavenVersionStringHelper.artifactVersionToString(mi.getVersion()));
|
||||
modList.add(mod);
|
||||
});
|
||||
fmlData.func_218657_a("LoadingModList", modList);
|
||||
fmlData.put("LoadingModList", modList);
|
||||
|
||||
CompoundNBT registries = new CompoundNBT();
|
||||
fmlData.func_218657_a("Registries", registries);
|
||||
fmlData.put("Registries", registries);
|
||||
LOGGER.debug(WORLDPERSISTENCE,"Gathering id map for writing to world save {}", info.getWorldName());
|
||||
|
||||
for (Map.Entry<ResourceLocation, ForgeRegistry.Snapshot> e : RegistryManager.ACTIVE.takeSnapshot(true).entrySet())
|
||||
{
|
||||
registries.func_218657_a(e.getKey().toString(), e.getValue().write());
|
||||
registries.put(e.getKey().toString(), e.getValue().write());
|
||||
}
|
||||
return fmlData;
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ public class StartupQuery {
|
||||
}
|
||||
|
||||
if (query.isSynchronous()) {
|
||||
while (client.currentScreen instanceof GuiNotification) {
|
||||
while (client.field_71462_r instanceof GuiNotification) {
|
||||
if (Thread.interrupted()) {
|
||||
query.exception = new InterruptedException();
|
||||
throw new RuntimeException();
|
||||
|
||||
@@ -37,7 +37,7 @@ public class WorldPersistenceHooks
|
||||
|
||||
public static void handleWorldDataSave(final SaveHandler handler, final WorldInfo worldInfo, final CompoundNBT tagCompound)
|
||||
{
|
||||
worldPersistenceHooks.forEach(wac->tagCompound.func_218657_a(wac.getModId(), wac.getDataForWriting(handler, worldInfo)));
|
||||
worldPersistenceHooks.forEach(wac->tagCompound.put(wac.getModId(), wac.getDataForWriting(handler, worldInfo)));
|
||||
}
|
||||
|
||||
public static void handleWorldDataLoad(SaveHandler handler, WorldInfo worldInfo, CompoundNBT tagCompound)
|
||||
|
||||
@@ -23,6 +23,8 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.widget.button.Button;
|
||||
|
||||
import net.minecraft.client.gui.widget.button.Button.IPressable;
|
||||
|
||||
/**
|
||||
* This class provides a button that fixes several bugs present in the vanilla GuiButton drawing code.
|
||||
* The gist of it is that it allows buttons of any size without gaps in the graphics and with the
|
||||
|
||||
@@ -23,6 +23,8 @@ import net.minecraft.client.Minecraft;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.gui.widget.button.Button.IPressable;
|
||||
|
||||
/**
|
||||
* This class is blatantly stolen from iChunUtils with permission.
|
||||
*
|
||||
|
||||
@@ -24,6 +24,8 @@ import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.widget.button.Button;
|
||||
|
||||
import net.minecraft.client.gui.widget.button.Button.IPressable;
|
||||
|
||||
/**
|
||||
* This class provides a button that shows a string glyph at the beginning. The glyph can be scaled using the glyphScale parameter.
|
||||
*
|
||||
|
||||
@@ -34,14 +34,14 @@ public class GuiConfirmation extends GuiNotification
|
||||
{
|
||||
this.addButton(new Button(this.width / 2 - 104, this.height - 38, 100, 20, ForgeI18n.parseMessage("gui.yes"), b ->
|
||||
{
|
||||
GuiConfirmation.this.minecraft.currentScreen = null;
|
||||
GuiConfirmation.this.minecraft.field_71462_r = null;
|
||||
query.setResult(true);
|
||||
query.finish();
|
||||
}
|
||||
));
|
||||
this.addButton(new Button(this.width / 2 + 4, this.height - 38, 100, 20, ForgeI18n.parseMessage("gui.no"), b ->
|
||||
{
|
||||
GuiConfirmation.this.minecraft.currentScreen = null;
|
||||
GuiConfirmation.this.minecraft.field_71462_r = null;
|
||||
query.setResult(false);
|
||||
query.finish();
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class FMLPlayMessages
|
||||
SpawnEntity(Entity e)
|
||||
{
|
||||
this.entity = e;
|
||||
this.typeId = Registry.ENTITY_TYPE.getId(e.getType());
|
||||
this.typeId = Registry.field_212629_r.getId(e.getType());
|
||||
this.entityId = e.getEntityId();
|
||||
this.uuid = e.getUniqueID();
|
||||
this.posX = e.posX;
|
||||
@@ -75,7 +75,7 @@ public class FMLPlayMessages
|
||||
this.pitch = (byte) MathHelper.floor(e.rotationPitch * 256.0F / 360.0F);
|
||||
this.yaw = (byte) MathHelper.floor(e.rotationYaw * 256.0F / 360.0F);
|
||||
this.headYaw = (byte) (e.getRotationYawHead() * 256.0F / 360.0F);
|
||||
Vec3d vec3d = e.func_213322_ci();
|
||||
Vec3d vec3d = e.getMotion();
|
||||
double d1 = MathHelper.clamp(vec3d.x, -3.9D, 3.9D);
|
||||
double d2 = MathHelper.clamp(vec3d.y, -3.9D, 3.9D);
|
||||
double d3 = MathHelper.clamp(vec3d.z, -3.9D, 3.9D);
|
||||
@@ -141,7 +141,7 @@ public class FMLPlayMessages
|
||||
public static void handle(SpawnEntity msg, Supplier<NetworkEvent.Context> ctx)
|
||||
{
|
||||
ctx.get().enqueueWork(() -> {
|
||||
EntityType<?> type = Registry.ENTITY_TYPE.getByValue(msg.typeId);
|
||||
EntityType<?> type = Registry.field_212629_r.getByValue(msg.typeId);
|
||||
if (type == null)
|
||||
{
|
||||
throw new RuntimeException(String.format("Could not spawn entity (id %d) with unknown type at (%f, %f, %f)", msg.entityId, msg.posX, msg.posY, msg.posZ));
|
||||
@@ -209,7 +209,7 @@ public class FMLPlayMessages
|
||||
{
|
||||
ctx.get().enqueueWork(() -> {
|
||||
// TODO extend IScreenFactory to allow for extra data
|
||||
ScreenManager.func_216909_a(msg.getType(), Minecraft.getInstance(), msg.getWindowId(), msg.getName());
|
||||
ScreenManager.openScreen(msg.getType(), Minecraft.getInstance(), msg.getWindowId(), msg.getName());
|
||||
});
|
||||
ctx.get().setPacketHandled(true);
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ public class NetworkEvent extends Event
|
||||
if (netHandler instanceof ServerPlayNetHandler)
|
||||
{
|
||||
ServerPlayNetHandler netHandlerPlayServer = (ServerPlayNetHandler) netHandler;
|
||||
return netHandlerPlayServer.player;
|
||||
return netHandlerPlayServer.field_147369_b;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ public class NetworkHooks
|
||||
throw new IllegalArgumentException("Invalid PacketBuffer for openGui, found "+ output.readableBytes()+ " bytes");
|
||||
}
|
||||
Container c = containerSupplier.createMenu(openContainerId, player.inventory, player);
|
||||
ContainerType<?> type = c.func_216957_a();
|
||||
ContainerType<?> type = c.getType();
|
||||
FMLPlayMessages.OpenContainer msg = new FMLPlayMessages.OpenContainer(type, openContainerId, containerSupplier.getDisplayName(), output);
|
||||
FMLNetworkConstants.playChannel.sendTo(msg, player.connection.getNetworkManager(), NetworkDirection.PLAY_TO_CLIENT);
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public class NetworkRegistry
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static final Marker NETREGISTRY = MarkerManager.getMarker("NETREGISTRY");
|
||||
|
||||
private static Map<ResourceLocation, NetworkInstance> instances = new HashMap<>();
|
||||
private static Map<ResourceLocation, NetworkInstance> instances = Collections.synchronizedMap(new HashMap<>());
|
||||
|
||||
/**
|
||||
* Special value for clientAcceptedVersions and serverAcceptedVersions predicates indicating the other side lacks
|
||||
|
||||
@@ -147,7 +147,7 @@ public class ServerLifecycleHooks
|
||||
|
||||
private static void rejectConnection(final NetworkManager manager, ConnectionType type, String message) {
|
||||
manager.setConnectionState(ProtocolType.LOGIN);
|
||||
LOGGER.info(SERVERHOOKS, "Disconnecting {} connection attempt: ", type, message);
|
||||
LOGGER.info(SERVERHOOKS, "Disconnecting {} connection attempt: {}", type, message);
|
||||
StringTextComponent text = new StringTextComponent(message);
|
||||
manager.sendPacket(new SDisconnectLoginPacket(text));
|
||||
manager.closeChannel(text);
|
||||
|
||||
Reference in new issue
Block a user