mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-24 09:06:39 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import com.dfsek.terra.getGitHash
|
import com.dfsek.terra.getGitHash
|
||||||
|
|
||||||
val versionObj = Version("5", "3", "0", true)
|
val versionObj = Version("5", "3", "1", true)
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
version = versionObj
|
version = versionObj
|
||||||
|
|||||||
@@ -37,13 +37,13 @@ import com.dfsek.terra.config.lang.LangUtil;
|
|||||||
import com.dfsek.terra.config.lang.Language;
|
import com.dfsek.terra.config.lang.Language;
|
||||||
import com.dfsek.terra.config.pack.ConfigPack;
|
import com.dfsek.terra.config.pack.ConfigPack;
|
||||||
import com.dfsek.terra.config.templates.BiomeTemplate;
|
import com.dfsek.terra.config.templates.BiomeTemplate;
|
||||||
|
import com.dfsek.terra.fabric.generation.FabricChunkGeneratorWrapper;
|
||||||
|
import com.dfsek.terra.fabric.generation.PopulatorFeature;
|
||||||
|
import com.dfsek.terra.fabric.generation.TerraBiomeSource;
|
||||||
import com.dfsek.terra.fabric.handle.FabricItemHandle;
|
import com.dfsek.terra.fabric.handle.FabricItemHandle;
|
||||||
import com.dfsek.terra.fabric.handle.FabricWorldHandle;
|
import com.dfsek.terra.fabric.handle.FabricWorldHandle;
|
||||||
import com.dfsek.terra.fabric.mixin.access.BiomeEffectsAccessor;
|
import com.dfsek.terra.fabric.mixin.access.BiomeEffectsAccessor;
|
||||||
import com.dfsek.terra.fabric.mixin.access.GeneratorTypeAccessor;
|
import com.dfsek.terra.fabric.mixin.access.GeneratorTypeAccessor;
|
||||||
import com.dfsek.terra.fabric.generation.TerraBiomeSource;
|
|
||||||
import com.dfsek.terra.fabric.generation.PopulatorFeature;
|
|
||||||
import com.dfsek.terra.fabric.generation.FabricChunkGeneratorWrapper;
|
|
||||||
import com.dfsek.terra.profiler.Profiler;
|
import com.dfsek.terra.profiler.Profiler;
|
||||||
import com.dfsek.terra.profiler.ProfilerImpl;
|
import com.dfsek.terra.profiler.ProfilerImpl;
|
||||||
import com.dfsek.terra.registry.exception.DuplicateEntryException;
|
import com.dfsek.terra.registry.exception.DuplicateEntryException;
|
||||||
@@ -292,32 +292,11 @@ public class TerraFabricPlugin implements TerraPlugin, ModInitializer {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void packInit() {
|
||||||
public void onInitialize() {
|
logger.info("Loading config packs...");
|
||||||
instance = this;
|
|
||||||
|
|
||||||
this.dataFolder = new File(FabricLoader.getInstance().getConfigDir().toFile(), "Terra");
|
|
||||||
saveDefaultConfig();
|
|
||||||
config.load(this);
|
|
||||||
LangUtil.load(config.getLanguage(), this);
|
|
||||||
logger.info("Initializing Terra...");
|
|
||||||
|
|
||||||
if(!addonRegistry.loadAll()) {
|
|
||||||
throw new IllegalStateException("Failed to load addons. Please correct addon installations to continue.");
|
|
||||||
}
|
|
||||||
logger.info("Loaded addons.");
|
|
||||||
|
|
||||||
registry.loadAll(this);
|
registry.loadAll(this);
|
||||||
|
|
||||||
logger.info("Loaded packs.");
|
|
||||||
|
|
||||||
Registry.register(Registry.FEATURE, new Identifier("terra", "flora_populator"), POPULATOR_FEATURE);
|
|
||||||
RegistryKey<ConfiguredFeature<?, ?>> floraKey = RegistryKey.of(Registry.CONFIGURED_FEATURE_WORLDGEN, new Identifier("terra", "flora_populator"));
|
|
||||||
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, floraKey.getValue(), POPULATOR_CONFIGURED_FEATURE);
|
|
||||||
|
|
||||||
registry.forEach(pack -> pack.getBiomeRegistry().forEach((id, biome) -> Registry.register(BuiltinRegistries.BIOME, new Identifier("terra", createBiomeID(pack, id)), createBiome(biome)))); // Register all Terra biomes.
|
registry.forEach(pack -> pack.getBiomeRegistry().forEach((id, biome) -> Registry.register(BuiltinRegistries.BIOME, new Identifier("terra", createBiomeID(pack, id)), createBiome(biome)))); // Register all Terra biomes.
|
||||||
Registry.register(Registry.CHUNK_GENERATOR, new Identifier("terra:terra"), FabricChunkGeneratorWrapper.CODEC);
|
|
||||||
Registry.register(Registry.BIOME_SOURCE, new Identifier("terra:terra"), TerraBiomeSource.CODEC);
|
|
||||||
|
|
||||||
if(FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
|
if(FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
|
||||||
registry.forEach(pack -> {
|
registry.forEach(pack -> {
|
||||||
@@ -333,6 +312,33 @@ public class TerraFabricPlugin implements TerraPlugin, ModInitializer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.info("Loaded packs.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onInitialize() {
|
||||||
|
instance = this;
|
||||||
|
|
||||||
|
this.dataFolder = new File(FabricLoader.getInstance().getConfigDir().toFile(), "Terra");
|
||||||
|
saveDefaultConfig();
|
||||||
|
config.load(this);
|
||||||
|
LangUtil.load(config.getLanguage(), this);
|
||||||
|
logger.info("Initializing Terra...");
|
||||||
|
|
||||||
|
if(!addonRegistry.loadAll()) {
|
||||||
|
throw new IllegalStateException("Failed to load addons. Please correct addon installations to continue.");
|
||||||
|
}
|
||||||
|
logger.info("Loaded addons.");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Registry.register(Registry.FEATURE, new Identifier("terra", "flora_populator"), POPULATOR_FEATURE);
|
||||||
|
RegistryKey<ConfiguredFeature<?, ?>> floraKey = RegistryKey.of(Registry.CONFIGURED_FEATURE_WORLDGEN, new Identifier("terra", "flora_populator"));
|
||||||
|
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, floraKey.getValue(), POPULATOR_CONFIGURED_FEATURE);
|
||||||
|
|
||||||
|
Registry.register(Registry.CHUNK_GENERATOR, new Identifier("terra:terra"), FabricChunkGeneratorWrapper.CODEC);
|
||||||
|
Registry.register(Registry.BIOME_SOURCE, new Identifier("terra:terra"), TerraBiomeSource.CODEC);
|
||||||
|
|
||||||
CommandManager manager = new TerraCommandManager(this);
|
CommandManager manager = new TerraCommandManager(this);
|
||||||
try {
|
try {
|
||||||
CommandUtil.registerAll(manager);
|
CommandUtil.registerAll(manager);
|
||||||
@@ -340,7 +346,6 @@ public class TerraFabricPlugin implements TerraPlugin, ModInitializer {
|
|||||||
e.printStackTrace(); // TODO do something here even though this should literally never happen
|
e.printStackTrace(); // TODO do something here even though this should literally never happen
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> {
|
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> {
|
||||||
int max = manager.getMaxArgumentDepth();
|
int max = manager.getMaxArgumentDepth();
|
||||||
RequiredArgumentBuilder<ServerCommandSource, String> arg = argument("arg" + (max - 1), StringArgumentType.word());
|
RequiredArgumentBuilder<ServerCommandSource, String> arg = argument("arg" + (max - 1), StringArgumentType.word());
|
||||||
@@ -355,7 +360,7 @@ public class TerraFabricPlugin implements TerraPlugin, ModInitializer {
|
|||||||
//dispatcher.register(literal("te").redirect(root));
|
//dispatcher.register(literal("te").redirect(root));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
logger.info("Finished initialization.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private RequiredArgumentBuilder<ServerCommandSource, String> assemble(RequiredArgumentBuilder<ServerCommandSource, String> in, CommandManager manager) {
|
private RequiredArgumentBuilder<ServerCommandSource, String> assemble(RequiredArgumentBuilder<ServerCommandSource, String> in, CommandManager manager) {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.dfsek.terra.fabric.generation;
|
|||||||
|
|
||||||
import com.dfsek.terra.api.platform.world.Chunk;
|
import com.dfsek.terra.api.platform.world.Chunk;
|
||||||
import com.dfsek.terra.api.platform.world.World;
|
import com.dfsek.terra.api.platform.world.World;
|
||||||
import com.dfsek.terra.fabric.generation.FabricChunkGeneratorWrapper;
|
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.StructureWorldAccess;
|
import net.minecraft.world.StructureWorldAccess;
|
||||||
@@ -22,6 +21,7 @@ public class PopulatorFeature extends Feature<DefaultFeatureConfig> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) {
|
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) {
|
||||||
|
if(!(chunkGenerator instanceof FabricChunkGeneratorWrapper)) return true;
|
||||||
FabricChunkGeneratorWrapper gen = (FabricChunkGeneratorWrapper) chunkGenerator;
|
FabricChunkGeneratorWrapper gen = (FabricChunkGeneratorWrapper) chunkGenerator;
|
||||||
gen.getHandle().getPopulators().forEach(populator -> populator.populate((World) world, (Chunk) world));
|
gen.getHandle().getPopulators().forEach(populator -> populator.populate((World) world, (Chunk) world));
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ package com.dfsek.terra.fabric.mixin.implementations;
|
|||||||
import net.minecraft.world.biome.Biome;
|
import net.minecraft.world.biome.Biome;
|
||||||
import org.spongepowered.asm.mixin.Implements;
|
import org.spongepowered.asm.mixin.Implements;
|
||||||
import org.spongepowered.asm.mixin.Interface;
|
import org.spongepowered.asm.mixin.Interface;
|
||||||
|
import org.spongepowered.asm.mixin.Intrinsic;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
|
||||||
@Mixin(Biome.class)
|
@Mixin(Biome.class)
|
||||||
@Implements(@Interface(iface = com.dfsek.terra.api.platform.world.Biome.class, prefix = "terra$", remap = Interface.Remap.NONE))
|
@Implements(@Interface(iface = com.dfsek.terra.api.platform.world.Biome.class, prefix = "terra$", remap = Interface.Remap.NONE))
|
||||||
public abstract class BiomeMixin {
|
public abstract class BiomeMixin {
|
||||||
|
@Intrinsic
|
||||||
public Object terra$getHandle() {
|
public Object terra$getHandle() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ package com.dfsek.terra.fabric.mixin.implementations;
|
|||||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||||
import org.spongepowered.asm.mixin.Implements;
|
import org.spongepowered.asm.mixin.Implements;
|
||||||
import org.spongepowered.asm.mixin.Interface;
|
import org.spongepowered.asm.mixin.Interface;
|
||||||
|
import org.spongepowered.asm.mixin.Intrinsic;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
|
||||||
@Mixin(ChunkGenerator.class)
|
@Mixin(ChunkGenerator.class)
|
||||||
@Implements(@Interface(iface = com.dfsek.terra.api.platform.world.generator.ChunkGenerator.class, prefix = "terra$", remap = Interface.Remap.NONE))
|
@Implements(@Interface(iface = com.dfsek.terra.api.platform.world.generator.ChunkGenerator.class, prefix = "terra$", remap = Interface.Remap.NONE))
|
||||||
public abstract class ChunkGeneratorMixin {
|
public abstract class ChunkGeneratorMixin {
|
||||||
|
@Intrinsic
|
||||||
public Object terra$getHandle() {
|
public Object terra$getHandle() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import net.minecraft.world.World;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.spongepowered.asm.mixin.Implements;
|
import org.spongepowered.asm.mixin.Implements;
|
||||||
import org.spongepowered.asm.mixin.Interface;
|
import org.spongepowered.asm.mixin.Interface;
|
||||||
|
import org.spongepowered.asm.mixin.Intrinsic;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
@@ -29,6 +30,7 @@ public abstract class BlockEntityMixin {
|
|||||||
@Shadow
|
@Shadow
|
||||||
public abstract boolean hasWorld();
|
public abstract boolean hasWorld();
|
||||||
|
|
||||||
|
@Intrinsic
|
||||||
public Object terra$getHandle() {
|
public Object terra$getHandle() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import net.minecraft.block.BlockState;
|
|||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import org.spongepowered.asm.mixin.Implements;
|
import org.spongepowered.asm.mixin.Implements;
|
||||||
import org.spongepowered.asm.mixin.Interface;
|
import org.spongepowered.asm.mixin.Interface;
|
||||||
|
import org.spongepowered.asm.mixin.Intrinsic;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
@@ -17,6 +18,7 @@ public abstract class BlockMixin {
|
|||||||
@Shadow
|
@Shadow
|
||||||
private BlockState defaultState;
|
private BlockState defaultState;
|
||||||
|
|
||||||
|
@Intrinsic
|
||||||
public Object terra$getHandle() {
|
public Object terra$getHandle() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.dfsek.terra.fabric.mixin.implementations.block.BlockEntityMixin;
|
|||||||
import net.minecraft.block.entity.LootableContainerBlockEntity;
|
import net.minecraft.block.entity.LootableContainerBlockEntity;
|
||||||
import org.spongepowered.asm.mixin.Implements;
|
import org.spongepowered.asm.mixin.Implements;
|
||||||
import org.spongepowered.asm.mixin.Interface;
|
import org.spongepowered.asm.mixin.Interface;
|
||||||
|
import org.spongepowered.asm.mixin.Intrinsic;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
|
||||||
@Mixin(LootableContainerBlockEntity.class)
|
@Mixin(LootableContainerBlockEntity.class)
|
||||||
@@ -15,6 +16,7 @@ public abstract class LootableContainerBlockEntityMixin extends BlockEntityMixin
|
|||||||
return (Inventory) this;
|
return (Inventory) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Intrinsic
|
||||||
public Object terra$getHandle() {
|
public Object terra$getHandle() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,5 @@ public abstract class ChunkRegionMixin {
|
|||||||
((ChunkRegion) (Object) this).setBlockState(new BlockPos(x + (centerChunkX << 4), y, z + (centerChunkZ << 4)), ((FabricBlockData) blockData).getHandle(), 0);
|
((ChunkRegion) (Object) this).setBlockState(new BlockPos(x + (centerChunkX << 4), y, z + (centerChunkZ << 4)), ((FabricBlockData) blockData).getHandle(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object terra$getHandle() {
|
// getHandle already added in world/ChunkRegionMixin.
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Implements;
|
import org.spongepowered.asm.mixin.Implements;
|
||||||
import org.spongepowered.asm.mixin.Interface;
|
import org.spongepowered.asm.mixin.Interface;
|
||||||
|
import org.spongepowered.asm.mixin.Intrinsic;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
@@ -47,6 +48,7 @@ public abstract class WorldChunkMixin {
|
|||||||
((net.minecraft.world.chunk.Chunk) this).setBlockState(new BlockPos(x, y, z), ((FabricBlockData) blockData).getHandle(), false);
|
((net.minecraft.world.chunk.Chunk) this).setBlockState(new BlockPos(x, y, z), ((FabricBlockData) blockData).getHandle(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Intrinsic
|
||||||
public Object terra$getHandle() {
|
public Object terra$getHandle() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import net.minecraft.world.chunk.ProtoChunk;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.spongepowered.asm.mixin.Implements;
|
import org.spongepowered.asm.mixin.Implements;
|
||||||
import org.spongepowered.asm.mixin.Interface;
|
import org.spongepowered.asm.mixin.Interface;
|
||||||
|
import org.spongepowered.asm.mixin.Intrinsic;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ public abstract class ProtoChunkMixin {
|
|||||||
((net.minecraft.world.chunk.Chunk) this).setBlockState(new BlockPos(x, y, z), ((FabricBlockData) blockData).getHandle(), false);
|
((net.minecraft.world.chunk.Chunk) this).setBlockState(new BlockPos(x, y, z), ((FabricBlockData) blockData).getHandle(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Intrinsic
|
||||||
public Object terra$getHandle() {
|
public Object terra$getHandle() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import net.minecraft.text.Text;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import org.spongepowered.asm.mixin.Implements;
|
import org.spongepowered.asm.mixin.Implements;
|
||||||
import org.spongepowered.asm.mixin.Interface;
|
import org.spongepowered.asm.mixin.Interface;
|
||||||
|
import org.spongepowered.asm.mixin.Intrinsic;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
@@ -29,6 +30,7 @@ public abstract class EntityMixin {
|
|||||||
@Shadow
|
@Shadow
|
||||||
public abstract void sendSystemMessage(Text message, UUID senderUuid);
|
public abstract void sendSystemMessage(Text message, UUID senderUuid);
|
||||||
|
|
||||||
|
@Intrinsic
|
||||||
public Object terra$getHandle() {
|
public Object terra$getHandle() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ package com.dfsek.terra.fabric.mixin.implementations.entity;
|
|||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import org.spongepowered.asm.mixin.Implements;
|
import org.spongepowered.asm.mixin.Implements;
|
||||||
import org.spongepowered.asm.mixin.Interface;
|
import org.spongepowered.asm.mixin.Interface;
|
||||||
|
import org.spongepowered.asm.mixin.Intrinsic;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
|
||||||
@Mixin(EntityType.class)
|
@Mixin(EntityType.class)
|
||||||
@Implements(@Interface(iface = com.dfsek.terra.api.platform.entity.EntityType.class, prefix = "terra$", remap = Interface.Remap.NONE))
|
@Implements(@Interface(iface = com.dfsek.terra.api.platform.entity.EntityType.class, prefix = "terra$", remap = Interface.Remap.NONE))
|
||||||
public abstract class EntityTypeMixin {
|
public abstract class EntityTypeMixin {
|
||||||
|
@Intrinsic
|
||||||
public Object terra$getHandle() {
|
public Object terra$getHandle() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import net.minecraft.text.LiteralText;
|
|||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import org.spongepowered.asm.mixin.Implements;
|
import org.spongepowered.asm.mixin.Implements;
|
||||||
import org.spongepowered.asm.mixin.Interface;
|
import org.spongepowered.asm.mixin.Interface;
|
||||||
|
import org.spongepowered.asm.mixin.Intrinsic;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
@@ -19,6 +20,7 @@ public abstract class ServerCommandSourceMixin {
|
|||||||
sendFeedback(new LiteralText(message), true);
|
sendFeedback(new LiteralText(message), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Intrinsic
|
||||||
public Object terra$getHandle() {
|
public Object terra$getHandle() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,13 @@ import net.minecraft.block.entity.LockableContainerBlockEntity;
|
|||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import org.spongepowered.asm.mixin.Implements;
|
import org.spongepowered.asm.mixin.Implements;
|
||||||
import org.spongepowered.asm.mixin.Interface;
|
import org.spongepowered.asm.mixin.Interface;
|
||||||
|
import org.spongepowered.asm.mixin.Intrinsic;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
|
||||||
@Mixin(LockableContainerBlockEntity.class)
|
@Mixin(LockableContainerBlockEntity.class)
|
||||||
@Implements(@Interface(iface = Inventory.class, prefix = "terra$", remap = Interface.Remap.NONE))
|
@Implements(@Interface(iface = Inventory.class, prefix = "terra$", remap = Interface.Remap.NONE))
|
||||||
public class LockableContainerBlockEntityMixin {
|
public class LockableContainerBlockEntityMixin {
|
||||||
|
@Intrinsic
|
||||||
public Object terra$getHandle() {
|
public Object terra$getHandle() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.dfsek.terra.api.platform.inventory.ItemStack;
|
|||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import org.spongepowered.asm.mixin.Implements;
|
import org.spongepowered.asm.mixin.Implements;
|
||||||
import org.spongepowered.asm.mixin.Interface;
|
import org.spongepowered.asm.mixin.Interface;
|
||||||
|
import org.spongepowered.asm.mixin.Intrinsic;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
@@ -13,6 +14,7 @@ public abstract class ItemMixin {
|
|||||||
@Shadow
|
@Shadow
|
||||||
public abstract int getMaxDamage();
|
public abstract int getMaxDamage();
|
||||||
|
|
||||||
|
@Intrinsic
|
||||||
public Object terra$getHandle() {
|
public Object terra$getHandle() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public abstract class ItemStackMixin {
|
|||||||
setTag(((ItemStack) (Object) meta).getTag());
|
setTag(((ItemStack) (Object) meta).getTag());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Intrinsic
|
||||||
public Object terra$getHandle() {
|
public Object terra$getHandle() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import net.minecraft.enchantment.Enchantment;
|
|||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import org.spongepowered.asm.mixin.Implements;
|
import org.spongepowered.asm.mixin.Implements;
|
||||||
import org.spongepowered.asm.mixin.Interface;
|
import org.spongepowered.asm.mixin.Interface;
|
||||||
|
import org.spongepowered.asm.mixin.Intrinsic;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
@@ -19,6 +20,7 @@ public abstract class EnchantmentMixin {
|
|||||||
@Shadow
|
@Shadow
|
||||||
public abstract boolean canCombine(Enchantment other);
|
public abstract boolean canCombine(Enchantment other);
|
||||||
|
|
||||||
|
@Intrinsic
|
||||||
public Object terra$getHandle() {
|
public Object terra$getHandle() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public abstract class ItemStackMetaMixin {
|
|||||||
@Shadow
|
@Shadow
|
||||||
public abstract void addEnchantment(net.minecraft.enchantment.Enchantment enchantment, int level);
|
public abstract void addEnchantment(net.minecraft.enchantment.Enchantment enchantment, int level);
|
||||||
|
|
||||||
|
@Intrinsic
|
||||||
public Object terra$getHandle() {
|
public Object terra$getHandle() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ public abstract class ChunkRegionMixin {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Intrinsic
|
||||||
public Object terra$getHandle() {
|
public Object terra$getHandle() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ public abstract class ServerWorldMixin {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Intrinsic
|
||||||
public Object terra$getHandle() {
|
public Object terra$getHandle() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.dfsek.terra.fabric.mixin.init;
|
||||||
|
|
||||||
|
import com.dfsek.terra.fabric.TerraFabricPlugin;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.RunArgs;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Mixin(MinecraftClient.class)
|
||||||
|
public class MinecraftClientMixin {
|
||||||
|
@Inject(method = "<init>", at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/client/util/WindowProvider;createWindow(Lnet/minecraft/client/WindowSettings;Ljava/lang/String;Ljava/lang/String;)Lnet/minecraft/client/util/Window;", // sorta arbitrary position, after mod init, before window opens
|
||||||
|
shift = At.Shift.BEFORE))
|
||||||
|
public void injectConstructor(RunArgs args, CallbackInfo callbackInfo) {
|
||||||
|
TerraFabricPlugin.getInstance().packInit(); // Load during MinecraftClient construction, after other mods have registered blocks and stuff
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.dfsek.terra.fabric.mixin.init;
|
||||||
|
|
||||||
|
import com.dfsek.terra.fabric.TerraFabricPlugin;
|
||||||
|
import net.minecraft.server.Main;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Mixin(Main.class)
|
||||||
|
public class ServerMainMixin {
|
||||||
|
@Inject(method = "main([Ljava/lang/String;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/registry/DynamicRegistryManager;create()Lnet/minecraft/util/registry/DynamicRegistryManager$Impl;"))
|
||||||
|
private static void injectConstructor(String[] args, CallbackInfo ci) {
|
||||||
|
TerraFabricPlugin.getInstance().packInit(); // Load during MinecraftServer construction, after other mods have registered blocks and stuff
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,9 +33,12 @@
|
|||||||
"implementations.world.ServerWorldMixin"
|
"implementations.world.ServerWorldMixin"
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
"access.GeneratorTypeAccessor"
|
"access.GeneratorTypeAccessor",
|
||||||
|
"init.MinecraftClientMixin"
|
||||||
|
],
|
||||||
|
"server": [
|
||||||
|
"init.ServerMainMixin"
|
||||||
],
|
],
|
||||||
"server": [],
|
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user