fix refmap issues

This commit is contained in:
dfsek
2021-05-03 20:40:56 -07:00
parent 6614d19845
commit 7595896831
8 changed files with 50 additions and 4 deletions

View File

@@ -33,7 +33,7 @@ dependencies {
configure<LoomGradleExtension> {
accessWidener("src/main/resources/terra.accesswidener")
refmapName = "terra.refmap.json"
refmapName = "terra-refmap.json"
}
val remapped = tasks.register<RemapJarTask>("remapShadedJar") {

View File

@@ -41,7 +41,7 @@ public abstract class EntityMixin {
teleport(location.getX(), location.getY(), location.getZ());
}
public World getWorld() {
public World terra$getWorld() {
return (World) world;
}

View File

@@ -5,6 +5,7 @@ import com.dfsek.terra.api.platform.inventory.item.ItemMeta;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Implements;
import org.spongepowered.asm.mixin.Interface;
import org.spongepowered.asm.mixin.Intrinsic;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -20,6 +21,9 @@ public abstract class ItemStackMixin {
@Shadow
public abstract net.minecraft.item.Item getItem();
@Shadow
public abstract boolean isDamageable();
public int terra$getAmount() {
return getCount();
}
@@ -43,4 +47,9 @@ public abstract class ItemStackMixin {
public Object terra$getHandle() {
return this;
}
@Intrinsic
public boolean terra$isDamageable() {
return isDamageable();
}
}

View File

@@ -4,6 +4,7 @@ import com.dfsek.terra.api.platform.inventory.item.Damageable;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Implements;
import org.spongepowered.asm.mixin.Interface;
import org.spongepowered.asm.mixin.Intrinsic;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -13,7 +14,23 @@ public abstract class ItemStackDamageableMixin {
@Shadow
public abstract boolean isDamaged();
@Shadow
public abstract int getDamage();
@Shadow
public abstract void setDamage(int damage);
public boolean terra$hasDamage() {
return isDamaged();
}
@Intrinsic
public void terra$setDamage(int damage) {
setDamage(damage);
}
@Intrinsic
public int terra$getDamage() {
return getDamage();
}
}

View File

@@ -18,6 +18,7 @@ import net.minecraft.world.ServerWorldAccess;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Implements;
import org.spongepowered.asm.mixin.Interface;
import org.spongepowered.asm.mixin.Intrinsic;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -28,6 +29,10 @@ public abstract class ChunkRegionMixin {
@Final
private ServerWorld world;
@Shadow
@Final
private long seed;
public int terra$getMaxHeight() {
return ((ChunkRegion) (Object) this).getDimensionHeight();
}
@@ -53,6 +58,11 @@ public abstract class ChunkRegionMixin {
return (Entity) entity;
}
@Intrinsic
public long terra$getSeed() {
return seed;
}
public int terra$getMinHeight() {
return 0;
}

View File

@@ -16,11 +16,16 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ServerWorldAccess;
import org.spongepowered.asm.mixin.Implements;
import org.spongepowered.asm.mixin.Interface;
import org.spongepowered.asm.mixin.Intrinsic;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(ServerWorld.class)
@Implements(@Interface(iface = World.class, prefix = "terra$", remap = Interface.Remap.NONE))
public abstract class ServerWorldMixin {
@Shadow
public abstract long getSeed();
public int terra$getMaxHeight() {
return ((ServerWorld) (Object) this).getDimensionHeight();
}
@@ -44,6 +49,11 @@ public abstract class ServerWorldMixin {
return (Entity) entity;
}
@Intrinsic
public long terra$getSeed() {
return getSeed();
}
public int terra$getMinHeight() {
return 0;
}

View File

@@ -20,7 +20,7 @@ apply(plugin = "net.minecraftforge.gradle")
apply(plugin = "org.spongepowered.mixin")
configure<org.spongepowered.asm.gradle.plugins.MixinExtension> {
add(sourceSets.main.get(), "terra.refmap.json")
add(sourceSets.main.get(), "terra-refmap.json")
}
plugins {

View File

@@ -2,7 +2,7 @@
"required": true,
"package": "com.dfsek.terra.forge.mixin",
"compatibilityLevel": "JAVA_8",
"refmap": "terra.refmap.json",
"refmap": "terra-refmap.json",
"mixins": [
],
"client": [