Merge pull request #160 from BoogieMonster1O1/1.16

Update to 1.16.2, more world gen changes
This commit is contained in:
Waterpicker 2020-08-20 12:46:14 -05:00 committed by GitHub
commit 27304f3b06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
67 changed files with 1411 additions and 752 deletions

4
.gitignore vendored
View file

@ -26,4 +26,6 @@ build
run
.DS_Store
Thumbs.db
remappedSrc
remappedSrc
logs
*.hprof

View file

@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.4-SNAPSHOT'
id 'fabric-loom' version '0.5-SNAPSHOT'
id 'com.github.johnrengelman.shadow' version '6.0.0'
}
@ -18,15 +18,15 @@ dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modApi "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
implementation 'com.flowpowered:flow-math:1.0.3'
shadow 'com.flowpowered:flow-math:1.0.3'
implementation 'org.jgrapht:jgrapht-core:1.1.0'
shadow 'org.jgrapht:jgrapht-core:1.1.0'
implementation 'com.github.DimensionalDevelopment:poly2tri.java:0.1.1'
shadow 'com.github.DimensionalDevelopment:poly2tri.java:0.1.1'
modImplementation 'com.github.Waterpicker:OpenWorlds:1.0.0'
include 'com.github.Waterpicker:OpenWorlds:1.0.0'
//modImplementation 'com.github.Waterpicker:OpenWorlds:1.0.0'
//include 'com.github.Waterpicker:OpenWorlds:1.0.0'
compileOnly 'com.google.code.findbugs:jsr305:+'
}

View file

@ -1,5 +1,5 @@
minecraft_version=1.16.1
yarn_mappings=1.16.1+build.21
loader_version=0.9.0+build.204
minecraft_version=1.16.2
yarn_mappings=1.16.2+build.9
loader_version=0.9.1+build.205
fabric_version=0.15.1+build.380-1.16.1
fabric_version=0.18.0+build.397-1.16

Binary file not shown.

View file

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-all.zip

53
gradlew vendored
View file

@ -1,5 +1,21 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@ -66,6 +82,7 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@ -109,10 +126,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
@ -138,19 +156,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
@ -159,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

22
gradlew.bat vendored
View file

@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@ -65,6 +84,7 @@ set CMD_LINE_ARGS=%*
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

View file

@ -1 +0,0 @@
[23:07:02] [main/ERROR]: Unable to bootstrap registry 'minecraft:sound_event'

View file

@ -5,8 +5,8 @@ import com.mojang.serialization.Dynamic;
import com.mojang.serialization.JsonOps;
import org.dimdev.dimdoors.util.RotatedLocation;
import net.minecraft.datafixer.NbtOps;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtOps;
import net.minecraft.nbt.Tag;
public final class AnnotatedNbt {

View file

@ -1,7 +1,12 @@
package org.dimdev.dimcore.schematic;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -13,7 +18,11 @@ import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.FluidState;
import net.minecraft.nbt.*;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.DoubleTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.StringTag;
import net.minecraft.nbt.Tag;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.Property;
@ -327,7 +336,7 @@ public class Schematic implements BlockView {
}
}
for (Entity entity : world.getEntities((Entity) null, getBoundingBox(from, to), entity -> !(entity instanceof PlayerEntity))) {
for (Entity entity : world.getOtherEntities((Entity) null, getBoundingBox(from, to), entity -> !(entity instanceof PlayerEntity))) {
CompoundTag entityTag = entity.toTag(new CompoundTag());
ListTag posTag = (ListTag) entityTag.get("Pos");

View file

@ -5,11 +5,22 @@ import org.dimdev.dimdoors.block.entity.ModBlockEntityTypes;
import org.dimdev.dimdoors.command.ModCommands;
import org.dimdev.dimdoors.entity.ModEntityTypes;
import org.dimdev.dimdoors.item.ModItems;
import org.dimdev.dimdoors.rift.targets.*;
import org.dimdev.dimdoors.rift.targets.EscapeTarget;
import org.dimdev.dimdoors.rift.targets.GlobalReference;
import org.dimdev.dimdoors.rift.targets.LimboTarget;
import org.dimdev.dimdoors.rift.targets.LocalReference;
import org.dimdev.dimdoors.rift.targets.PocketEntranceMarker;
import org.dimdev.dimdoors.rift.targets.PocketExitMarker;
import org.dimdev.dimdoors.rift.targets.PrivatePocketExitTarget;
import org.dimdev.dimdoors.rift.targets.PrivatePocketTarget;
import org.dimdev.dimdoors.rift.targets.PublicPocketTarget;
import org.dimdev.dimdoors.rift.targets.RandomTarget;
import org.dimdev.dimdoors.rift.targets.RelativeReference;
import org.dimdev.dimdoors.rift.targets.Targets;
import org.dimdev.dimdoors.rift.targets.VirtualTarget;
import org.dimdev.dimdoors.sound.ModSoundEvents;
import org.dimdev.dimdoors.world.ModBiomes;
import org.dimdev.dimdoors.world.ModDimensions;
import org.dimdev.dimdoors.world.ModFeatures;
import net.minecraft.util.Identifier;
@ -26,7 +37,6 @@ public class DimensionalDoorsInitializer implements ModInitializer {
ModDimensions.init();
ModEntityTypes.init();
ModBiomes.init();
ModFeatures.init();
ModBlockEntityTypes.init();
ModCommands.init();
ModSoundEvents.init();

View file

@ -44,16 +44,22 @@ public class DetachedRiftBlockEntity extends RiftBlockEntity implements Tickable
@Override
public void tick() {
if (world == null) {
return;
}
if (world.getBlockState(pos).getBlock() != ModBlocks.DETACHED_RIFT) {
markInvalid();
return;
}
if (!world.isClient && random.nextDouble() < ModConfig.GENERAL.endermanSpawnChance) {
EndermanEntity enderman = EntityType.ENDERMAN.spawn(world, null, null, null, pos, SpawnReason.STRUCTURE, false, false);
if (!world.isClient() && random.nextDouble() < ModConfig.GENERAL.endermanSpawnChance) {
EndermanEntity enderman = EntityType.ENDERMAN.spawn((ServerWorld) world, null, null, null, pos, SpawnReason.STRUCTURE, false, false);
if (random.nextDouble() < ModConfig.GENERAL.endermanAggressiveChance) {
enderman.setTarget(world.getClosestPlayer(enderman, 50));
if (enderman != null) {
enderman.setTarget(world.getClosestPlayer(enderman, 50));
}
}
}

View file

@ -11,10 +11,14 @@ import org.dimdev.dimdoors.pockets.PocketTemplate;
import org.dimdev.dimdoors.rift.registry.LinkProperties;
import org.dimdev.dimdoors.rift.registry.Rift;
import org.dimdev.dimdoors.rift.registry.RiftRegistry;
import org.dimdev.dimdoors.rift.targets.*;
import org.dimdev.dimdoors.world.pocket.VirtualLocation;
import org.dimdev.dimdoors.rift.targets.EntityTarget;
import org.dimdev.dimdoors.rift.targets.MessageTarget;
import org.dimdev.dimdoors.rift.targets.Target;
import org.dimdev.dimdoors.rift.targets.Targets;
import org.dimdev.dimdoors.rift.targets.VirtualTarget;
import org.dimdev.dimdoors.util.EntityUtils;
import org.dimdev.dimdoors.util.Location;
import org.dimdev.dimdoors.world.pocket.VirtualLocation;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;

View file

@ -1,121 +1,121 @@
package org.dimdev.dimdoors.client;
import io.github.waterpicker.openworlds.renderer.SkyRenderer;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.BufferRenderer;
import net.minecraft.client.render.Tessellator;
import net.minecraft.client.render.VertexFormats;
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.Vec3i;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@Environment(EnvType.CLIENT)
public class CustomSkyProvider implements SkyRenderer {
private final Identifier moon;
private final Identifier sun;
private final Vec3i color;
public CustomSkyProvider(Identifier moon, Identifier sun, Vec3i color) {
this.moon = moon;
this.sun = sun;
this.color = color;
}
@Override
public void render(MinecraftClient client, MatrixStack matrices, float tickDelta) {
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
RenderSystem.disableAlphaTest();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.depthMask(false);
matrices.push();
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(-90.0F));
Matrix4f matrix4f2 = matrices.peek().getModel();
float s = 30.0F;
client.getTextureManager().bindTexture(sun);
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);
client.getTextureManager().bindTexture(moon);
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);
matrices.pop();
RenderSystem.depthMask(true);
RenderSystem.enableTexture();
RenderSystem.disableBlend();
RenderSystem.enableAlphaTest();
renderSkyBox(matrices);
}
private void renderSkyBox(MatrixStack matrices) {
RenderSystem.disableAlphaTest();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.depthMask(false);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = tessellator.getBuffer();
for (int i = 0; i < 6; ++i) {
matrices.push();
if (i == 1) {
matrices.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(90.0F));
}
if (i == 2) {
matrices.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-90.0F));
}
if (i == 3) {
matrices.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(180.0F));
}
if (i == 4) {
matrices.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(90.0F));
}
if (i == 5) {
matrices.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(-90.0F));
}
Matrix4f matrix4f = matrices.peek().getModel();
bufferBuilder.begin(7, VertexFormats.POSITION_COLOR);
bufferBuilder.vertex(matrix4f, -100.0F, -100.0F, -100.0F).color(color.getX(), color.getY(), color.getZ(), 255).next();
bufferBuilder.vertex(matrix4f, -100.0F, -100.0F, 100.0F).color(color.getX(), color.getY(), color.getZ(), 255).next();
bufferBuilder.vertex(matrix4f, 100.0F, -100.0F, 100.0F).color(color.getX(), color.getY(), color.getZ(), 255).next();
bufferBuilder.vertex(matrix4f, 100.0F, -100.0F, -100.0F).color(color.getX(), color.getY(), color.getZ(), 255).next();
tessellator.draw();
matrices.pop();
}
RenderSystem.depthMask(true);
RenderSystem.enableTexture();
RenderSystem.disableBlend();
RenderSystem.enableAlphaTest();
}
}
//package org.dimdev.dimdoors.client;
//
////import io.github.waterpicker.openworlds.renderer.SkyRenderer;
//
//import com.mojang.blaze3d.systems.RenderSystem;
//
//import net.minecraft.client.MinecraftClient;
//import net.minecraft.client.render.BufferBuilder;
//import net.minecraft.client.render.BufferRenderer;
//import net.minecraft.client.render.Tessellator;
//import net.minecraft.client.render.VertexFormats;
//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.Vec3i;
//
//import net.fabricmc.api.EnvType;
//import net.fabricmc.api.Environment;
//
//@Environment(EnvType.CLIENT)
//public class CustomSkyProvider implements SkyRenderer {
// private final Identifier moon;
// private final Identifier sun;
// private final Vec3i color;
//
// public CustomSkyProvider(Identifier moon, Identifier sun, Vec3i color) {
// this.moon = moon;
// this.sun = sun;
// this.color = color;
// }
//
// @Override
// public void render(MinecraftClient client, MatrixStack matrices, float tickDelta) {
// BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
// RenderSystem.disableAlphaTest();
// RenderSystem.enableBlend();
// RenderSystem.defaultBlendFunc();
// RenderSystem.depthMask(false);
//
// matrices.push();
//
// matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(-90.0F));
// Matrix4f matrix4f2 = matrices.peek().getModel();
//
// float s = 30.0F;
// client.getTextureManager().bindTexture(sun);
// 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);
//
// client.getTextureManager().bindTexture(moon);
// 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);
//
// matrices.pop();
//
// RenderSystem.depthMask(true);
// RenderSystem.enableTexture();
// RenderSystem.disableBlend();
// RenderSystem.enableAlphaTest();
//
// renderSkyBox(matrices);
// }
//
// private void renderSkyBox(MatrixStack matrices) {
// RenderSystem.disableAlphaTest();
// RenderSystem.enableBlend();
// RenderSystem.defaultBlendFunc();
// RenderSystem.depthMask(false);
// Tessellator tessellator = Tessellator.getInstance();
// BufferBuilder bufferBuilder = tessellator.getBuffer();
//
// for (int i = 0; i < 6; ++i) {
// matrices.push();
// if (i == 1) {
// matrices.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(90.0F));
// }
//
// if (i == 2) {
// matrices.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-90.0F));
// }
//
// if (i == 3) {
// matrices.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(180.0F));
// }
//
// if (i == 4) {
// matrices.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(90.0F));
// }
//
// if (i == 5) {
// matrices.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(-90.0F));
// }
//
// Matrix4f matrix4f = matrices.peek().getModel();
// bufferBuilder.begin(7, VertexFormats.POSITION_COLOR);
// bufferBuilder.vertex(matrix4f, -100.0F, -100.0F, -100.0F).color(color.getX(), color.getY(), color.getZ(), 255).next();
// bufferBuilder.vertex(matrix4f, -100.0F, -100.0F, 100.0F).color(color.getX(), color.getY(), color.getZ(), 255).next();
// bufferBuilder.vertex(matrix4f, 100.0F, -100.0F, 100.0F).color(color.getX(), color.getY(), color.getZ(), 255).next();
// bufferBuilder.vertex(matrix4f, 100.0F, -100.0F, -100.0F).color(color.getX(), color.getY(), color.getZ(), 255).next();
// tessellator.draw();
// matrices.pop();
// }
//
// RenderSystem.depthMask(true);
// RenderSystem.enableTexture();
// RenderSystem.disableBlend();
// RenderSystem.enableAlphaTest();
// }
//
//}

