Init
This commit is contained in:
commit
a50d5c3f7e
|
@ -0,0 +1,5 @@
|
||||||
|
*.jar
|
||||||
|
.gradle
|
||||||
|
build/
|
||||||
|
run/
|
||||||
|
!gradle-wrapper.jar
|
|
@ -0,0 +1,21 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2022
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
|
@ -0,0 +1,49 @@
|
||||||
|
plugins {
|
||||||
|
id 'fabric-loom' version '0.12-SNAPSHOT'
|
||||||
|
id 'maven-publish'
|
||||||
|
}
|
||||||
|
|
||||||
|
version = project.mod_version
|
||||||
|
group = project.maven_group
|
||||||
|
|
||||||
|
repositories {}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||||
|
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||||
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||||
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||||
|
}
|
||||||
|
|
||||||
|
processResources {
|
||||||
|
inputs.property "version", project.version
|
||||||
|
filteringCharset "UTF-8"
|
||||||
|
|
||||||
|
filesMatching("fabric.mod.json") {
|
||||||
|
expand "version": project.version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def targetJavaVersion = 17
|
||||||
|
tasks.withType(JavaCompile).configureEach {
|
||||||
|
it.options.encoding = "UTF-8"
|
||||||
|
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
|
||||||
|
it.options.release = targetJavaVersion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
|
||||||
|
if (JavaVersion.current() < javaVersion) {
|
||||||
|
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
|
||||||
|
}
|
||||||
|
archivesBaseName = project.archives_base_name
|
||||||
|
withSourcesJar()
|
||||||
|
}
|
||||||
|
|
||||||
|
jar {
|
||||||
|
from("LICENSE") {
|
||||||
|
rename { "${it}_${project.archivesBaseName}" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
org.gradle.jvmargs=-Xmx1G
|
||||||
|
minecraft_version=1.18.2
|
||||||
|
yarn_mappings=1.18.2+build.4
|
||||||
|
loader_version=0.14.8
|
||||||
|
mod_version=1.0.0
|
||||||
|
maven_group=dev.tilera.modding
|
||||||
|
archives_base_name=palettefix
|
||||||
|
fabric_version=0.58.0+1.18.2
|
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
|
@ -0,0 +1,9 @@
|
||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = 'Fabric'
|
||||||
|
url = 'https://maven.fabricmc.net/'
|
||||||
|
}
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
package dev.tilera.modding.palettefix.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.util.crash.CrashException;
|
||||||
|
import net.minecraft.util.crash.CrashReport;
|
||||||
|
import net.minecraft.util.crash.CrashReportSection;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.ChunkPos;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
|
import net.minecraft.world.HeightLimitView;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
|
import net.minecraft.world.chunk.*;
|
||||||
|
import net.minecraft.world.gen.chunk.BlendingData;
|
||||||
|
import net.minecraft.world.gen.chunk.DebugChunkGenerator;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
|
@Mixin(WorldChunk.class)
|
||||||
|
public abstract class WorldChunkMixin extends Chunk {
|
||||||
|
|
||||||
|
@Final
|
||||||
|
@Shadow
|
||||||
|
World world;
|
||||||
|
|
||||||
|
public WorldChunkMixin(ChunkPos pos, UpgradeData upgradeData, HeightLimitView heightLimitView, Registry<Biome> biome, long inhabitedTime, @Nullable ChunkSection[] sectionArrayInitializer, @Nullable BlendingData blendingData) {
|
||||||
|
super(pos, upgradeData, heightLimitView, biome, inhabitedTime, sectionArrayInitializer, blendingData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author tilera
|
||||||
|
* @reason Prevent game from crashing
|
||||||
|
*/
|
||||||
|
@Overwrite
|
||||||
|
public BlockState getBlockState(BlockPos pos) {
|
||||||
|
int i = pos.getX();
|
||||||
|
int j = pos.getY();
|
||||||
|
int k = pos.getZ();
|
||||||
|
if (this.world.isDebugWorld()) {
|
||||||
|
BlockState blockState = null;
|
||||||
|
if (j == 60) {
|
||||||
|
blockState = Blocks.BARRIER.getDefaultState();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (j == 70) {
|
||||||
|
blockState = DebugChunkGenerator.getBlockState(i, k);
|
||||||
|
}
|
||||||
|
|
||||||
|
return blockState == null ? Blocks.AIR.getDefaultState() : blockState;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
int l = this.getSectionIndex(j);
|
||||||
|
if (l >= 0 && l < this.sectionArray.length) {
|
||||||
|
ChunkSection chunkSection = this.sectionArray[l];
|
||||||
|
if (!chunkSection.isEmpty()) {
|
||||||
|
return chunkSection.getBlockState(i & 15, j & 15, k & 15);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Blocks.AIR.getDefaultState();
|
||||||
|
} catch (EntryMissingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return Blocks.AIR.getDefaultState();
|
||||||
|
} catch (Throwable var8) {
|
||||||
|
CrashReport crashReport = CrashReport.create(var8, "Getting block state");
|
||||||
|
CrashReportSection crashReportSection = crashReport.addElement("Block being got");
|
||||||
|
crashReportSection.add("Location", () -> {
|
||||||
|
return CrashReportSection.createPositionString((WorldChunk)(Object) this, i, j, k);
|
||||||
|
});
|
||||||
|
throw new CrashException(crashReport);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"schemaVersion": 1,
|
||||||
|
"id": "palettefix",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"mixins": [
|
||||||
|
{
|
||||||
|
"config": "palettefix.mixins.json",
|
||||||
|
"environment": "*"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"required": true,
|
||||||
|
"minVersion": "0.8",
|
||||||
|
"package": "dev.tilera.modding.palettefix.mixin",
|
||||||
|
"compatibilityLevel": "JAVA_17",
|
||||||
|
"mixins": [
|
||||||
|
"WorldChunkMixin"
|
||||||
|
],
|
||||||
|
"injectors": {
|
||||||
|
"defaultRequire": 1
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue