Pushed limbo code I forgot last week. :O

This commit is contained in:
Waterpicker 2020-07-11 17:51:10 -05:00
parent a638292228
commit 9d39908183
14 changed files with 145 additions and 9 deletions

View file

@ -31,6 +31,8 @@ dependencies {
modImplementation 'com.flowpowered:flow-math:1.0.3'
modImplementation 'org.jgrapht:jgrapht-core:1.1.0'
modImplementation 'com.github.DimensionalDevelopment:poly2tri.java:0.1.1'
modImplementation 'com.github.Waterpicker:OpenWorlds:1.0.0'
modRuntime 'com.github.Waterpicker:OpenWorlds:1.0.0'
}
version "4.0"

View file

@ -1,5 +1,6 @@
package org.dimdev.dimdoors;
import io.github.waterpicker.openworlds.OpenWorlds;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandler;
@ -8,6 +9,7 @@ import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback;
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener;
import net.minecraft.block.Block;
import net.minecraft.block.BlockEntityProvider;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.texture.Sprite;
@ -21,7 +23,10 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.BlockRenderView;
import org.dimdev.dimdoors.block.ModBlocks;
import org.dimdev.dimdoors.client.CustomSkyProvider;
import org.dimdev.dimdoors.client.LimboSkyProvider;
import org.dimdev.dimdoors.fluid.ModFluids;
import org.dimdev.dimdoors.world.ModDimensions;
import java.util.function.Function;
@ -36,6 +41,9 @@ public class DimensionalDoorsClientInitializer implements ClientModInitializer {
putCutout(ModBlocks.QUARTZ_DOOR);
setupFluidRendering(ModFluids.ETERNAL_FLUID, ModFluids.FLOWING_ETERNAL_FLUID, new Identifier("dimdoors:eternal_fluid"));
OpenWorlds.registerSkyRenderer(ModDimensions.POCKET_TYPE, new CustomSkyProvider());
OpenWorlds.registerSkyRenderer(ModDimensions.LIMBO_TYPE, new LimboSkyProvider());
}
private void putCutout(Block block) {
@ -51,6 +59,7 @@ public class DimensionalDoorsClientInitializer implements ClientModInitializer {
registry.register(stillSpriteId);
registry.register(flowingSpriteId);
});
BlockEntityProvider
final Identifier fluidId = Registry.FLUID.getId(still);
final Identifier listenerId = new Identifier(fluidId.getNamespace(), fluidId.getPath() + "_reload_listener");

View file

@ -0,0 +1,90 @@
package org.dimdev.dimdoors.client;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import io.github.waterpicker.openworlds.renderer.SkyRenderer;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.*;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Matrix4f;
import net.minecraft.util.math.Vec3d;
public class CustomSkyProvider implements SkyRenderer {
private static final Identifier locationEndSkyPng = new Identifier("textures/environment/end_sky.png");
public Identifier getMoonRenderPath() {
return null;
}
public Identifier getSunRenderPath() {
return null;
}
@Override
public void render(MinecraftClient client, MatrixStack matrices, float tickDelta) {
RenderSystem.disableTexture();
Vec3d vec3d = client.world.method_23777(client.gameRenderer.getCamera().getBlockPos(), tickDelta);
float f = (float)vec3d.x;
float g = (float)vec3d.y;
float h = (float)vec3d.z;
BackgroundRenderer.setFogBlack();
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
float r;
float s;
RenderSystem.enableTexture();
RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ZERO);
matrices.push();
r = 1.0F - client.world.getRainGradient(tickDelta);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, r);
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(-90.0F));
matrices.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(client.world.getSkyAngle(tickDelta) * 360.0F));
Matrix4f matrix4f2 = matrices.peek().getModel();
s = 30.0F;
client.getTextureManager().bindTexture(getSunRenderPath());
bufferBuilder.begin(7, VertexFormats.POSITION_TEXTURE);
bufferBuilder.vertex(matrix4f2, -s, 100.0F, -s).texture(0.0F, 0.0F).next();
bufferBuilder.vertex(matrix4f2, s, 100.0F, -s).texture(1.0F, 0.0F).next();
bufferBuilder.vertex(matrix4f2, s, 100.0F, s).texture(1.0F, 1.0F).next();
bufferBuilder.vertex(matrix4f2, -s, 100.0F, s).texture(0.0F, 1.0F).next();
bufferBuilder.end();
BufferRenderer.draw(bufferBuilder);
s = 20.0F;
client.getTextureManager().bindTexture(getMoonRenderPath());
bufferBuilder.begin(7, VertexFormats.POSITION_TEXTURE);
bufferBuilder.vertex(matrix4f2, -s, -100.0F, s).texture(0f, 0f).next();
bufferBuilder.vertex(matrix4f2, s, -100.0F, s).texture(1f, 0f).next();
bufferBuilder.vertex(matrix4f2, s, -100.0F, -s).texture(1f, 1f).next();
bufferBuilder.vertex(matrix4f2, -s, -100.0F, -s).texture(0f, 1f).next();
bufferBuilder.end();
BufferRenderer.draw(bufferBuilder);
RenderSystem.disableTexture();
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.disableBlend();
RenderSystem.enableAlphaTest();
RenderSystem.enableFog();
matrices.pop();
RenderSystem.disableTexture();
RenderSystem.color3f(0.0F, 0.0F, 0.0F);
if (client.world.getSkyProperties().isAlternateSkyColor()) {
RenderSystem.color3f(f * 0.2F + 0.04F, g * 0.2F + 0.04F, h * 0.6F + 0.1F);
} else {
RenderSystem.color3f(f, g, h);
}
RenderSystem.enableTexture();
RenderSystem.depthMask(true);
RenderSystem.disableFog();
}
}

