mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-27 22:40:13 +00:00
[VERY VERY VERY BAD IDEA]
This commit is contained in:
1 parent
f0e7fea13b
commit
2fa0853e42
892 files changed
+13482
-53554
No files matched your search
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.fabric;
|
||||
|
||||
import art.arcane.iris.modded.ModdedForcedDatapack;
|
||||
import net.minecraft.server.packs.repository.PackRepository;
|
||||
import net.minecraft.server.packs.repository.RepositorySource;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
public final class FabricForcedDatapackSources {
|
||||
private FabricForcedDatapackSources() {
|
||||
}
|
||||
|
||||
public static void attach(PackRepository repository) {
|
||||
PackRepository activeRepository = Objects.requireNonNull(repository,
|
||||
"Iris cannot attach the forced startup datapack source to a null repository");
|
||||
Set<RepositorySource> merged = new LinkedHashSet<>(activeRepository.sources);
|
||||
merged.add(ModdedForcedDatapack.repositorySource());
|
||||
activeRepository.sources = merged;
|
||||
}
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.fabric;
|
||||
|
||||
import art.arcane.iris.modded.ModdedLoader;
|
||||
import art.arcane.iris.modded.service.ModdedTreeFellerService;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLevelEvents;
|
||||
import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents;
|
||||
import net.fabricmc.fabric.api.permission.v1.PermissionContextOwner;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.fabricmc.loader.api.ModContainer;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.permissions.PermissionLevel;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public final class FabricModdedLoader implements ModdedLoader {
|
||||
private static final Identifier TREE_FELLER_PERMISSION = Identifier.fromNamespaceAndPath("irisworldgen", "treefeller");
|
||||
|
||||
@Override
|
||||
public String platformName() {
|
||||
return "fabric";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String minecraftVersion() {
|
||||
return FabricLoader.getInstance().getModContainer("minecraft")
|
||||
.map((ModContainer container) -> container.getMetadata().getVersion().getFriendlyString())
|
||||
.orElse("unknown");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modVersion() {
|
||||
return FabricLoader.getInstance().getModContainer("irisworldgen")
|
||||
.map((ModContainer container) -> container.getMetadata().getVersion().getFriendlyString())
|
||||
.orElse("unknown");
|
||||
}
|
||||
|
||||
@Override
|
||||
public MinecraftServer currentServer() {
|
||||
Object instance = FabricLoader.getInstance().getGameInstance();
|
||||
return instance instanceof MinecraftServer server ? server : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidateLevelCache(MinecraftServer server) {
|
||||
// Intentionally empty: Fabric keeps no cached level view of its own (getAllLevels reads the live
|
||||
// map). Off-thread readers rely on the ModdedServerLevels snapshot, which the caller republishes.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireDynamicLevelLoad(MinecraftServer server, ServerLevel level) {
|
||||
ServerLevelEvents.LOAD.invoker().onLevelLoad(server, level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireDynamicLevelUnload(MinecraftServer server, ServerLevel level) {
|
||||
ServerLevelEvents.UNLOAD.invoker().onLevelUnload(server, level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean clientEnvironment() {
|
||||
return FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path configDir() {
|
||||
return FabricLoader.getInstance().getConfigDir();
|
||||
}
|
||||
|
||||
@Override
|
||||
public File modJar() {
|
||||
return FabricLoader.getInstance().getModContainer("irisworldgen")
|
||||
.flatMap((ModContainer container) -> container.getOrigin().getPaths().stream().findFirst())
|
||||
.map((Path p) -> p.toFile())
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTreeFellerPermission(ServerPlayer player) {
|
||||
return ((PermissionContextOwner) player).checkPermission(
|
||||
TREE_FELLER_PERMISSION,
|
||||
PermissionLevel.GAMEMASTERS
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTreeFellerBreak(
|
||||
ServerLevel level,
|
||||
ServerPlayer player,
|
||||
BlockPos position,
|
||||
BlockState state
|
||||
) {
|
||||
BlockEntity blockEntity = state.hasBlockEntity() ? level.getBlockEntity(position) : null;
|
||||
return ModdedTreeFellerService.runBreakProbe(() -> PlayerBlockBreakEvents.BEFORE.invoker()
|
||||
.beforeBlockBreak(level, player, position, state, blockEntity));
|
||||
}
|
||||
}
|
||||
@@ -1,54 +1,17 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.fabric;
|
||||
|
||||
import art.arcane.iris.modded.ModdedIrisPayload;
|
||||
import art.arcane.iris.modded.ModdedProtocolChannel;
|
||||
import art.arcane.iris.modded.ModdedProtocolDefinition;
|
||||
import art.arcane.iris.modded.ModdedProtocolHandler;
|
||||
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry;
|
||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
|
||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import art.arcane.volmlib.nativelib.minecraft26_2.fabric.NativeFabricProtocolNetworking;
|
||||
import art.arcane.volmlib.nativelib.minecraft26_2.modded.NativeProtocolCallbacks;
|
||||
|
||||
public final class FabricProtocolNetworking {
|
||||
private FabricProtocolNetworking() {
|
||||
}
|
||||
|
||||
public static void install() {
|
||||
PayloadTypeRegistry.clientboundPlay().register(ModdedIrisPayload.TYPE, ModdedIrisPayload.STREAM_CODEC);
|
||||
PayloadTypeRegistry.serverboundPlay().register(ModdedIrisPayload.TYPE, ModdedIrisPayload.STREAM_CODEC);
|
||||
ServerPlayNetworking.registerGlobalReceiver(ModdedIrisPayload.TYPE,
|
||||
(payload, context) -> ModdedProtocolHandler.onInbound(context.player(), payload.data()));
|
||||
ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> ModdedProtocolHandler.onPlayerJoin(handler.player));
|
||||
ServerPlayConnectionEvents.DISCONNECT.register((handler, server) -> ModdedProtocolHandler.onPlayerDisconnect(handler.player));
|
||||
ModdedProtocolHandler.bindChannel(new FabricProtocolChannel());
|
||||
}
|
||||
|
||||
private static final class FabricProtocolChannel implements ModdedProtocolChannel {
|
||||
@Override
|
||||
public boolean canReceive(ServerPlayer player) {
|
||||
return ServerPlayNetworking.canSend(player, ModdedIrisPayload.TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(ServerPlayer player, ModdedIrisPayload payload) {
|
||||
ServerPlayNetworking.send(player, payload);
|
||||
}
|
||||
NativeProtocolCallbacks callbacks = new NativeProtocolCallbacks(ModdedProtocolHandler::onInbound,
|
||||
ModdedProtocolHandler::onPlayerJoin, ModdedProtocolHandler::onPlayerDisconnect);
|
||||
ModdedProtocolHandler.bindChannel(NativeFabricProtocolNetworking.install(ModdedProtocolDefinition.PROTOCOL, callbacks));
|
||||
}
|
||||
}
|
||||
@@ -1,86 +1,26 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.fabric;
|
||||
|
||||
import art.arcane.iris.modded.IrisModdedChunkGenerator;
|
||||
import art.arcane.iris.modded.ModdedBlockBreakHandler;
|
||||
import art.arcane.iris.modded.ModdedEngineBootstrap;
|
||||
import art.arcane.iris.modded.command.IrisModdedCommands;
|
||||
import art.arcane.iris.modded.command.ModdedWandService;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import art.arcane.iris.modded.ModdedLifecycleCallbacks;
|
||||
import art.arcane.iris.modded.service.ModdedTreeFellerService;
|
||||
import art.arcane.volmlib.nativelib.modded.NativeLoaderOptions;
|
||||
import art.arcane.volmlib.nativelib.minecraft26_2.modded.NativeChunkGeneratorDefinition;
|
||||
import art.arcane.volmlib.nativelib.minecraft26_2.fabric.NativeFabricLoader;
|
||||
import art.arcane.volmlib.nativelib.minecraft26_2.fabric.NativeFabricBootstrap;
|
||||
import art.arcane.iris.modded.ModdedForcedDatapack;
|
||||
import art.arcane.volmlib.nativelib.minecraft26_2.fabric.NativeFabricPackSources;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLevelEvents;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
||||
import net.fabricmc.fabric.api.event.player.AttackBlockCallback;
|
||||
import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents;
|
||||
import net.fabricmc.fabric.api.event.player.UseBlockCallback;
|
||||
import net.minecraft.commands.CommandBuildContext;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
|
||||
public final class IrisFabricBootstrap implements ModInitializer {
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
ModdedEngineBootstrap.bootCommon(new FabricModdedLoader(), "Fabric",
|
||||
() -> Registry.register(BuiltInRegistries.CHUNK_GENERATOR, Identifier.fromNamespaceAndPath("irisworldgen", "iris"), IrisModdedChunkGenerator.CODEC));
|
||||
NativeFabricLoader loader = new NativeFabricLoader(new NativeLoaderOptions(
|
||||
"irisworldgen", "treefeller", ModdedTreeFellerService::runBreakProbe));
|
||||
NativeChunkGeneratorDefinition generator = IrisModdedChunkGenerator.DEFINITION;
|
||||
NativeFabricPackSources.bind(ModdedForcedDatapack::repositorySource);
|
||||
ModdedEngineBootstrap.bootCommon(loader, "Fabric", () -> NativeFabricBootstrap.registerGenerator(generator));
|
||||
FabricProtocolNetworking.install();
|
||||
ServerLifecycleEvents.SERVER_STARTING.register((MinecraftServer server) -> ModdedEngineBootstrap.start(server));
|
||||
ServerLifecycleEvents.SERVER_STARTED.register((MinecraftServer server) -> ModdedEngineBootstrap.serverStarted(server));
|
||||
ServerLifecycleEvents.SERVER_STOPPING.register((MinecraftServer server) -> ModdedEngineBootstrap.stop());
|
||||
ServerLevelEvents.LOAD.register((MinecraftServer server, ServerLevel level) -> ModdedEngineBootstrap.levelLoaded(level));
|
||||
ServerLevelEvents.UNLOAD.register((MinecraftServer server, ServerLevel level) -> ModdedEngineBootstrap.levelUnloaded(level));
|
||||
CommandRegistrationCallback.EVENT.register((CommandDispatcher<CommandSourceStack> dispatcher, CommandBuildContext buildContext, Commands.CommandSelection selection) -> IrisModdedCommands.register(dispatcher));
|
||||
PlayerBlockBreakEvents.BEFORE.register((Level level, Player player, BlockPos pos, BlockState state, BlockEntity blockEntity) -> {
|
||||
if (level instanceof ServerLevel serverLevel && player instanceof ServerPlayer serverPlayer) {
|
||||
ModdedBlockBreakHandler.prepare(serverLevel, serverPlayer, pos, state);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
PlayerBlockBreakEvents.CANCELED.register((Level level, Player player, BlockPos pos, BlockState state, BlockEntity blockEntity) -> {
|
||||
if (level instanceof ServerLevel serverLevel) {
|
||||
ModdedBlockBreakHandler.cancel(serverLevel, pos);
|
||||
}
|
||||
});
|
||||
AttackBlockCallback.EVENT.register((Player player, Level level, InteractionHand hand, BlockPos pos, Direction direction) ->
|
||||
ModdedWandService.attackBlock(player, level, hand, pos) ? InteractionResult.SUCCESS : InteractionResult.PASS);
|
||||
UseBlockCallback.EVENT.register((Player player, Level level, InteractionHand hand, BlockHitResult hit) ->
|
||||
ModdedWandService.useBlock(player, level, hand, hit.getBlockPos()) ? InteractionResult.SUCCESS : InteractionResult.PASS);
|
||||
ServerTickEvents.END_SERVER_TICK.register((MinecraftServer server) -> {
|
||||
ModdedEngineBootstrap.tick(server);
|
||||
ModdedWandService.serverTick(server);
|
||||
});
|
||||
NativeFabricBootstrap.install(ModdedLifecycleCallbacks.create());
|
||||
}
|
||||
}
|
||||
@@ -19,36 +19,17 @@
|
||||
package art.arcane.iris.fabric;
|
||||
|
||||
import art.arcane.iris.client.IrisClient;
|
||||
import art.arcane.volmlib.nativelib.minecraft26_2.fabric.NativeFabricClientHooks;
|
||||
import art.arcane.iris.client.IrisClientHud;
|
||||
import art.arcane.iris.client.IrisClientKeybinds;
|
||||
import art.arcane.iris.modded.ModdedIrisPayload;
|
||||
import art.arcane.iris.modded.ModdedProtocolDefinition;
|
||||
import art.arcane.volmlib.nativelib.minecraft26_2.fabric.NativeFabricProtocolNetworking;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.fabricmc.fabric.api.client.keymapping.v1.KeyMappingHelper;
|
||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
|
||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.hud.HudElementRegistry;
|
||||
|
||||
public final class IrisFabricClient implements ClientModInitializer {
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
ClientPlayNetworking.registerGlobalReceiver(ModdedIrisPayload.TYPE,
|
||||
(payload, context) -> IrisClient.onInbound(payload.data()));
|
||||
IrisClient.bindSender(frame -> {
|
||||
if (ClientPlayNetworking.canSend(ModdedIrisPayload.TYPE)) {
|
||||
ClientPlayNetworking.send(new ModdedIrisPayload(frame));
|
||||
}
|
||||
});
|
||||
ClientPlayConnectionEvents.JOIN.register((handler, sender, client) -> IrisClient.onWorldJoin());
|
||||
ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> IrisClient.onDisconnect());
|
||||
KeyMappingHelper.registerKeyMapping(IrisClientKeybinds.TOGGLE_HUD);
|
||||
KeyMappingHelper.registerKeyMapping(IrisClientKeybinds.OPEN_MAP);
|
||||
KeyMappingHelper.registerKeyMapping(IrisClientKeybinds.TOGGLE_WHAT);
|
||||
HudElementRegistry.addLast(IrisClient.HUD_ELEMENT_ID, (graphics, delta) -> IrisClientHud.render(graphics));
|
||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||
IrisClient.tick();
|
||||
IrisClientHud.tick();
|
||||
IrisClientKeybinds.pollToggle();
|
||||
});
|
||||
NativeFabricProtocolNetworking.installClient(ModdedProtocolDefinition.PROTOCOL, IrisClient::onInbound);
|
||||
IrisClient.bindSender(frame -> NativeFabricProtocolNetworking.sendClient(ModdedProtocolDefinition.PROTOCOL, frame));
|
||||
NativeFabricClientHooks.install(IrisClientHud.binding(), IrisClient::onWorldJoin, IrisClient::onDisconnect);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package art.arcane.iris.fabric.mixin;
|
||||
|
||||
import art.arcane.iris.modded.ModdedBlockBreakHandler;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
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.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(BlockItem.class)
|
||||
public final class BlockItemMixin {
|
||||
@Inject(method = "placeBlock", at = @At("RETURN"))
|
||||
private void iris$clearTreeProvenance(
|
||||
BlockPlaceContext context,
|
||||
BlockState state,
|
||||
CallbackInfoReturnable<Boolean> info
|
||||
) {
|
||||
if (info.getReturnValue() && context.getLevel() instanceof ServerLevel level) {
|
||||
ModdedBlockBreakHandler.clearPlacedProvenance(level, context.getClickedPos());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.fabric.mixin;
|
||||
|
||||
import art.arcane.iris.modded.ModdedBlockBreakHandler;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemInstance;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
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.CallbackInfoReturnable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Mixin(Block.class)
|
||||
public class BlockMixin {
|
||||
@Inject(method = "getDrops(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/entity/BlockEntity;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/item/ItemInstance;)Ljava/util/List;", at = @At("RETURN"), cancellable = true)
|
||||
private static void iris$applyBlockDrops(BlockState state, ServerLevel level, BlockPos position, BlockEntity blockEntity,
|
||||
Entity breaker, ItemInstance tool, CallbackInfoReturnable<List<ItemStack>> info) {
|
||||
if (!(breaker instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
ModdedBlockBreakHandler.Result result = ModdedBlockBreakHandler.completePrepared(level, position);
|
||||
if (result == null) {
|
||||
return;
|
||||
}
|
||||
if (result.routeCombinedDrops(info.getReturnValue())) {
|
||||
info.setReturnValue(List.of());
|
||||
return;
|
||||
}
|
||||
List<ItemStack> drops = result.replaceVanillaDrops()
|
||||
? new ArrayList<>()
|
||||
: new ArrayList<>(info.getReturnValue());
|
||||
drops.addAll(result.drops());
|
||||
info.setReturnValue(drops);
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.fabric.mixin;
|
||||
|
||||
import art.arcane.iris.modded.ModdedIrisLog;
|
||||
import art.arcane.iris.fabric.FabricForcedDatapackSources;
|
||||
import net.minecraft.server.packs.repository.PackRepository;
|
||||
import net.minecraft.server.packs.repository.RepositorySource;
|
||||
import net.minecraft.server.packs.repository.ServerPacksSource;
|
||||
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;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Mixin(PackRepository.class)
|
||||
public class PackRepositoryMixin {
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
private void iris$addForcedDatapackSource(RepositorySource[] sources, CallbackInfo info) {
|
||||
for (RepositorySource source : sources) {
|
||||
if (source instanceof ServerPacksSource) {
|
||||
FabricForcedDatapackSources.attach((PackRepository) (Object) this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Client resource-pack repositories legitimately have no ServerPacksSource; a missing server-data
|
||||
// repository is reported once at boot by ModdedForcedDatapack.verifyInjected().
|
||||
ModdedIrisLog.debug(
|
||||
"Iris forced datapack source not attached: no ServerPacksSource among {} source(s) {}",
|
||||
sources.length, Arrays.toString(sources));
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,14 @@
|
||||
"version": "${version}",
|
||||
"name": "Iris",
|
||||
"description": "Iris World Generation Engine (Fabric adapter - native chunk generator, explicit Iris world datapack workflow, engine lifecycle)",
|
||||
"authors": ["Arcane Arts (Volmit Software)"],
|
||||
"contributors": ["cyberpwn", "NextdoorPsycho", "Vatuu"],
|
||||
"authors": [
|
||||
"Arcane Arts (Volmit Software)"
|
||||
],
|
||||
"contributors": [
|
||||
"cyberpwn",
|
||||
"NextdoorPsycho",
|
||||
"Vatuu"
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://docs.volmit.com/iris/",
|
||||
"issues": "https://github.com/VolmitSoftware/Iris/issues",
|
||||
@@ -14,30 +20,54 @@
|
||||
"license": "GPL-3.0",
|
||||
"icon": "assets/irisworldgen/icon.png",
|
||||
"environment": "*",
|
||||
"accessWidener": "irisworldgen.accesswidener",
|
||||
"accessWidener": "volmlib.accesswidener",
|
||||
"mixins": [
|
||||
"irisworldgen.mixins.json",
|
||||
"irisworldgen.entity.mixins.json",
|
||||
"volmlib.fabric.mixins.json",
|
||||
"volmlib.entity.mixins.json",
|
||||
{
|
||||
"config": "irisworldgen.client.mixins.json",
|
||||
"config": "volmlib.client.mixins.json",
|
||||
"environment": "client"
|
||||
}
|
||||
],
|
||||
"entrypoints": {
|
||||
"main": ["art.arcane.iris.fabric.IrisFabricBootstrap"],
|
||||
"client": ["art.arcane.iris.fabric.IrisFabricClient"]
|
||||
"main": [
|
||||
"art.arcane.iris.fabric.IrisFabricBootstrap"
|
||||
],
|
||||
"client": [
|
||||
"art.arcane.iris.fabric.IrisFabricClient"
|
||||
]
|
||||
},
|
||||
"jars": [
|
||||
{ "file": "META-INF/jars/fabric-api-base.jar" },
|
||||
{ "file": "META-INF/jars/fabric-registry-sync-v0.jar" },
|
||||
{ "file": "META-INF/jars/fabric-resource-loader-v1.jar" },
|
||||
{ "file": "META-INF/jars/fabric-lifecycle-events-v1.jar" },
|
||||
{ "file": "META-INF/jars/fabric-command-api-v2.jar" },
|
||||
{ "file": "META-INF/jars/fabric-events-interaction-v0.jar" },
|
||||
{ "file": "META-INF/jars/fabric-networking-api-v1.jar" },
|
||||
{ "file": "META-INF/jars/fabric-rendering-v1.jar" },
|
||||
{ "file": "META-INF/jars/fabric-key-mapping-api-v1.jar" },
|
||||
{ "file": "META-INF/jars/fabric-permission-api-v1.jar" }
|
||||
{
|
||||
"file": "META-INF/jars/fabric-api-base.jar"
|
||||
},
|
||||
{
|
||||
"file": "META-INF/jars/fabric-registry-sync-v0.jar"
|
||||
},
|
||||
{
|
||||
"file": "META-INF/jars/fabric-resource-loader-v1.jar"
|
||||
},
|
||||
{
|
||||
"file": "META-INF/jars/fabric-lifecycle-events-v1.jar"
|
||||
},
|
||||
{
|
||||
"file": "META-INF/jars/fabric-command-api-v2.jar"
|
||||
},
|
||||
{
|
||||
"file": "META-INF/jars/fabric-events-interaction-v0.jar"
|
||||
},
|
||||
{
|
||||
"file": "META-INF/jars/fabric-networking-api-v1.jar"
|
||||
},
|
||||
{
|
||||
"file": "META-INF/jars/fabric-rendering-v1.jar"
|
||||
},
|
||||
{
|
||||
"file": "META-INF/jars/fabric-key-mapping-api-v1.jar"
|
||||
},
|
||||
{
|
||||
"file": "META-INF/jars/fabric-permission-api-v1.jar"
|
||||
}
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=0.19.3",
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
accessWidener v2 official
|
||||
accessible field net/minecraft/server/MinecraftServer levels Ljava/util/Map;
|
||||
accessible field net/minecraft/server/MinecraftServer executor Ljava/util/concurrent/Executor;
|
||||
accessible field net/minecraft/server/MinecraftServer storageSource Lnet/minecraft/world/level/storage/LevelStorageSource$LevelStorageAccess;
|
||||
accessible field net/minecraft/server/packs/repository/PackRepository sources Ljava/util/Set;
|
||||
mutable field net/minecraft/server/packs/repository/PackRepository sources Ljava/util/Set;
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "art.arcane.iris.fabric.mixin",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"mixins": [
|
||||
"BlockItemMixin",
|
||||
"BlockMixin",
|
||||
"PackRepositoryMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user