View file

@ -15,7 +15,7 @@ import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import org.dimdev.dimdoors.block.ModBlocks;
import org.dimdev.dimdoors.block.entity.RiftBlockEntity;
import org.dimdev.dimdoors.mixin.DirectionMixin;
import org.dimdev.dimdoors.mixin.DirectionAccessor;
import org.dimdev.dimdoors.util.RGBA;
import org.lwjgl.opengl.GL11;
@ -55,7 +55,7 @@ public final class DimensionalPortalRenderer {
private static final Identifier warpPath = new Identifier("dimdoors:textures/other/warp.png");
private static final BooleanProperty openProperty = BooleanProperty.of("open");
private static final EnumProperty<DoorHinge> hingeProperty = EnumProperty.of("hinge", DoorHinge.class);
private static final DirectionProperty facingProperty = DirectionProperty.of("facing", Arrays.asList(DirectionMixin.getHorizontal()));
private static final DirectionProperty facingProperty = DirectionProperty.of("facing", Arrays.asList(DirectionAccessor.getHorizontal()));
private static final TextureManager textureManager = MinecraftClient.getInstance().getTextureManager();
private static final BlockModels blockModelShapes = MinecraftClient.getInstance().getBlockRenderManager().getModels();

View file

@ -1,14 +1,14 @@
package org.dimdev.dimdoors.client;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Vec3i;
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");
public LimboSkyProvider() {
super(moonRenderPath, sunRenderPath, new Vec3i(255, 255, 255));
}
}
//package org.dimdev.dimdoors.client;
//
//import net.minecraft.util.Identifier;
//import net.minecraft.util.math.Vec3i;
//
//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");
//
// public LimboSkyProvider() {
// super(moonRenderPath, sunRenderPath, new Vec3i(255, 255, 255));
// }
//}

View file

@ -1,11 +1,8 @@
package org.dimdev.dimdoors.client;
import io.github.waterpicker.openworlds.OpenWorlds;
import java.util.function.Function;
import org.dimdev.dimdoors.fluid.ModFluids;
import org.dimdev.dimdoors.world.ModDimensions;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.texture.Sprite;
@ -16,7 +13,6 @@ import net.minecraft.resource.ResourceManager;
import net.minecraft.resource.ResourceType;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.BlockRenderView;
@ -31,10 +27,10 @@ import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener;
@Environment(EnvType.CLIENT)
public class ModRendering {
public static void initClient() {
OpenWorlds.registerSkyRenderer(ModDimensions.POCKET_TYPE, new CustomSkyProvider(null, null, new Vec3i(0, 0, 0)));
OpenWorlds.registerSkyRenderer(ModDimensions.LIMBO_TYPE, new LimboSkyProvider());
OpenWorlds.registerCloudRenderer(ModDimensions.LIMBO_TYPE, (minecraftClient, matrixStack, v, v1, v2, v3) -> {
});
// OpenWorlds.registerSkyRenderer(ModDimensions.POCKET_TYPE, new CustomSkyProvider(null, null, new Vec3i(0, 0, 0)));
// OpenWorlds.registerSkyRenderer(ModDimensions.LIMBO_TYPE, new LimboSkyProvider());
// OpenWorlds.registerCloudRenderer(ModDimensions.LIMBO_TYPE, (minecraftClient, matrixStack, v, v1, v2, v3) -> {
// });
setupFluidRendering(ModFluids.ETERNAL_FLUID, ModFluids.FLOWING_ETERNAL_FLUID, new Identifier("dimdoors:eternal_fluid"));
}

View file

@ -1,6 +1,10 @@
package org.dimdev.dimdoors.client;
import java.util.*;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import org.poly2tri.Poly2Tri;
import org.poly2tri.geometry.polygon.Polygon;

View file

@ -4,8 +4,8 @@ package org.dimdev.dimdoors.command;
import com.mojang.brigadier.CommandDispatcher;
import org.dimdev.dimdoors.util.TeleportUtil;
import net.minecraft.command.arguments.DimensionArgumentType;
import net.minecraft.command.arguments.Vec3ArgumentType;
import net.minecraft.command.argument.DimensionArgumentType;
import net.minecraft.command.argument.Vec3ArgumentType;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;

View file

@ -12,10 +12,10 @@ import org.dimdev.dimdoors.pockets.PocketTemplate;
import org.dimdev.dimdoors.pockets.SchematicHandler;
import org.dimdev.dimdoors.rift.registry.RiftRegistry;
import org.dimdev.dimdoors.rift.targets.EntityTarget;
import org.dimdev.dimdoors.world.ModDimensions;
import org.dimdev.dimdoors.world.pocket.Pocket;
import org.dimdev.dimdoors.util.Location;
import org.dimdev.dimdoors.util.TeleportUtil;
import org.dimdev.dimdoors.world.ModDimensions;
import org.dimdev.dimdoors.world.pocket.Pocket;
import net.minecraft.command.CommandException;
import net.minecraft.server.command.CommandManager;

View file

@ -8,7 +8,11 @@ import org.dimdev.dimdoors.item.ModItems;
import org.dimdev.dimdoors.sound.ModSoundEvents;
import org.dimdev.dimdoors.world.ModDimensions;
import net.minecraft.entity.*;
import net.minecraft.entity.EntityDimensions;
import net.minecraft.entity.EntityPose;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.MovementType;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.ai.control.LookControl;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.data.DataTracker;
@ -21,7 +25,6 @@ import net.minecraft.network.PacketByteBuf;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.sound.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
@ -95,15 +98,15 @@ public class MonolithEntity extends MobEntity {
return 10;
}
@Override
public Box getCollisionBox() {
return null;
}
@Override
public Box getHardCollisionBox(Entity entity) {
return null;
}
// @Override
// public Box getCollisionBox() {
// return null;
// }
//
// @Override
// public Box getHardCollisionBox(Entity entity) {
// return null;
// }
@Override
public boolean cannotDespawn() {
@ -148,16 +151,16 @@ public class MonolithEntity extends MobEntity {
public void updateAggroLevel(PlayerEntity player, boolean visibility) {
// If we're working on the server side, adjust aggro level
// If we're working on the client side, retrieve aggro level from dataWatcher
if(player == null) {
if (player == null) {
return;
}
if((player.inventory.armor.get(0).getItem() == ModItems.WORLD_THREAD_HELMET && player.inventory.armor.get(1).getItem() == ModItems.WORLD_THREAD_CHESTPLATE && player.inventory.armor.get(2).getItem() == ModItems.WORLD_THREAD_LEGGINGS && player.inventory.armor.get(3).getItem() == ModItems.WORLD_THREAD_BOOTS)) {
if ((player.inventory.armor.get(0).getItem() == ModItems.WORLD_THREAD_HELMET && player.inventory.armor.get(1).getItem() == ModItems.WORLD_THREAD_CHESTPLATE && player.inventory.armor.get(2).getItem() == ModItems.WORLD_THREAD_LEGGINGS && player.inventory.armor.get(3).getItem() == ModItems.WORLD_THREAD_BOOTS)) {
return;
}
if (!world.isClient) {
if(player.distanceTo(this) > 70) {
if (player.distanceTo(this) > 70) {
return;
}
@ -233,7 +236,7 @@ public class MonolithEntity extends MobEntity {
int aggro = data.readInt();
context.getTaskQueue().execute(() -> {
if(aggro < 120) {
if (aggro < 120) {
return;
}
int count = 10 * aggro / MAX_AGGRO;

View file

@ -38,7 +38,7 @@ public class MonolithTask extends Goal {
private PlayerEntity getTarget() {
PlayerEntity playerEntity = this.mob.world.getClosestPlayer(this.targetPredicate, this.mob, this.mob.getX(), this.mob.getEyeY(), this.mob.getZ());
return playerEntity != null && mob.canSee(playerEntity) && playerEntity.distanceTo(this.mob) < 50? playerEntity : null;
return playerEntity != null && mob.canSee(playerEntity) && playerEntity.distanceTo(this.mob) < 50 ? playerEntity : null;
}
public boolean canStart() {
@ -58,16 +58,16 @@ public class MonolithTask extends Goal {
}
public void tick() {
if(target != null && this.target.distanceTo(this.mob) > 70) {
if (target != null && this.target.distanceTo(this.mob) > 70) {
this.stop();
return;
}
if(target != null && (target.inventory.armor.get(0).getItem() == ModItems.WORLD_THREAD_HELMET && target.inventory.armor.get(1).getItem() == ModItems.WORLD_THREAD_CHESTPLATE && target.inventory.armor.get(2).getItem() == ModItems.WORLD_THREAD_LEGGINGS && target.inventory.armor.get(3).getItem() == ModItems.WORLD_THREAD_BOOTS)) {
if (target != null && (target.inventory.armor.get(0).getItem() == ModItems.WORLD_THREAD_HELMET && target.inventory.armor.get(1).getItem() == ModItems.WORLD_THREAD_CHESTPLATE && target.inventory.armor.get(2).getItem() == ModItems.WORLD_THREAD_LEGGINGS && target.inventory.armor.get(3).getItem() == ModItems.WORLD_THREAD_BOOTS)) {
Random random = new Random();
int i = random.nextInt(64);
if(this.target instanceof ServerPlayerEntity) {
if(i < 6) {
if (this.target instanceof ServerPlayerEntity) {
if (i < 6) {
target.inventory.armor.get(0).damage(i, random, (ServerPlayerEntity) this.target);
target.inventory.armor.get(1).damage(i, random, (ServerPlayerEntity) this.target);
target.inventory.armor.get(2).damage(i, random, (ServerPlayerEntity) this.target);

View file

@ -1,14 +0,0 @@
package org.dimdev.dimdoors.item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
public final class ModItemGroups {
public static final ItemGroup DIMENSIONAL_DOORS = FabricItemGroupBuilder
.create(new Identifier("dimdoors", "dimensional_doors"))
.icon(() -> new ItemStack(ModItems.IRON_DIMENSIONAL_DOOR))
.build();
}

View file

@ -7,21 +7,36 @@ import java.util.HashSet;
import org.dimdev.dimdoors.block.ModBlocks;
import org.dimdev.dimdoors.fluid.ModFluids;
import org.dimdev.dimdoors.rift.registry.LinkProperties;
import org.dimdev.dimdoors.rift.targets.*;
import org.dimdev.dimdoors.rift.targets.EscapeTarget;
import org.dimdev.dimdoors.rift.targets.PrivatePocketExitTarget;
import org.dimdev.dimdoors.rift.targets.PrivatePocketTarget;
import org.dimdev.dimdoors.rift.targets.PublicPocketTarget;
import org.dimdev.dimdoors.rift.targets.RandomTarget;
import org.dimdev.dimdoors.sound.ModSoundEvents;
import org.dimdev.dimdoors.world.ModDimensions;
import net.minecraft.block.Block;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.*;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.BlockItem;
import net.minecraft.item.BucketItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import static org.dimdev.dimdoors.item.ModItemGroups.DIMENSIONAL_DOORS;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
@SuppressWarnings("unused")
public final class ModItems {
public static final ItemGroup DIMENSIONAL_DOORS = FabricItemGroupBuilder
.create(new Identifier("dimdoors", "dimensional_doors"))
.icon(() -> new ItemStack(ModItems.IRON_DIMENSIONAL_DOOR))
.build();
public static final Item QUARTZ_DOOR = register(ModBlocks.QUARTZ_DOOR);
public static final Item QUARTZ_DIMENSIONAL_DOOR = register(new DimensionalDoorItem(
ModBlocks.QUARTZ_DIMENSIONAL_DOOR,

View file

@ -28,7 +28,7 @@ public class RiftConfigurationToolItem extends Item {
public static final String ID = "rift_configuration_tool";
RiftConfigurationToolItem() {
super(new Item.Settings().group(ModItemGroups.DIMENSIONAL_DOORS).maxCount(1).maxDamage(16));
super(new Item.Settings().group(ModItems.DIMENSIONAL_DOORS).maxCount(1).maxDamage(16));
}
@Override

View file

@ -0,0 +1,16 @@
package org.dimdev.dimdoors.mixin;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BuiltinBiomes;
@Mixin(BuiltinBiomes.class)
public interface BuiltinBiomesAccessor {
@Invoker
static Biome invokeRegister(int rawId, RegistryKey<Biome> registryKey, Biome biome) {
throw new AssertionError();
}
}

View file

@ -6,7 +6,7 @@ import org.spongepowered.asm.mixin.gen.Accessor;
import net.minecraft.util.math.Direction;
@Mixin(Direction.class)
public interface DirectionMixin {
public interface DirectionAccessor {
@Accessor("HORIZONTAL")
static Direction[] getHorizontal() {
throw new AssertionError();

View file

@ -1,7 +1,7 @@
package org.dimdev.dimdoors.mixin;
package org.dimdev.dimdoors.mixin.client;
import com.mojang.blaze3d.systems.RenderSystem;
import org.dimdev.dimdoors.world.limbo.LimboBiome;
import org.dimdev.dimdoors.world.ModBiomes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@ -18,7 +18,7 @@ import net.fabricmc.api.Environment;
public class InGameHudMixin {
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;getTextureManager()Lnet/minecraft/client/texture/TextureManager;"), method = "renderVignetteOverlay(Lnet/minecraft/entity/Entity;)V")
public void renderVignetteOverlay(Entity entity, CallbackInfo info) {
if (entity.getEntityWorld().getBiome(entity.getBlockPos()) instanceof LimboBiome) {
if (entity.world.getBiome(entity.getBlockPos()) == ModBiomes.LIMBO_BIOME) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
}
}

View file

@ -17,10 +17,10 @@ import org.dimdev.dimdoors.rift.registry.RiftRegistry;
import org.dimdev.dimdoors.rift.targets.PocketEntranceMarker;
import org.dimdev.dimdoors.rift.targets.PocketExitMarker;
import org.dimdev.dimdoors.rift.targets.VirtualTarget;
import org.dimdev.dimdoors.world.pocket.Pocket;
import org.dimdev.dimdoors.world.pocket.PocketRegistry;
import org.dimdev.dimdoors.util.Location;
import org.dimdev.dimdoors.util.math.MathUtil;
import org.dimdev.dimdoors.world.pocket.Pocket;
import org.dimdev.dimdoors.world.pocket.PocketRegistry;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;

View file

@ -1,11 +1,26 @@
package org.dimdev.dimdoors.pockets;
import java.io.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.AbstractMap.SimpleEntry;
import java.util.*;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.stream.Collectors;
import com.google.gson.JsonArray;

View file

@ -1,15 +1,20 @@
package org.dimdev.dimdoors.rift.registry;
import java.util.*;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dimdev.dimdoors.util.GraphUtils;
import org.dimdev.dimdoors.util.Location;
import org.dimdev.dimdoors.world.pocket.Pocket;
import org.dimdev.dimdoors.world.pocket.PocketRegistry;
import org.dimdev.dimdoors.world.pocket.PrivatePocketData;
import org.dimdev.dimdoors.util.GraphUtils;
import org.dimdev.dimdoors.util.Location;
import org.jgrapht.graph.DefaultDirectedGraph;
import org.jgrapht.graph.DefaultEdge;

View file

@ -4,17 +4,16 @@ import java.util.UUID;
import org.dimdev.dimdoors.block.entity.RiftBlockEntity;
import org.dimdev.dimdoors.rift.registry.RiftRegistry;
import org.dimdev.dimdoors.world.ModDimensions;
import org.dimdev.dimdoors.world.pocket.VirtualLocation;
import org.dimdev.dimdoors.util.Location;
import org.dimdev.dimdoors.util.TeleportUtil;
import org.dimdev.dimdoors.world.ModDimensions;
import org.dimdev.dimdoors.world.pocket.VirtualLocation;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.TranslatableText;
import net.fabricmc.fabric.api.dimension.v1.FabricDimensions;
import static org.dimdev.dimdoors.util.EntityUtils.chat;
public class EscapeTarget extends VirtualTarget implements EntityTarget { // TODO: createRift option
@ -59,7 +58,7 @@ public class EscapeTarget extends VirtualTarget implements EntityTarget { // TOD
} else {
chat(entity, new TranslatableText("rifts.destinations.escape.rift_has_closed"));
}
FabricDimensions.teleport(entity, entity.getServer().getWorld(ModDimensions.LIMBO));
//FabricDimensions.teleport(entity, entity.getServer().getWorld(ModDimensions.LIMBO));
return true;
}
} else {

View file

@ -3,9 +3,6 @@ package org.dimdev.dimdoors.rift.targets;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.CompoundTag;
import net.fabricmc.fabric.api.dimension.v1.FabricDimensions;
import static org.dimdev.dimdoors.world.ModDimensions.LIMBO;
public class LimboTarget extends VirtualTarget implements EntityTarget {
public LimboTarget() {
}
@ -23,7 +20,7 @@ public class LimboTarget extends VirtualTarget implements EntityTarget {
@Override
public boolean receiveEntity(Entity entity, float yawOffset) {
FabricDimensions.teleport(entity, entity.getServer().getWorld(LIMBO));
//FabricDimensions.teleport(entity, entity.getServer().getWorld(LIMBO));
return true;
}
}

View file

@ -4,18 +4,18 @@ import java.util.UUID;
import org.dimdev.dimdoors.block.entity.RiftBlockEntity;
import org.dimdev.dimdoors.rift.registry.RiftRegistry;
import org.dimdev.dimdoors.util.EntityUtils;
import org.dimdev.dimdoors.util.Location;
import org.dimdev.dimdoors.world.ModDimensions;
import org.dimdev.dimdoors.world.pocket.Pocket;
import org.dimdev.dimdoors.world.pocket.PocketRegistry;
import org.dimdev.dimdoors.world.pocket.PrivatePocketData;
import org.dimdev.dimdoors.util.EntityUtils;
import org.dimdev.dimdoors.util.Location;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.text.TranslatableText;
import net.fabricmc.fabric.api.dimension.v1.FabricDimensions;
//import net.fabricmc.fabric.api.dimension.v1.FabricDimensions;
public class PrivatePocketExitTarget extends VirtualTarget implements EntityTarget {
public PrivatePocketExitTarget() {
@ -49,7 +49,7 @@ public class PrivatePocketExitTarget extends VirtualTarget implements EntityTarg
} else {
EntityUtils.chat(entity, new TranslatableText("rifts.destinations.private_pocket_exit.rift_has_closed"));
}
FabricDimensions.teleport(entity, entity.getServer().getWorld(ModDimensions.LIMBO));
//FabricDimensions.teleport(entity, entity.getServer().getWorld(ModDimensions.LIMBO));
return false;
} else {
((EntityTarget) destLoc.getBlockEntity()).receiveEntity(entity, yawOffset);

View file

@ -6,11 +6,11 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dimdev.dimdoors.pockets.PocketGenerator;
import org.dimdev.dimdoors.rift.registry.RiftRegistry;
import org.dimdev.dimdoors.util.EntityUtils;
import org.dimdev.dimdoors.util.Location;
import org.dimdev.dimdoors.world.pocket.Pocket;
import org.dimdev.dimdoors.world.pocket.PrivatePocketData;
import org.dimdev.dimdoors.world.pocket.VirtualLocation;
import org.dimdev.dimdoors.util.EntityUtils;
import org.dimdev.dimdoors.util.Location;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.Entity;

View file

@ -2,9 +2,9 @@ package org.dimdev.dimdoors.rift.targets;
import org.dimdev.dimdoors.pockets.PocketGenerator;
import org.dimdev.dimdoors.rift.registry.RiftRegistry;
import org.dimdev.dimdoors.util.Location;
import org.dimdev.dimdoors.world.pocket.Pocket;
import org.dimdev.dimdoors.world.pocket.VirtualLocation;
import org.dimdev.dimdoors.util.Location;
import net.minecraft.nbt.CompoundTag;

View file

@ -14,10 +14,10 @@ import org.dimdev.dimdoors.pockets.PocketGenerator;
import org.dimdev.dimdoors.rift.registry.LinkProperties;
import org.dimdev.dimdoors.rift.registry.Rift;
import org.dimdev.dimdoors.rift.registry.RiftRegistry;
import org.dimdev.dimdoors.world.pocket.Pocket;
import org.dimdev.dimdoors.world.pocket.VirtualLocation;
import org.dimdev.dimdoors.util.Location;
import org.dimdev.dimdoors.util.math.MathUtil;
import org.dimdev.dimdoors.world.pocket.Pocket;
import org.dimdev.dimdoors.world.pocket.VirtualLocation;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.world.ServerWorld;

View file

@ -0,0 +1,43 @@
package org.dimdev.dimdoors.util;
import org.dimdev.dimdoors.sound.ModSoundEvents;
import net.minecraft.block.Blocks;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeEffects;
import net.minecraft.world.biome.GenerationSettings;
import net.minecraft.world.biome.SpawnSettings;
import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder;
import net.minecraft.world.gen.surfacebuilder.TernarySurfaceConfig;
public class BlankBiomeBuilder extends Biome.Builder {
private final boolean white;
private final boolean dangerous;
public BlankBiomeBuilder(boolean white, boolean dangerous) {
this.white = white;
this.dangerous = dangerous;
this.generationSettings(new GenerationSettings.Builder().surfaceBuilder(SurfaceBuilder.DEFAULT.method_30478(new TernarySurfaceConfig(Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), Blocks.VOID_AIR.getDefaultState()))).build())
.precipitation(Biome.Precipitation.NONE)
.category(Biome.Category.NONE)
.depth(0.0F)
.temperatureModifier(Biome.TemperatureModifier.NONE)
.downfall(0.0F)
.effects(this.createEffect())
.scale(0)
.temperature(0.8f)
.temperatureModifier(null)
.spawnSettings(new SpawnSettings.Builder().build());
}
private BiomeEffects createEffect() {
BiomeEffects.Builder builder = new BiomeEffects.Builder()
.waterColor(this.white ? 0xFFFFFF : 0x000000)
.waterFogColor(this.white ? 0xFFFFFF : 0x000000)
.fogColor(this.white ? 0xFFFFFF : 0x000000)
.skyColor(this.white ? 0xFFFFFF : 0x808080)
.grassColorModifier(BiomeEffects.GrassColorModifier.NONE);
// if (this.white) builder.loopSound(ModSoundEvents.WHITE_VOID);
return builder.build();
}
}

View file

@ -1,14 +1,11 @@
package org.dimdev.dimdoors.util;
import net.minecraft.block.pattern.BlockPattern;
import net.minecraft.entity.Entity;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.fabricmc.fabric.api.dimension.v1.FabricDimensions;
public final class TeleportUtil {
public static void teleport(Entity entity, World world, BlockPos pos, int yawOffset) {
@ -16,19 +13,19 @@ public final class TeleportUtil {
}
public static void teleport(Entity entity, World world, Vec3d pos, float yawOffset) {
if (entity.world.getRegistryKey().equals(world.getRegistryKey())) {
entity.setPos(pos.x, pos.y, pos.z);
entity.setYaw(entity.yaw + yawOffset);
} else {
if (world instanceof ServerWorld) {
FabricDimensions.teleport(
entity,
(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
}
}
// if (entity.world.getRegistryKey().equals(world.getRegistryKey())) {
// entity.setPos(pos.x, pos.y, pos.z);
// entity.setYaw(entity.yaw + yawOffset);
// } else {
// if (world instanceof ServerWorld) {
// FabricDimensions.teleport(
// entity,
// (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
// }
// }
}
public static void teleport(ServerPlayerEntity player, Location location) {

View file

@ -1,15 +1,14 @@
package org.dimdev.dimdoors.world;
import net.minecraft.block.pattern.BlockPattern;
import net.minecraft.entity.Entity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.Direction;
public class LimboEntityPlacer {
// @Override
// public BlockPattern.Result placeEntity(Entity entity, ServerWorld serverWorld, Direction direction, double v, double v1) {
// return null;
// }
// @Override
// public BlockPattern.TeleportTarget placeEntity(Entity entity, ServerWorld serverWorld, Direction direction, double v, double v1) {
// return null;
// }
import net.fabricmc.fabric.api.dimension.v1.EntityPlacer;
public class LimboEntityPlacer implements EntityPlacer {
@Override
public BlockPattern.TeleportTarget placeEntity(Entity entity, ServerWorld serverWorld, Direction direction, double v, double v1) {
return null;
}
}

View file

@ -1,23 +1,74 @@
package org.dimdev.dimdoors.world;
import org.dimdev.dimdoors.world.limbo.LimboBiome;
import org.dimdev.dimdoors.world.pocket.BlankBiome;
import org.dimdev.dimdoors.block.ModBlocks;
import org.dimdev.dimdoors.entity.ModEntityTypes;
import org.dimdev.dimdoors.mixin.BuiltinBiomesAccessor;
import org.dimdev.dimdoors.sound.ModSoundEvents;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.sound.BiomeMoodSound;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeEffects;
import net.minecraft.world.biome.GenerationSettings;
import net.minecraft.world.biome.SpawnSettings;
import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder;
import net.minecraft.world.gen.surfacebuilder.TernarySurfaceConfig;
public final class ModBiomes {
public static final Biome LIMBO = register(new Identifier("dimdoors:limbo"), new LimboBiome());
public static final Biome WHITE_VOID = register(new Identifier("dimdoors:white_void"), new BlankBiome(true, false));
public static final Biome BLACK_VOID = register(new Identifier("dimdoors:black_void"), new BlankBiome(false, false));
public static final Biome DANGEROUS_BLACK_VOID = register(new Identifier("dimdoors:dangerous_black_void"), new BlankBiome(false, true));
private static Biome register(Identifier id, Biome biome) {
return Registry.register(Registry.BIOME, id, biome);
}
// public static final RegistryKey<Biome> PERSONAL_WHITE_VOID_KEY;
// public static final RegistryKey<Biome> PUBLIC_BLACK_VOID_KEY;
// public static final RegistryKey<Biome> DUNGEON_DANGEROUS_BLACK_VOID_KEY;
public static final RegistryKey<Biome> LIMBO_KEY;
// public static final Biome WHITE_VOID_BIOME;
// public static final Biome BLACK_VOID_BIOME;
// public static final Biome DANGEROUS_BLACK_VOID_BIOME;
public static final Biome LIMBO_BIOME;
public static void init() {
// just loads the class
int id = 1;
id += BuiltinRegistries.BIOME.stream().count();
BuiltinBiomesAccessor.invokeRegister(id + 1, LIMBO_KEY, LIMBO_BIOME);
// BuiltinBiomesAccessor.invokeRegister(id + 2, PERSONAL_WHITE_VOID_KEY, WHITE_VOID_BIOME);
// BuiltinBiomesAccessor.invokeRegister(id + 3, PUBLIC_BLACK_VOID_KEY, BLACK_VOID_BIOME);
// BuiltinBiomesAccessor.invokeRegister(id + 4, DUNGEON_DANGEROUS_BLACK_VOID_KEY, DANGEROUS_BLACK_VOID_BIOME);
}
static {
// PERSONAL_WHITE_VOID_KEY = RegistryKey.of(Registry.BIOME_KEY, new Identifier("dimdoors:white_void"));
// PUBLIC_BLACK_VOID_KEY = RegistryKey.of(Registry.BIOME_KEY, new Identifier("dimdoors:black_void"));
// DUNGEON_DANGEROUS_BLACK_VOID_KEY = RegistryKey.of(Registry.BIOME_KEY, new Identifier("dimdoors:dangerous_black_void"));
LIMBO_KEY = RegistryKey.of(Registry.BIOME_KEY, new Identifier("dimdoors", "limbo"));
// WHITE_VOID_BIOME = new BlankBiomeBuilder(true, false).build();
// BLACK_VOID_BIOME = new BlankBiomeBuilder(false, false).build();
// DANGEROUS_BLACK_VOID_BIOME = new BlankBiomeBuilder(false, true).build();
LIMBO_BIOME = new Biome.Builder()
.category(Biome.Category.NONE)
.depth(0.1f)
.downfall(0.0f)
.effects(new BiomeEffects.Builder()
.fogColor(0x222222)
.waterColor(0)
.foliageColor(0)
.waterFogColor(0)
.moodSound(new BiomeMoodSound(ModSoundEvents.CREEPY, 6000, 8, 2.0))
.skyColor(0x222222)
.grassColor(0)
.build())
.generationSettings(new GenerationSettings.Builder()
.surfaceBuilder(SurfaceBuilder.NETHER.method_30478(new TernarySurfaceConfig(ModBlocks.UNRAVELLED_FABRIC.getDefaultState(), ModBlocks.UNRAVELLED_FABRIC.getDefaultState(), ModBlocks.ETERNAL_FLUID.getDefaultState())))
.build())
.precipitation(Biome.Precipitation.NONE)
.scale(2F)
.spawnSettings(new SpawnSettings.Builder()
.creatureSpawnProbability(0.2f)
.spawn(SpawnGroup.MONSTER, new SpawnSettings.SpawnEntry(ModEntityTypes.MONOLITH, 1, 1, 1))
.build())
.temperature(0.2f)
.temperatureModifier(Biome.TemperatureModifier.NONE)
.build();
}
}

View file

@ -1,5 +1,7 @@
package org.dimdev.dimdoors.world;
import org.dimdev.dimdoors.world.limbo.LimboBiomeSource;
import org.dimdev.dimdoors.world.limbo.LimboChunkGenerator;
import org.dimdev.dimdoors.world.pocket.BlankChunkGenerator;
import net.minecraft.util.Identifier;
@ -14,8 +16,8 @@ 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 final RegistryKey<DimensionType> LIMBO_TYPE_KEY = RegistryKey.of(Registry.DIMENSION_TYPE_KEY, new Identifier("dimdoors:limbo"));
public static final RegistryKey<DimensionType> POCKET_TYPE_KEY = RegistryKey.of(Registry.DIMENSION_TYPE_KEY, new Identifier("dimdoors:personal_pockets"));
public static boolean isDimDoorsPocketDimension(World world) {
RegistryKey<World> type = world.getRegistryKey();
@ -28,7 +30,7 @@ public final class ModDimensions {
public static void init() {
Registry.register(Registry.CHUNK_GENERATOR, new Identifier("dimdoors", "blank"), BlankChunkGenerator.CODEC);
// just loads the class
Registry.register(Registry.CHUNK_GENERATOR, new Identifier("dimdoors", "limbo_chunk_generator"), LimboChunkGenerator.CODEC);
Registry.register(Registry.BIOME_SOURCE, new Identifier("dimdoors", "limbo_biome_source"), LimboBiomeSource.CODEC);
}
}

View file

@ -1,28 +0,0 @@
package org.dimdev.dimdoors.world;
import org.dimdev.dimdoors.block.ModBlocks;
import org.dimdev.dimdoors.world.feature.CustomOreFeature;
import org.dimdev.dimdoors.world.feature.CustomOreFeatureConfig;
import net.minecraft.block.Blocks;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.decorator.Decorator;
import net.minecraft.world.gen.decorator.RangeDecoratorConfig;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.OreFeatureConfig;
public class ModFeatures {
public static final Feature<OreFeatureConfig> ORE = Registry.register(Registry.FEATURE, new Identifier("dimdoors", "custom_ore"), new CustomOreFeature(CustomOreFeatureConfig.CODEC));
public static void init() {
CustomOreFeatureConfig eternalFluidFabricConfig = new CustomOreFeatureConfig(blockState -> blockState == ModBlocks.UNRAVELLED_FABRIC.getDefaultState(), ModBlocks.ETERNAL_FLUID.getDefaultState(), 16);
RangeDecoratorConfig eternalFluidFabricRange = new RangeDecoratorConfig(2, 0, 5, 24);
ModBiomes.LIMBO.addFeature(GenerationStep.Feature.UNDERGROUND_ORES, ORE.configure(eternalFluidFabricConfig).createDecoratedFeature(Decorator.COUNT_RANGE.configure(eternalFluidFabricRange)));
CustomOreFeatureConfig eternalFluidBedrockConfig = new CustomOreFeatureConfig(blockState -> blockState == Blocks.BEDROCK.getDefaultState(), ModBlocks.ETERNAL_FLUID.getDefaultState(), 16);
RangeDecoratorConfig eternalFluidBedrockRange = new RangeDecoratorConfig(1, 0, 0, 6);
ModBiomes.LIMBO.addFeature(GenerationStep.Feature.UNDERGROUND_ORES, ORE.configure(eternalFluidBedrockConfig).createDecoratedFeature(Decorator.COUNT_RANGE.configure(eternalFluidBedrockRange)));
}
}

View file

@ -1,15 +1,10 @@
package org.dimdev.dimdoors.world;
import net.minecraft.block.pattern.BlockPattern;
import net.minecraft.entity.Entity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.Direction;
//import net.fabricmc.fabric.api.dimension.v1.EntityPlacer;
import net.fabricmc.fabric.api.dimension.v1.EntityPlacer;
public class PocketDimensionPlacer implements EntityPlacer {
@Override
public BlockPattern.TeleportTarget placeEntity(Entity entity, ServerWorld serverWorld, Direction direction, double v, double v1) {
return null;
}
public class PocketDimensionPlacer {
// @Override
// public BlockPattern.TeleportTarget placeEntity(Entity entity, ServerWorld serverWorld, Direction direction, double v, double v1) {
// return null;
// }
}

View file

@ -1,111 +0,0 @@
package org.dimdev.dimdoors.world.feature;
import java.util.BitSet;
import java.util.Random;
import com.mojang.serialization.Codec;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.gen.feature.OreFeature;
import net.minecraft.world.gen.feature.OreFeatureConfig;
public class CustomOreFeature extends OreFeature {
public CustomOreFeature(Codec<OreFeatureConfig> codec) {
super(codec);
}
@Override
protected boolean generateVeinPart(WorldAccess world, Random random, OreFeatureConfig config, double double_1, double double_2, double double_3, double double_4, double double_5, double double_6, int int_1, int int_2, int int_3, int int_4, int int_5) {
int int_6 = 0;
BitSet bitSet = new BitSet(int_4 * int_5 * int_4);
BlockPos.Mutable mutablePos = new BlockPos.Mutable();
double[] doubles_1 = new double[config.size * 4];
int int_8;
double double_12;
double double_13;
double double_14;
double double_15;
for (int_8 = 0; int_8 < config.size; ++int_8) {
float float_1 = (float) int_8 / (float) config.size;
double_12 = MathHelper.lerp(float_1, double_1, double_2);
double_13 = MathHelper.lerp(float_1, double_5, double_6);
double_14 = MathHelper.lerp(float_1, double_3, double_4);
double_15 = random.nextDouble() * (double) config.size / 16.0D;
double double_11 = ((double) (MathHelper.sin(3.1415927F * float_1) + 1.0F) * double_15 + 1.0D) / 2.0D;
doubles_1[int_8 * 4 + 0] = double_12;
doubles_1[int_8 * 4 + 1] = double_13;
doubles_1[int_8 * 4 + 2] = double_14;
doubles_1[int_8 * 4 + 3] = double_11;
}
for (int_8 = 0; int_8 < config.size - 1; ++int_8) {
if (doubles_1[int_8 * 4 + 3] > 0.0D) {
for (int int_9 = int_8 + 1; int_9 < config.size; ++int_9) {
if (doubles_1[int_9 * 4 + 3] > 0.0D) {
double_12 = doubles_1[int_8 * 4 + 0] - doubles_1[int_9 * 4 + 0];
double_13 = doubles_1[int_8 * 4 + 1] - doubles_1[int_9 * 4 + 1];
double_14 = doubles_1[int_8 * 4 + 2] - doubles_1[int_9 * 4 + 2];
double_15 = doubles_1[int_8 * 4 + 3] - doubles_1[int_9 * 4 + 3];
if (double_15 * double_15 > double_12 * double_12 + double_13 * double_13 + double_14 * double_14) {
if (double_15 > 0.0D) {
doubles_1[int_9 * 4 + 3] = -1.0D;
} else {
doubles_1[int_8 * 4 + 3] = -1.0D;
}
}
}
}
}
}
for (int_8 = 0; int_8 < config.size; ++int_8) {
double double_16 = doubles_1[int_8 * 4 + 3];
if (double_16 >= 0.0D) {
double double_17 = doubles_1[int_8 * 4 + 0];
double double_18 = doubles_1[int_8 * 4 + 1];
double double_19 = doubles_1[int_8 * 4 + 2];
int int_11 = Math.max(MathHelper.floor(double_17 - double_16), int_1);
int int_12 = Math.max(MathHelper.floor(double_18 - double_16), int_2);
int int_13 = Math.max(MathHelper.floor(double_19 - double_16), int_3);
int int_14 = Math.max(MathHelper.floor(double_17 + double_16), int_11);
int int_15 = Math.max(MathHelper.floor(double_18 + double_16), int_12);
int int_16 = Math.max(MathHelper.floor(double_19 + double_16), int_13);
for (int x = int_11; x <= int_14; ++x) {
double double_20 = ((double) x + 0.5D - double_17) / double_16;
if (double_20 * double_20 < 1.0D) {
for (int y = int_12; y <= int_15; ++y) {
double double_21 = ((double) y + 0.5D - double_18) / double_16;
if (double_20 * double_20 + double_21 * double_21 < 1.0D) {
for (int z = int_13; z <= int_16; ++z) {
double double_22 = ((double) z + 0.5D - double_19) / double_16;
if (double_20 * double_20 + double_21 * double_21 + double_22 * double_22 < 1.0D) {
int int_20 = x - int_1 + (y - int_2) * int_4 + (z - int_3) * int_4 * int_5;
if (!bitSet.get(int_20)) {
bitSet.set(int_20);
mutablePos.set(x, y, z);
//Just added this line in
CustomOreFeatureConfig customConfig = (CustomOreFeatureConfig) config;
if (customConfig.blockPredicate.test(world.getBlockState(mutablePos))) {
world.setBlockState(mutablePos, config.state, 2);
++int_6;
}
}
}
}
}
}
}
}
}
}
return int_6 > 0;
}
}

View file

@ -1,15 +0,0 @@
package org.dimdev.dimdoors.world.feature;
import java.util.function.Predicate;
import net.minecraft.block.BlockState;
import net.minecraft.world.gen.feature.OreFeatureConfig;
public class CustomOreFeatureConfig extends OreFeatureConfig {
Predicate<BlockState> blockPredicate;
public CustomOreFeatureConfig(Predicate<BlockState> blockPredicate, BlockState blockState, int size) {
super(null, blockState, size);
this.blockPredicate = blockPredicate;
}
}

View file

@ -1,15 +1,12 @@
package org.dimdev.dimdoors.world.gateway;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biomes;
public class SandstonePillarsGateway extends BaseSchematicGateway {
public SandstonePillarsGateway() {
super("sandstone_pillars");
}
@Override
public Biome[] getBiomes() {
return new Biome[]{Biomes.DESERT, Biomes.DESERT_HILLS, Biomes.DESERT_LAKES};
}
// @Override
// public Biome[] getBiomes() {
// return new Biome[]{Biomes.DESERT, Biomes.DESERT_HILLS, Biomes.DESERT_LAKES};
// }
}

View file

@ -1,52 +1,54 @@
package org.dimdev.dimdoors.world.limbo;
import com.google.common.collect.ImmutableList;
import org.dimdev.dimdoors.block.ModBlocks;
import org.dimdev.dimdoors.entity.ModEntityTypes;
import org.dimdev.dimdoors.sound.ModSoundEvents;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeEffects;
import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder;
import net.minecraft.world.gen.surfacebuilder.TernarySurfaceConfig;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
public class LimboBiome extends Biome {
public LimboBiome() {
super(new Biome.Settings()
.configureSurfaceBuilder(
SurfaceBuilder.DEFAULT,
new TernarySurfaceConfig(
ModBlocks.UNRAVELLED_FABRIC.getDefaultState(),
ModBlocks.UNRAVELLED_FABRIC.getDefaultState(),
ModBlocks.ETERNAL_FLUID.getDefaultState()
)
)
.precipitation(Biome.Precipitation.NONE).category(Biome.Category.NETHER)
.depth(0.1F)
.scale(0.2F)
.temperature(2.0F)
.downfall(0.0F)
.effects(
new BiomeEffects.Builder()
.waterColor(0x000000)
.waterFogColor(0x000000)
.fogColor(0x000000)
.loopSound(ModSoundEvents.CREEPY)
// TODO: moodSound, additionsSound?
.build()
)
.parent(null)
.noises(ImmutableList.of(new Biome.MixedNoisePoint(0.0F, 0.0F, 0.0F, -0.5F, 1.0F))));
this.addSpawn(SpawnGroup.MONSTER, new Biome.SpawnEntry(ModEntityTypes.MONOLITH, 1, 0, 1));
}
@Environment(EnvType.CLIENT)
@Override
public int getSkyColor() {
return 0x404040;
}
}
//RIP LimboBiome - sometime in early 2020 to August 4
//
//package org.dimdev.dimdoors.world.limbo;
//
//import com.google.common.collect.ImmutableList;
//import org.dimdev.dimdoors.block.ModBlocks;
//import org.dimdev.dimdoors.entity.ModEntityTypes;
//import org.dimdev.dimdoors.sound.ModSoundEvents;
//
//import net.minecraft.entity.SpawnGroup;
//import net.minecraft.world.biome.Biome;
//import net.minecraft.world.biome.BiomeEffects;
//import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder;
//import net.minecraft.world.gen.surfacebuilder.TernarySurfaceConfig;
//
//import net.fabricmc.api.EnvType;
//import net.fabricmc.api.Environment;
//
//public class LimboBiome extends Biome {
// public LimboBiome() {
// super(new Biome.Settings()
// .configureSurfaceBuilder(
// SurfaceBuilder.DEFAULT,
// new TernarySurfaceConfig(
// ModBlocks.UNRAVELLED_FABRIC.getDefaultState(),
// ModBlocks.UNRAVELLED_FABRIC.getDefaultState(),
// ModBlocks.ETERNAL_FLUID.getDefaultState()
// )
// )
// .precipitation(Biome.Precipitation.NONE)
// .category(Biome.Category.NETHER)
// .depth(0.1F)
// .scale(0.2F)
// .temperature(2.0F)
// .downfall(0.0F)
// .effects(
// new BiomeEffects.Builder()
// .waterColor(0x000000)
// .waterFogColor(0x000000)
// .fogColor(0x000000)
// .loopSound(ModSoundEvents.CREEPY)
// .build()
// )
// .parent(null)
// .noises(ImmutableList.of(new Biome.MixedNoisePoint(0.0F, 0.0F, 0.0F, -0.5F, 1.0F))));
// this.addSpawn(SpawnGroup.MONSTER, new Biome.SpawnEntry(ModEntityTypes.MONOLITH, 1, 0, 1));
// }
//
// @Environment(EnvType.CLIENT)
// @Override
// public int getSkyColor() {
// return 0x404040;
// }
//}

View file

@ -0,0 +1,42 @@
package org.dimdev.dimdoors.world.limbo;
import java.util.Collections;
import java.util.Set;
import com.google.common.collect.ImmutableSet;
import com.mojang.serialization.Codec;
import com.mojang.serialization.Decoder;
import com.mojang.serialization.Encoder;
import com.mojang.serialization.MapCodec;
import org.dimdev.dimdoors.world.ModBiomes;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.source.BiomeSource;
public class LimboBiomeSource extends BiomeSource {
public static final Codec<LimboBiomeSource> CODEC = MapCodec.of(Encoder.empty(), Decoder.unit(LimboBiomeSource::new)).stable().codec();
public LimboBiomeSource() {
super(Collections.singletonList(ModBiomes.LIMBO_BIOME));
}
@Override
public Codec<? extends BiomeSource> getCodec() {
return CODEC;
}
@Override
public BiomeSource withSeed(long seed) {
return this;
}
@Override
public Set<Biome> getBiomesInArea(int x, int y, int z, int radius) {
return ImmutableSet.of(ModBiomes.LIMBO_BIOME);
}
@Override
public Biome getBiomeForNoiseGen(int biomeX, int biomeY, int biomeZ) {
return ModBiomes.LIMBO_BIOME;
}
}

View file

@ -1,93 +1,625 @@
//package org.dimdev.dimdoors.world.limbo;
//
//import net.minecraft.block.Blocks;
//import net.minecraft.entity.SpawnGroup;
//import net.minecraft.util.math.BlockPos;
//import net.minecraft.world.WorldAccess;
//import net.minecraft.world.biome.Biome;
//import net.minecraft.world.biome.source.BiomeSource;
//import net.minecraft.world.chunk.Chunk;
//import net.minecraft.world.gen.StructureAccessor;
//import net.minecraft.world.gen.chunk.ChunkGenerator;
//import net.minecraft.world.gen.chunk.SurfaceChunkGenerator;
//import net.minecraft.world.gen.feature.Feature;
//
//import java.util.List;
//import java.util.Random;
//
//public class LimboChunkGenerator extends ChunkGenerator {
// private final double[] noiseFalloff = buildNoiseFalloff();
//
// public LimboChunkGenerator(WorldAccess world, BiomeSource biomeSource, LimboChunkGeneratorConfig config) {
// super(world, biomeSource, 4, 8, 256, config, false);
// }
//
// @Override
// protected void sampleNoiseColumn(double[] buffer, int x, int z) {
// sampleNoiseColumn(buffer, x, z, 884.412D, 9740.421D, 8.555150000000001D, 20.2206D, 3, -10);
// }
//
// @Override
// protected double[] computeNoiseRange(int i, int j) {
// return new double[] {-0.80118735, 5.4635482};
// }
//
// @Override
// protected double computeNoiseFalloff(double d, double e, int i) {
// return noiseFalloff[i]/8000d;
// }
//
// private double[] buildNoiseFalloff() {
// double[] ds = new double[getNoiseSizeY()];
//
// for (int i = 0; i < getNoiseSizeY(); ++i) {
// ds[i] = Math.cos((double) i * 3.141592653589793D * 6.0D / (double) getNoiseSizeY()) * 2.0D;
// double d = i;
// if (i > getNoiseSizeY() / 2) {
// d = getNoiseSizeY() - 1 - i;
// }
//
// if (d < 4.0D) {
// d = 4.0D - d;
// ds[i] -= d * d * d * 10.0D;
// }
// }
//
// return ds;
// }
//
// /*@Override
// public List<Biome.SpawnEntry> getEntitySpawnList(Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos) {
// if (group == SpawnGroup.MONSTER) {
// if (Feature.NETHER_BRIDGE.isInsideStructure(world, blockPos)) {
// return Feature.NETHER_BRIDGE.getMonsterSpawns();
// }
//
// if (Feature.NETHER_BRIDGE.isApproximatelyInsideStructure(world, blockPos) && world.getBlockState(blockPos.down()).getBlock() == Blocks.NETHER_BRICKS) {
// return Feature.NETHER_BRIDGE.getMonsterSpawns();
// }
// }
//
// return super.getEntitySpawnList(entityCategory, blockPos);
// }*/
//
// @Override
// public int getSpawnHeight() {
// return world.getSeaLevel() + 1;
// }
//
// @Override
// public int getMaxY() {
// return 256;
// }
//
// @Override
// public int getSeaLevel() {
// return 32;
// }
//
// @Override
// protected void buildBedrock(Chunk chunk, Random random) {
//
// }
//}
package org.dimdev.dimdoors.world.limbo;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import it.unimi.dsi.fastutil.objects.ObjectList;
import it.unimi.dsi.fastutil.objects.ObjectListIterator;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.stream.IntStream;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import org.dimdev.dimdoors.block.ModBlocks;
import org.dimdev.dimdoors.entity.ModEntityTypes;
import org.jetbrains.annotations.Nullable;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.structure.JigsawJunction;
import net.minecraft.structure.PoolStructurePiece;
import net.minecraft.structure.StructurePiece;
import net.minecraft.structure.pool.StructurePool;
import net.minecraft.util.Util;
import net.minecraft.util.math.BlockBox;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.ChunkSectionPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.noise.NoiseSampler;
import net.minecraft.util.math.noise.OctavePerlinNoiseSampler;
import net.minecraft.util.math.noise.OctaveSimplexNoiseSampler;
import net.minecraft.util.math.noise.PerlinNoiseSampler;
import net.minecraft.util.math.noise.SimplexNoiseSampler;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.BlockView;
import net.minecraft.world.ChunkRegion;
import net.minecraft.world.Heightmap;
import net.minecraft.world.SpawnHelper;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.SpawnSettings;
import net.minecraft.world.biome.source.BiomeSource;
import net.minecraft.world.biome.source.TheEndBiomeSource;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ChunkSection;
import net.minecraft.world.chunk.ProtoChunk;
import net.minecraft.world.gen.ChunkRandom;
import net.minecraft.world.gen.StructureAccessor;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.chunk.ChunkGeneratorSettings;
import net.minecraft.world.gen.chunk.GenerationShapeConfig;
import net.minecraft.world.gen.chunk.VerticalBlockSample;
import net.minecraft.world.gen.feature.StructureFeature;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
public class LimboChunkGenerator extends ChunkGenerator {
public static final Codec<LimboChunkGenerator> CODEC = RecordCodecBuilder.create((instance) -> {
return instance.group(BiomeSource.CODEC.fieldOf("biome_source").forGetter((limboChunkGenerator) -> {
return limboChunkGenerator.biomeSource;
}), ChunkGeneratorSettings.REGISTRY_CODEC.fieldOf("settings").forGetter((limboChunkGenerator) -> {
return limboChunkGenerator.settings;
})).apply(instance, instance.stable(LimboChunkGenerator::new));
});
private static final float[] NOISE_WEIGHT_TABLE = Util.make(new float[13824], (array) -> {
for (int i = 0; i < 24; ++i) {
for (int j = 0; j < 24; ++j) {
for (int k = 0; k < 24; ++k) {
array[i * 24 * 24 + j * 24 + k] = (float) calculateNoiseWeight(j - 12, k - 12, i - 12);
}
}
}
});
private static final float[] BIOME_WEIGHT_TABLE = Util.make(new float[25], (fs) -> {
for (int i = -2; i <= 2; ++i) {
for (int j = -2; j <= 2; ++j) {
float f = 10.0F / MathHelper.sqrt((float) (i * i + j * j) + 0.2F);
fs[i + 2 + (j + 2) * 5] = f;
}
}
});
private static final BlockState AIR = Blocks.AIR.getDefaultState();;
private final int verticalNoiseResolution;
private final int horizontalNoiseResolution;
private final int noiseSizeX;
private final int noiseSizeY;
private final int noiseSizeZ;
protected final ChunkRandom random;
private final OctavePerlinNoiseSampler lowerInterpolatedNoise;
private final OctavePerlinNoiseSampler upperInterpolatedNoise;
private final OctavePerlinNoiseSampler interpolationNoise;
private final NoiseSampler surfaceDepthNoise;
private final OctavePerlinNoiseSampler densityNoise;
@Nullable
private final SimplexNoiseSampler islandNoise;
protected final BlockState defaultBlock;
protected final BlockState defaultFluid;
private final long worldSeed;
protected final Supplier<ChunkGeneratorSettings> settings;
private final int worldHeight;
public LimboChunkGenerator(BiomeSource biomeSource, Supplier<ChunkGeneratorSettings> supplier) {
this(biomeSource, biomeSource, supplier);
}
private LimboChunkGenerator(BiomeSource biomeSource, BiomeSource biomeSource2, Supplier<ChunkGeneratorSettings> supplier) {
super(biomeSource, biomeSource2, supplier.get().getStructuresConfig(), new Random().nextLong());
this.worldSeed = new Random().nextLong();
ChunkGeneratorSettings chunkGeneratorSettings = supplier.get();
this.settings = supplier;
GenerationShapeConfig generationShapeConfig = chunkGeneratorSettings.getGenerationShapeConfig();
this.worldHeight = generationShapeConfig.getHeight();
this.verticalNoiseResolution = generationShapeConfig.getSizeVertical() * 4;
this.horizontalNoiseResolution = generationShapeConfig.getSizeHorizontal() * 4;
this.defaultBlock = chunkGeneratorSettings.getDefaultBlock();
this.defaultFluid = chunkGeneratorSettings.getDefaultFluid();
this.noiseSizeX = 16 / this.horizontalNoiseResolution;
this.noiseSizeY = generationShapeConfig.getHeight() / this.verticalNoiseResolution;
this.noiseSizeZ = 16 / this.horizontalNoiseResolution;
this.random = new ChunkRandom(this.worldSeed);
this.lowerInterpolatedNoise = new OctavePerlinNoiseSampler(this.random, IntStream.rangeClosed(-15, 0));
this.upperInterpolatedNoise = new OctavePerlinNoiseSampler(this.random, IntStream.rangeClosed(-15, 0));
this.interpolationNoise = new OctavePerlinNoiseSampler(this.random, IntStream.rangeClosed(-7, 0));
this.surfaceDepthNoise = generationShapeConfig.hasSimplexSurfaceNoise() ? new OctaveSimplexNoiseSampler(this.random, IntStream.rangeClosed(-3, 0)) : new OctavePerlinNoiseSampler(this.random, IntStream.rangeClosed(-3, 0));
this.random.consume(2620);
this.densityNoise = new OctavePerlinNoiseSampler(this.random, IntStream.rangeClosed(-15, 0));
if (generationShapeConfig.hasIslandNoiseOverride()) {
ChunkRandom chunkRandom = new ChunkRandom(this.worldSeed);
chunkRandom.consume(17292);
this.islandNoise = new SimplexNoiseSampler(chunkRandom);
} else {
this.islandNoise = null;
}
}
public final Codec<? extends ChunkGenerator> getCodec() {
return CODEC;
}
@Environment(EnvType.CLIENT)
public ChunkGenerator withSeed(long seed) {
return new LimboChunkGenerator(this.biomeSource.withSeed(seed), this.settings);
}
public boolean equals(long l, RegistryKey<ChunkGeneratorSettings> registryKey) {
return this.worldSeed == l && this.settings.get().equals(registryKey);
}
private double sampleNoise(int x, int y, int z, double horizontalScale, double verticalScale, double horizontalStretch, double verticalStretch) {
double d = 0.0D;
double e = 0.0D;
double f = 0.0D;
double g = 1.0D;
for (int i = 0; i < 16; ++i) {
double h = OctavePerlinNoiseSampler.maintainPrecision((double) x * horizontalScale * g);
double j = OctavePerlinNoiseSampler.maintainPrecision((double) y * verticalScale * g);
double k = OctavePerlinNoiseSampler.maintainPrecision((double) z * horizontalScale * g);
double l = verticalScale * g;
PerlinNoiseSampler perlinNoiseSampler = this.lowerInterpolatedNoise.getOctave(i);
if (perlinNoiseSampler != null) {
d += perlinNoiseSampler.sample(h, j, k, l, (double) y * l) / g;
}
PerlinNoiseSampler perlinNoiseSampler2 = this.upperInterpolatedNoise.getOctave(i);
if (perlinNoiseSampler2 != null) {
e += perlinNoiseSampler2.sample(h, j, k, l, (double) y * l) / g;
}
if (i < 8) {
PerlinNoiseSampler perlinNoiseSampler3 = this.interpolationNoise.getOctave(i);
if (perlinNoiseSampler3 != null) {
f += perlinNoiseSampler3.sample(OctavePerlinNoiseSampler.maintainPrecision((double) x * horizontalStretch * g), OctavePerlinNoiseSampler.maintainPrecision((double) y * verticalStretch * g), OctavePerlinNoiseSampler.maintainPrecision((double) z * horizontalStretch * g), verticalStretch * g, (double) y * verticalStretch * g) / g;
}
}
g /= 2.0D;
}
return MathHelper.clampedLerp(d / 512.0D, e / 512.0D, (f / 10.0D + 1.0D) / 2.0D);
}
private double[] sampleNoiseColumn(int x, int z) {
double[] ds = new double[this.noiseSizeY + 1];
this.sampleNoiseColumn(ds, x, z);
return ds;
}
private void sampleNoiseColumn(double[] buffer, int x, int z) {
GenerationShapeConfig generationShapeConfig = this.settings.get().getGenerationShapeConfig();
double ac;
double ad;
double ai;
double aj;
if (this.islandNoise != null) {
ac = TheEndBiomeSource.getNoiseAt(this.islandNoise, x, z) - 8.0F;
if (ac > 0.0D) {
ad = 0.25D;
} else {
ad = 1.0D;
}
} else {
float g = 0.0F;
float h = 0.0F;
float i = 0.0F;
int k = this.getSeaLevel();
float l = this.biomeSource.getBiomeForNoiseGen(x, k, z).getDepth();
for (int m = -2; m <= 2; ++m) {
for (int n = -2; n <= 2; ++n) {
Biome biome = this.biomeSource.getBiomeForNoiseGen(x + m, k, z + n);
float o = biome.getDepth();
float p = biome.getScale();
float s;
float t;
if (generationShapeConfig.isAmplified() && o > 0.0F) {
s = 1.0F + o * 2.0F;
t = 1.0F + p * 4.0F;
} else {
s = o;
t = p;
}
float u = o > l ? 0.5F : 1.0F;
float v = u * BIOME_WEIGHT_TABLE[m + 2 + (n + 2) * 5] / (s + 2.0F);
g += t * v;
h += s * v;
i += v;
}
}
float w = h / i;
float y = g / i;
ai = w * 0.5F - 0.125F;
aj = y * 0.9F + 0.1F;
ac = ai * 0.265625D;
ad = 96.0D / aj;
}
double ae = 684.412D * generationShapeConfig.getSampling().getXZScale();
double af = 684.412D * generationShapeConfig.getSampling().getYScale();
double ag = ae / generationShapeConfig.getSampling().getXZFactor();
double ah = af / generationShapeConfig.getSampling().getYFactor();
ai = generationShapeConfig.getTopSlide().getTarget();
aj = generationShapeConfig.getTopSlide().getSize();
double ak = generationShapeConfig.getTopSlide().getOffset();
double al = generationShapeConfig.getBottomSlide().getTarget();
double am = generationShapeConfig.getBottomSlide().getSize();
double an = generationShapeConfig.getBottomSlide().getOffset();
double ao = generationShapeConfig.hasRandomDensityOffset() ? this.getRandomDensityAt(x, z) : 0.0D;
double ap = generationShapeConfig.getDensityFactor();
double aq = generationShapeConfig.getDensityOffset();
for (int ar = 0; ar <= this.noiseSizeY; ++ar) {
double as = this.sampleNoise(x, ar, z, ae, af, ag, ah);
double at = 1.0D - (double) ar * 2.0D / (double) this.noiseSizeY + ao;
double au = at * ap + aq;
double av = (au + ac) * ad;
if (av > 0.0D) {
as += av * 4.0D;
} else {
as += av;
}
double ax;
if (aj > 0.0D) {
ax = ((double) (this.noiseSizeY - ar) - ak) / aj;
as = MathHelper.clampedLerp(ai, as, ax);
}
if (am > 0.0D) {
ax = ((double) ar - an) / am;
as = MathHelper.clampedLerp(al, as, ax);
}
buffer[ar] = as;
}
}
private double getRandomDensityAt(int x, int z) {
double d = this.densityNoise.sample(x * 200, 10.0D, z * 200, 1.0D, 0.0D, true);
double f;
if (d < 0.0D) {
f = -d * 0.3D;
} else {
f = d;
}
double g = f * 24.575625D - 2.0D;
return g < 0.0D ? g * 0.009486607142857142D : Math.min(g, 1.0D) * 0.006640625D;
}
public int getHeight(int x, int z, Heightmap.Type heightmapType) {
return this.sampleHeightmap(x, z, null, heightmapType.getBlockPredicate());
}
public BlockView getColumnSample(int x, int z) {
BlockState[] blockStates = new BlockState[this.noiseSizeY * this.verticalNoiseResolution];
this.sampleHeightmap(x, z, blockStates, null);
return new VerticalBlockSample(blockStates);
}
private int sampleHeightmap(int x, int z, @Nullable BlockState[] states, @Nullable Predicate<BlockState> predicate) {
int i = Math.floorDiv(x, this.horizontalNoiseResolution);
int j = Math.floorDiv(z, this.horizontalNoiseResolution);
int k = Math.floorMod(x, this.horizontalNoiseResolution);
int l = Math.floorMod(z, this.horizontalNoiseResolution);
double d = (double) k / (double) this.horizontalNoiseResolution;
double e = (double) l / (double) this.horizontalNoiseResolution;
double[][] ds = new double[][]{this.sampleNoiseColumn(i, j), this.sampleNoiseColumn(i, j + 1), this.sampleNoiseColumn(i + 1, j), this.sampleNoiseColumn(i + 1, j + 1)};
for (int m = this.noiseSizeY - 1; m >= 0; --m) {
double f = ds[0][m];
double g = ds[1][m];
double h = ds[2][m];
double n = ds[3][m];
double o = ds[0][m + 1];
double p = ds[1][m + 1];
double q = ds[2][m + 1];
double r = ds[3][m + 1];
for (int s = this.verticalNoiseResolution - 1; s >= 0; --s) {
double t = (double) s / (double) this.verticalNoiseResolution;
double u = MathHelper.lerp3(t, d, e, f, o, h, q, g, p, n, r);
int v = m * this.verticalNoiseResolution + s;
BlockState blockState = this.getBlockState(u, v);
if (states != null) {
states[v] = blockState;
}
if (predicate != null && predicate.test(blockState)) {
return v + 1;
}
}
}
return 0;
}
protected BlockState getBlockState(double density, int y) {
BlockState blockState3;
if (density > 0.0D) {
blockState3 = this.defaultBlock;
} else if (y < this.getSeaLevel()) {
blockState3 = this.defaultFluid;
} else {
blockState3 = AIR;
}
return blockState3;
}
public void buildSurface(ChunkRegion region, Chunk chunk) {
ChunkPos chunkPos = chunk.getPos();
int i = chunkPos.x;
int j = chunkPos.z;
ChunkRandom chunkRandom = new ChunkRandom();
chunkRandom.setTerrainSeed(i, j);
ChunkPos chunkPos2 = chunk.getPos();
int k = chunkPos2.getStartX();
int l = chunkPos2.getStartZ();
BlockPos.Mutable mutable = new BlockPos.Mutable();
for (int m = 0; m < 16; ++m) {
for (int n = 0; n < 16; ++n) {
int o = k + m;
int p = l + n;
int q = chunk.sampleHeightmap(Heightmap.Type.WORLD_SURFACE_WG, m, n) + 1;
double e = this.surfaceDepthNoise.sample((double) o * 0.0625D, (double) p * 0.0625D, 0.0625D, (double) m * 0.0625D) * 15.0D;
region.getBiome(mutable.set(k + m, q, l + n)).buildSurface(chunkRandom, chunk, o, p, q, e, this.defaultBlock, this.defaultFluid, this.getSeaLevel(), region.getSeed());
}
}
this.buildEternalFluidFloor(chunk, chunkRandom);
}
private void buildEternalFluidFloor(Chunk chunk, Random random) {
BlockPos.Mutable mutable = new BlockPos.Mutable();
int i = chunk.getPos().getStartX();
int j = chunk.getPos().getStartZ();
ChunkGeneratorSettings chunkGeneratorSettings = this.settings.get();
int k = chunkGeneratorSettings.getBedrockFloorY();
int l = this.worldHeight - 1 - chunkGeneratorSettings.getBedrockCeilingY();
boolean bl = l + 4 >= 0 && l < this.worldHeight;
boolean bl2 = k + 4 >= 0 && k < this.worldHeight;
if (bl || bl2) {
Iterator<BlockPos> iterator = BlockPos.iterate(i, 0, j, i + 15, 0, j + 15).iterator();
while (true) {
BlockPos blockPos;
int o;
do {
if (!iterator.hasNext()) {
return;
}
blockPos = iterator.next();
if (bl) {
for (o = 0; o < 5; ++o) {
if (o <= random.nextInt(5)) {
chunk.setBlockState(mutable.set(blockPos.getX(), l - o, blockPos.getZ()), ModBlocks.ETERNAL_FLUID.getDefaultState(), false);
}
}
}
} while (!bl2);
for (o = 4; o >= 0; --o) {
if (o <= random.nextInt(5)) {
chunk.setBlockState(mutable.set(blockPos.getX(), k + o, blockPos.getZ()), ModBlocks.ETERNAL_FLUID.getDefaultState(), false);
}
}
}
}
}
public void populateNoise(WorldAccess world, StructureAccessor accessor, Chunk chunk) {
ObjectList<StructurePiece> objectList = new ObjectArrayList<>(10);
ObjectList<JigsawJunction> objectList2 = new ObjectArrayList<>(32);
ChunkPos chunkPos = chunk.getPos();
int i = chunkPos.x;
int j = chunkPos.z;
int k = i << 4;
int l = j << 4;
for (StructureFeature<?> structureFeature : StructureFeature.JIGSAW_STRUCTURES) {
accessor.getStructuresWithChildren(ChunkSectionPos.from(chunkPos, 0), structureFeature).forEach((start) -> {
Iterator<StructurePiece> iterator = start.getChildren().iterator();
while (true) {
StructurePiece structurePiece;
do {
if (!iterator.hasNext()) {
return;
}
structurePiece = iterator.next();
} while (!structurePiece.intersectsChunk(chunkPos, 12));
if (structurePiece instanceof PoolStructurePiece) {
PoolStructurePiece poolStructurePiece = (PoolStructurePiece) structurePiece;
StructurePool.Projection projection = poolStructurePiece.getPoolElement().getProjection();
if (projection == StructurePool.Projection.RIGID) {
objectList.add(poolStructurePiece);
}
for (JigsawJunction jigsawJunction : poolStructurePiece.getJunctions()) {
int kx = jigsawJunction.getSourceX();
int lx = jigsawJunction.getSourceZ();
if (kx > k - 12 && lx > l - 12 && kx < k + 15 + 12 && lx < l + 15 + 12) {
objectList2.add(jigsawJunction);
}
}
} else {
objectList.add(structurePiece);
}
}
});
}
double[][][] ds = new double[2][this.noiseSizeZ + 1][this.noiseSizeY + 1];
for (int m = 0; m < this.noiseSizeZ + 1; ++m) {
ds[0][m] = new double[this.noiseSizeY + 1];
this.sampleNoiseColumn(ds[0][m], i * this.noiseSizeX, j * this.noiseSizeZ + m);
ds[1][m] = new double[this.noiseSizeY + 1];
}
ProtoChunk protoChunk = (ProtoChunk) chunk;
Heightmap heightmap = protoChunk.getHeightmap(Heightmap.Type.OCEAN_FLOOR_WG);
Heightmap heightmap2 = protoChunk.getHeightmap(Heightmap.Type.WORLD_SURFACE_WG);
BlockPos.Mutable mutable = new BlockPos.Mutable();
ObjectListIterator<StructurePiece> objectListIterator = objectList.iterator();
ObjectListIterator<JigsawJunction> objectListIterator2 = objectList2.iterator();
for (int n = 0; n < this.noiseSizeX; ++n) {
int p;
for (p = 0; p < this.noiseSizeZ + 1; ++p) {
this.sampleNoiseColumn(ds[1][p], i * this.noiseSizeX + n + 1, j * this.noiseSizeZ + p);
}
for (p = 0; p < this.noiseSizeZ; ++p) {
ChunkSection chunkSection = protoChunk.getSection(15);
chunkSection.lock();
for (int q = this.noiseSizeY - 1; q >= 0; --q) {
double d = ds[0][p][q];
double e = ds[0][p + 1][q];
double f = ds[1][p][q];
double g = ds[1][p + 1][q];
double h = ds[0][p][q + 1];
double r = ds[0][p + 1][q + 1];
double s = ds[1][p][q + 1];
double t = ds[1][p + 1][q + 1];
for (int u = this.verticalNoiseResolution - 1; u >= 0; --u) {
int v = q * this.verticalNoiseResolution + u;
int w = v & 15;
int x = v >> 4;
if (chunkSection.getYOffset() >> 4 != x) {
chunkSection.unlock();
chunkSection = protoChunk.getSection(x);
chunkSection.lock();
}
double y = (double) u / (double) this.verticalNoiseResolution;
double z = MathHelper.lerp(y, d, h);
double aa = MathHelper.lerp(y, f, s);
double ab = MathHelper.lerp(y, e, r);
double ac = MathHelper.lerp(y, g, t);
for (int ad = 0; ad < this.horizontalNoiseResolution; ++ad) {
int ae = k + n * this.horizontalNoiseResolution + ad;
int af = ae & 15;
double ag = (double) ad / (double) this.horizontalNoiseResolution;
double ah = MathHelper.lerp(ag, z, aa);
double ai = MathHelper.lerp(ag, ab, ac);
for (int aj = 0; aj < this.horizontalNoiseResolution; ++aj) {
int ak = l + p * this.horizontalNoiseResolution + aj;
int al = ak & 15;
double am = (double) aj / (double) this.horizontalNoiseResolution;
double an = MathHelper.lerp(am, ah, ai);
double ao = MathHelper.clamp(an / 200.0D, -1.0D, 1.0D);
int at;
int au;
int ar;
for (ao = ao / 2.0D - ao * ao * ao / 24.0D; objectListIterator.hasNext(); ao += getNoiseWeight(at, au, ar) * 0.8D) {
StructurePiece structurePiece = objectListIterator.next();
BlockBox blockBox = structurePiece.getBoundingBox();
at = Math.max(0, Math.max(blockBox.minX - ae, ae - blockBox.maxX));
au = v - (blockBox.minY + (structurePiece instanceof PoolStructurePiece ? ((PoolStructurePiece) structurePiece).getGroundLevelDelta() : 0));
ar = Math.max(0, Math.max(blockBox.minZ - ak, ak - blockBox.maxZ));
}
objectListIterator.back(objectList.size());
while (objectListIterator2.hasNext()) {
JigsawJunction jigsawJunction = objectListIterator2.next();
int as = ae - jigsawJunction.getSourceX();
at = v - jigsawJunction.getSourceGroundY();
au = ak - jigsawJunction.getSourceZ();
ao += getNoiseWeight(as, at, au) * 0.4D;
}
objectListIterator2.back(objectList2.size());
BlockState blockState = this.getBlockState(ao, v);
if (blockState != AIR) {
if (blockState.getLuminance() != 0) {
mutable.set(ae, v, ak);
protoChunk.addLightSource(mutable);
}
chunkSection.setBlockState(af, w, al, blockState, false);
heightmap.trackUpdate(af, v, al, blockState);
heightmap2.trackUpdate(af, v, al, blockState);
}
}
}
}
}
chunkSection.unlock();
}
double[][] es = ds[0];
ds[0] = ds[1];
ds[1] = es;
}
}
private static double getNoiseWeight(int x, int y, int z) {
int i = x + 12;
int j = y + 12;
int k = z + 12;
if (i >= 0 && i < 24) {
if (j >= 0 && j < 24) {
return k >= 0 && k < 24 ? (double) NOISE_WEIGHT_TABLE[k * 24 * 24 + i * 24 + j] : 0.0D;
} else {
return 0.0D;
}
} else {
return 0.0D;
}
}
private static double calculateNoiseWeight(int x, int y, int z) {
double d = x * x + z * z;
double e = (double) y + 0.5D;
double f = e * e;
double g = Math.pow(2.718281828459045D, -(f / 16.0D + d / 16.0D));
double h = -e * MathHelper.fastInverseSqrt(f / 2.0D + d / 2.0D) / 2.0D;
return h * g;
}
public int getMaxY() {
return this.worldHeight;
}
public int getSeaLevel() {
return this.settings.get().getSeaLevel();
}
public void populateEntities(ChunkRegion region) {
int i = region.getCenterChunkX();
int j = region.getCenterChunkZ();
Biome biome = region.getBiome((new ChunkPos(i, j)).getCenterBlockPos());
ChunkRandom chunkRandom = new ChunkRandom();
chunkRandom.setPopulationSeed(region.getSeed(), i << 4, j << 4);
SpawnHelper.populateEntities(region, biome, i, j, chunkRandom);
}
}

View file

@ -1,42 +1,42 @@
package org.dimdev.dimdoors.world.pocket;
import com.google.common.collect.ImmutableList;
import org.dimdev.dimdoors.sound.ModSoundEvents;
import net.minecraft.block.Blocks;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeEffects;
import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder;
import net.minecraft.world.gen.surfacebuilder.TernarySurfaceConfig;
public class BlankBiome extends Biome {
public BlankBiome(boolean white, boolean dangerous) {
super(new Biome.Settings()
.configureSurfaceBuilder(
SurfaceBuilder.DEFAULT,
new TernarySurfaceConfig(
Blocks.AIR.getDefaultState(),
Blocks.AIR.getDefaultState(),
Blocks.AIR.getDefaultState()
)
)
.precipitation(Biome.Precipitation.NONE).category(Biome.Category.NETHER)
.depth(0)
.scale(0)
.temperature(0.8f)
.downfall(0)
.effects(createEffect(white))
.parent(null)
.noises(ImmutableList.of())
);
}
private static BiomeEffects createEffect(boolean white) {
BiomeEffects.Builder builder = new BiomeEffects.Builder()
.waterColor(white ? 0xFFFFFF : 0x000000)
.waterFogColor(white ? 0xFFFFFF : 0x000000)
.fogColor(white ? 0xFFFFFF : 0x000000);
if (white) builder.loopSound(ModSoundEvents.WHITE_VOID);
return builder.build();
}
}
//package org.dimdev.dimdoors.world.pocket;
//
//import com.google.common.collect.ImmutableList;
//import org.dimdev.dimdoors.sound.ModSoundEvents;
//
//import net.minecraft.block.Blocks;
//import net.minecraft.world.biome.Biome;
//import net.minecraft.world.biome.BiomeEffects;
//import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder;
//import net.minecraft.world.gen.surfacebuilder.TernarySurfaceConfig;
//
//public class BlankBiome extends Biome {
// public BlankBiome(boolean white, boolean dangerous) {
// super(new Biome.Settings()
// .configureSurfaceBuilder(
// SurfaceBuilder.DEFAULT,
// new TernarySurfaceConfig(
// Blocks.AIR.getDefaultState(),
// Blocks.AIR.getDefaultState(),
// Blocks.AIR.getDefaultState()
// )
// )
// .precipitation(Biome.Precipitation.NONE).category(Biome.Category.NETHER)
// .depth(0)
// .scale(0)
// .temperature(0.8f)
// .downfall(0)
// .effects(createEffect(white))
// .parent(null)
// .noises(ImmutableList.of())
// );
// }
//
// private static BiomeEffects createEffect(boolean white) {
// BiomeEffects.Builder builder = new BiomeEffects.Builder()
// .waterColor(white ? 0xFFFFFF : 0x000000)
// .waterFogColor(white ? 0xFFFFFF : 0x000000)
// .fogColor(white ? 0xFFFFFF : 0x000000);
// if (white) builder.loopSound(ModSoundEvents.WHITE_VOID);
// return builder.build();
// }
//}

View file

@ -8,9 +8,11 @@ import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.block.BlockState;
import net.minecraft.structure.StructureManager;
import net.minecraft.util.registry.DynamicRegistryManager;
import net.minecraft.world.BlockView;
import net.minecraft.world.ChunkRegion;
import net.minecraft.world.Heightmap;
import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.biome.source.BiomeSource;
import net.minecraft.world.chunk.Chunk;
@ -22,7 +24,7 @@ import net.minecraft.world.gen.chunk.VerticalBlockSample;
public class BlankChunkGenerator extends ChunkGenerator {
public static final Codec<BlankChunkGenerator> CODEC = RecordCodecBuilder.create((instance) ->
instance.group(
BiomeSource.field_24713.fieldOf("biome_source")
BiomeSource.CODEC.fieldOf("biome_source")
.forGetter((generator) -> generator.biomeSource)
).apply(instance, instance.stable(BlankChunkGenerator::new))
);
@ -32,7 +34,7 @@ public class BlankChunkGenerator extends ChunkGenerator {
}
@Override
protected Codec<? extends ChunkGenerator> method_28506() {
public Codec<? extends ChunkGenerator> getCodec() {
return CODEC;
}
@ -50,13 +52,11 @@ public class BlankChunkGenerator extends ChunkGenerator {
}
@Override
public void setStructureStarts(StructureAccessor structureAccessor, Chunk chunk, StructureManager structureManager, long l) {
public void setStructureStarts(DynamicRegistryManager dynamicRegistryManager, StructureAccessor structureAccessor, Chunk chunk, StructureManager structureManager, long worldSeed) {
}
@Override
public void addStructureReferences(WorldAccess world, StructureAccessor accessor, Chunk chunk) {
public void addStructureReferences(StructureWorldAccess structureWorldAccess, StructureAccessor accessor, Chunk chunk) {
}
@Override

View file

@ -6,8 +6,8 @@ import java.util.Map;
import org.dimdev.annotatednbt.AnnotatedNbt;
import org.dimdev.annotatednbt.Saved;
import org.dimdev.dimdoors.ModConfig;
import org.dimdev.dimdoors.world.ModDimensions;
import org.dimdev.dimdoors.util.math.GridUtil;
import org.dimdev.dimdoors.world.ModDimensions;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.world.ServerWorld;

View file

@ -3,8 +3,8 @@ package org.dimdev.dimdoors.world.pocket;
import org.dimdev.annotatednbt.AnnotatedNbt;
import org.dimdev.annotatednbt.Saved;
import org.dimdev.dimdoors.ModConfig;
import org.dimdev.dimdoors.world.ModDimensions;
import org.dimdev.dimdoors.util.Location;
import org.dimdev.dimdoors.world.ModDimensions;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.world.ServerWorld;

View file

@ -10,7 +10,13 @@ import java.util.stream.Collectors;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import net.minecraft.nbt.*;
import net.minecraft.nbt.AbstractNumberTag;
import net.minecraft.nbt.ByteTag;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.EndTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.StringTag;
import net.minecraft.nbt.Tag;
public class NbtReader extends JsonReader {
private static final Reader UNREADABLE_READER = new Reader() {

View file

@ -13,7 +13,7 @@ import net.minecraft.nbt.EndTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
import static net.minecraft.datafixer.NbtOps.INSTANCE;
import static net.minecraft.nbt.NbtOps.INSTANCE;
public final class NbtWriter extends JsonWriter {
private static final Writer UNWRITABLE_WRITER = new Writer() {

View file

@ -3,7 +3,7 @@
"type": "dimdoors:blank",
"biome_source": {
"type": "minecraft:fixed",
"biome": "dimdoors:dangerous_black_void"
"biome": "dimdoors:limbo"
}
},
"type": "dimdoors:pocket"

View file

@ -0,0 +1,54 @@
{
"type": "dimdoors:limbo",
"generator": {
"type": "dimdoors:limbo_chunk_generator",
"biome_source": {
"type": "dimdoors:limbo_biome_source"
},
"settings": {
"bedrock_floor_position": 0,
"bedrock_roof_position": -1,
"disable_mob_generation": false,
"sea_level": 8,
"structures": {
"structures": {}
},
"noise": {
"density_factor": 1,
"density_offset": -0.16875,
"simplex_surface_noise": true,
"random_density_offset": true,
"island_noise_override": false,
"amplified": true,
"size_horizontal": 2,
"size_vertical": 4,
"height": 128,
"sampling": {
"xz_scale": 0.9999999814507745,
"y_scale": 1.502539814507745,
"xz_factor": 80,
"y_factor": 120
},
"bottom_slide": {
"target": 60,
"size": 2,
"offset": 2
},
"top_slide": {
"target": -1,
"size": 3,
"offset": 0
}
},
"default_block": {
"Name": "dimdoors:unravelled_fabric"
},
"default_fluid": {
"Name": "dimdoors:eternal_fluid",
"Properties": {
"level": "0"
}
}
}
}
}

View file

@ -3,7 +3,7 @@
"type": "dimdoors:blank",
"biome_source": {
"type": "minecraft:fixed",
"biome": "dimdoors:white_void"
"biome": "dimdoors:limbo"
}
},
"type": "dimdoors:pocket"

View file

@ -3,7 +3,7 @@
"type": "dimdoors:blank",
"biome_source": {
"type": "minecraft:fixed",
"biome": "dimdoors:black_void"
"biome": "dimdoors:limbo"
}
},
"type": "dimdoors:pocket"

View file

@ -11,5 +11,6 @@
"respawn_anchor_works": true,
"bed_works" : false,
"piglin_safe" : false,
"fixed_time" : 6000
"fixed_time" : 6000,
"coordinate_scale": 4
}

View file

@ -10,5 +10,6 @@
"has_raids" : false,
"respawn_anchor_works": false,
"bed_works" : false,
"piglin_safe" : false
"piglin_safe" : false,
"coordinate_scale": 4
}

View file

@ -107,7 +107,7 @@
},
{
"type": "item",
"name": "dimdoors:fabric",
"name": "dimdoors:lime_fabric",
"functions": [
{
"function": "set_count",
@ -115,10 +115,6 @@
"min": 16,
"max": 64
}
},
{
"function": "set_data",
"data": 15
}
],
"weight": 2

View file

@ -0,0 +1,64 @@
{
"effects": {
"mood_sound": {
"sound": "minecraft:ambient.cave",
"tick_delay": 6000,
"block_search_extent": 8,
"offset": 2.0
},
"sky_color": 4210752,
"fog_color": 0,
"water_color": 0,
"water_fog_color": 0
},
"surface_builder": {
"config": {
"top_material": {
"Name": "dimdoors:unravelled_fabric"
},
"under_material": {
"Name": "dimdoors:unravelled_fabric"
},
"underwater_material": {
"Name": "dimdoors:eternal_fluid"
}
},
"type": "minecraft:default"
},
"carvers": {
"air": []
},
"features": [
[],
[],
[],
[],
[],
[],
[],
[]
],
"starts": [],
"spawners": {
"monster": [
{
"type": "dimdoors:monolith",
"weight": 50,
"minCount": 1,
"maxCount": 4
}
],
"creature": [],
"ambient": [],
"water_creature": [],
"water_ambient": [],
"misc": []
},
"spawn_costs": {},
"precipitation": "none",
"temperature": 2.0,
"downfall": 0.0,
"category": "none",
"depth": 0.8,
"scale": 0.9
}

View file

@ -1,68 +0,0 @@
{
"type": "dimdoors:limbo",
"generator": {
"type": "minecraft:noise",
"seed": 341873128753,
"biome_source": {
"type": "minecraft:multi_noise",
"seed": 341873128753,
"biomes": [
{
"parameters": {
"altitude": 0.20,
"weirdness": 0.20,
"offset": 0.00,
"temperature": 0.00,
"humidity": 0.00
},
"biome": "dimdoors:limbo"
}
]
},
"settings": {
"bedrock_floor_position": 0,
"bedrock_roof_position": -1,
"disable_mob_generation": false,
"sea_level": 32,
"structures": {
"structures": {}
},
"noise": {
"density_factor": 1,
"density_offset": -0.26875,
"simplex_surface_noise": false,
"random_density_offset": true,
"island_noise_override": false,
"amplified": true,
"size_horizontal": 1,
"size_vertical": 4,
"height": 178,
"sampling": {
"xz_scale": 1,
"y_scale": 3,
"xz_factor": 60,
"y_factor": 240
},
"bottom_slide": {
"target": -30,
"size": 0,
"offset": 0
},
"top_slide": {
"target": -10,
"size": 3,
"offset": 0
}
},
"default_block": {
"Name": "dimdoors:unravelled_fabric"
},
"default_fluid": {
"Name": "minecraft:water",
"Properties": {
"level": "0"
}
}
}
}
}

View file

@ -3,10 +3,11 @@
"package": "org.dimdev.dimdoors.mixin",
"compatibilityLevel": "JAVA_8",
"mixins": [
"DirectionMixin"
"BuiltinBiomesAccessor",
"DirectionAccessor"
],
"client": [
"InGameHudMixin"
"client.InGameHudMixin"
],
"injectors": {
"defaultRequire": 1

View file

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