View file

@ -0,0 +1,19 @@
package org.dimdev.dimdoors.client;
import net.minecraft.util.Identifier;
public class LimboSkyProvider extends CustomSkyProvider {
private static final Identifier moonRenderPath = new Identifier("dimdoors:textures/other/limbo_moon.png");
private static final Identifier sunRenderPath = new Identifier("dimdoors:textures/other/limbo_sun.png");
@Override
public Identifier getMoonRenderPath() {
return moonRenderPath;
}
@Override
public Identifier getSunRenderPath() {
return sunRenderPath;
}
}

View file

@ -18,6 +18,7 @@ public final class ModBiomes {
}
public static void init() {
// just loads the class
}
}

View file

@ -1,6 +1,5 @@
package org.dimdev.dimdoors.world;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey;
@ -14,6 +13,9 @@ public final class ModDimensions {
public static final RegistryKey<World> PUBLIC = RegistryKey.of(Registry.DIMENSION, new Identifier("dimdoors:public_pockets"));
public static final RegistryKey<World> DUNGEON = RegistryKey.of(Registry.DIMENSION, new Identifier("dimdoors:dungeon_pockets"));
public static final RegistryKey<DimensionType> LIMBO_TYPE = RegistryKey.of(Registry.DIMENSION_TYPE_KEY, new Identifier("dimdoors:limbo"));
public static final RegistryKey<DimensionType> POCKET_TYPE = RegistryKey.of(Registry.DIMENSION_TYPE_KEY, new Identifier("dimdoors:personal_pockets"));
public static boolean isDimDoorsPocketDimension(World world) {
RegistryKey<World> type = world.getRegistryKey();
return type == PERSONAL || type == PUBLIC || type == DUNGEON;
@ -24,8 +26,6 @@ public final class ModDimensions {
}
public static void init() {
ServerWorld world;
DimensionType
Registry.register(Registry.CHUNK_GENERATOR, new Identifier("dimdoors", "blank"), BlankChunkGenerator.CODEC);
// just loads the class
}

View file

@ -24,7 +24,6 @@ public final class TeleportUtil {
(ServerWorld) world,
(e, serverWorld, direction, v, v1) -> new BlockPattern.TeleportTarget(pos, e.getVelocity(), (int) (e.yaw + yawOffset))
);
entity.setOnFireFor(0); // Workaround for https://bugs.mojang.com/browse/MC-100097
}
}

View file

@ -6,5 +6,5 @@
"biome": "dimdoors:dangerous_black_void"
}
},
"type": "dimdoors:void"
"type": "dimdoors:pocket"
}

View file

@ -6,5 +6,5 @@
"biome": "dimdoors:black_void"
}
},
"type": "dimdoors:void"
"type": "dimdoors:limbo"
}

View file

@ -6,5 +6,5 @@
"biome": "dimdoors:white_void"
}
},
"type": "dimdoors:void"
"type": "dimdoors:pocket"
}

View file

@ -6,5 +6,5 @@
"biome": "dimdoors:black_void"
}
},
"type": "dimdoors:void"
"type": "dimdoors:pocket"
}

View file

@ -0,0 +1,15 @@
{
"ultrawarm": false,
"natural": false,
"shrunk": false,
"ambient_light": 0.1,
"has_skylight": true,
"has_ceiling": false,
"infiniburn": "minecraft:infiniburn_overworld",
"logical_height" : 256,
"has_raids" : false,
"respawn_anchor_works": false,
"bed_works" : false,
"piglin_safe" : false,
"fixed_time" : 6000
}

View file

@ -33,6 +33,7 @@
],
"depends": {
"fabricloader": ">=0.4.0",
"fabric": "*"
"fabric": "*",
"openworlds": "*"
}
}