Update to 1.15.1

This commit is contained in:
Marcel Konrad
2019-12-26 19:18:34 +01:00
parent d68b9126d0
commit efdcf51c23
29 changed files with 416 additions and 285 deletions

View File

@@ -1,8 +1,10 @@
package exopandora.worldhandler.util;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.stream.Collectors;
import net.minecraft.advancements.Advancement;
import net.minecraft.advancements.AdvancementManager;
@@ -10,6 +12,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.profiler.IProfiler;
import net.minecraft.resources.IFutureReloadListener;
import net.minecraft.resources.IResourceManager;
import net.minecraft.resources.IResourcePack;
import net.minecraft.resources.ResourcePackInfo;
import net.minecraft.resources.ResourcePackType;
import net.minecraft.resources.SimpleReloadableResourceManager;
@@ -30,13 +33,13 @@ public class AdvancementHelper implements IFutureReloadListener
return CompletableFuture.supplyAsync(() ->
{
SimpleReloadableResourceManager serverResourceManager = new SimpleReloadableResourceManager(ResourcePackType.SERVER_DATA, Thread.currentThread());
Minecraft.getInstance().getResourcePackList().getEnabledPacks().stream().map(ResourcePackInfo::getResourcePack).forEach(serverResourceManager::addResourcePack);
serverResourceManager.addReloadListener(new NetworkTagManager());
serverResourceManager.addReloadListener(this.manager);
return serverResourceManager;
}).thenCompose(stage::markCompleteAwaitingOthers).thenAcceptAsync(serverResourceManager ->
{
serverResourceManager.initialReload(backgroundExecutor, gameExecutor, CompletableFuture.completedFuture(Unit.INSTANCE));
List<IResourcePack> list = Minecraft.getInstance().getResourcePackList().getEnabledPacks().stream().map(ResourcePackInfo::getResourcePack).collect(Collectors.toList());
serverResourceManager.reloadResources(backgroundExecutor, gameExecutor, CompletableFuture.completedFuture(Unit.INSTANCE), list);
});
}

View File

@@ -0,0 +1,68 @@
package exopandora.worldhandler.util;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public abstract class Connection
{
private final Type type;
public Connection(Type type)
{
this.type = type;
}
public Type getType()
{
return this.type;
}
@OnlyIn(Dist.CLIENT)
public static enum Type
{
INTEGRATED,
DEDICATED;
}
@OnlyIn(Dist.CLIENT)
public static class IntegratedConnection extends Connection
{
private final String worldName;
private final String folderName;
public IntegratedConnection(Type type, String worldName, String folderName)
{
super(type);
this.worldName = worldName;
this.folderName = folderName;
}
public String getWorldName()
{
return this.worldName;
}
public String getFolderName()
{
return this.folderName;
}
}
@OnlyIn(Dist.CLIENT)
public static class DedicatedConnection extends Connection
{
private final ServerData data;
public DedicatedConnection(Type type, ServerData data)
{
super(type);
this.data = data;
}
public ServerData getData()
{
return this.data;
}
}
}

View File

@@ -1,6 +1,6 @@
package exopandora.worldhandler.util;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import exopandora.worldhandler.config.Config;
import net.minecraft.client.Minecraft;
@@ -25,29 +25,29 @@ public class UtilRender
float rotationHour = (360 / 12) * (hour >= 12 ? (hour - 12) : hour) - 180F;
float rotationMinute = (360 / 60) * minute - 180F;
GlStateManager.pushMatrix();
GlStateManager.translatef(width + 5, height + 5, 0F);
GlStateManager.scalef(0.25F, 0.25F, 0.25F);
RenderSystem.pushMatrix();
RenderSystem.translatef(width + 5, height + 5, 0F);
RenderSystem.scalef(0.25F, 0.25F, 0.25F);
GlStateManager.rotatef(rotationHour, 0F, 0F, 1F);
RenderSystem.rotatef(rotationHour, 0F, 0F, 1F);
Screen.fill(-1, -1, 1, 11, 0xFF383838);
GlStateManager.rotatef(-rotationHour, 0F, 0F, 1F);
RenderSystem.rotatef(-rotationHour, 0F, 0F, 1F);
GlStateManager.rotatef(rotationMinute, 0F, 0F, 1F);
RenderSystem.rotatef(rotationMinute, 0F, 0F, 1F);
Screen.fill(-1, -1, 1, 15, 0xFF6F6F6F);
GlStateManager.rotatef(-rotationMinute, 0F, 0F, 1F);
RenderSystem.rotatef(-rotationMinute, 0F, 0F, 1F);
GlStateManager.color3f(1.0F, 1.0F, 1.0F);
GlStateManager.popMatrix();
RenderSystem.color3f(1.0F, 1.0F, 1.0F);
RenderSystem.popMatrix();
GlStateManager.color3f(Config.getSkin().getButtonRedF(), Config.getSkin().getButtonGreenF(), Config.getSkin().getButtonBlueF());
RenderSystem.color3f(Config.getSkin().getButtonRedF(), Config.getSkin().getButtonGreenF(), Config.getSkin().getButtonBlueF());
Minecraft.getInstance().getTextureManager().bindTexture(ResourceHelper.getIconTexture());
gui.blit(width + 0, height, 48, 0, 10, 10);
GlStateManager.pushMatrix();
GlStateManager.scalef(0.5F, 0.5F, 0.5F);
RenderSystem.pushMatrix();
RenderSystem.scalef(0.5F, 0.5F, 0.5F);
Screen.fill((width + 5) * 2 - 1, (height + 4) * 2 + 1, (width + 6) * 2 - 1, (height + 5) * 2 + 1, 0xFF000000);
GlStateManager.popMatrix();
RenderSystem.popMatrix();
}
}