Skip to content

Commit

Permalink
neo changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunekaer committed Jan 15, 2024
1 parent 7136d17 commit e8ae331
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
8 changes: 7 additions & 1 deletion neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,10 @@ publishing {
from components.java
}
}
}
}

sourceSets.each {
def dir = layout.buildDirectory.dir("sourcesSets/$it.name")
it.output.resourcesDir = dir
it.java.destinationDirectory = dir
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import net.minecraft.core.registries.BuiltInRegistries;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.javafmlmod.FMLJavaModLoadingContext;
import net.neoforged.neoforge.registries.DeferredHolder;
import net.neoforged.neoforge.registries.DeferredRegister;

Expand All @@ -18,8 +17,7 @@ public class ToolkitNeo {
private static final DeferredRegister<ArgumentTypeInfo<?, ?>> ARGUMENT_REGISTRY = DeferredRegister.create(BuiltInRegistries.COMMAND_ARGUMENT_TYPE, Toolkit.MOD_ID);
private static final DeferredHolder<ArgumentTypeInfo<?, ?>, SingletonArgumentInfo<KillEntitiesCommand.KillTypeArgument>> KILL_TYPE_ARG = ARGUMENT_REGISTRY.register("kill_type",
() -> ArgumentTypeInfos.registerByClass(KillEntitiesCommand.KillTypeArgument.class, SingletonArgumentInfo.contextFree(KillEntitiesCommand.KillTypeArgument::killType)));
public ToolkitNeo() {
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
public ToolkitNeo(IEventBus modEventBus) {
Toolkit.init();

ARGUMENT_REGISTRY.register(modEventBus);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.neoforged.fml.loading.FMLPaths;
import net.neoforged.neoforge.capabilities.Capabilities;
import net.neoforged.neoforge.common.Tags;
import net.neoforged.neoforge.common.capabilities.Capabilities;
import org.jetbrains.annotations.Nullable;

import java.nio.file.Path;
Expand All @@ -32,20 +32,16 @@ public static Path getGamePath() {
public static List<ItemStack> getInventoryFromBlockEntity(Level level, BlockPos pos, @Nullable Direction direction) {
List<ItemStack> items = new ArrayList<>();

BlockEntity entity = level.getBlockEntity(pos);
if (entity == null) {
return items;
}

entity.getCapability(Capabilities.ITEM_HANDLER).ifPresent(handler -> {
for (int i = 0; i < handler.getSlots(); i++) {
var stack = handler.getStackInSlot(i);
var obj = level.getCapability(Capabilities.ItemHandler.BLOCK, pos, Direction.UP);
if(obj != null) {
for (int i = 0; i < obj.getSlots(); i++) {
var stack = obj.getStackInSlot(i);
if (stack.isEmpty()) {
continue;
}
items.add(stack);
}
});
}

return items;
}
Expand Down
2 changes: 1 addition & 1 deletion neoforge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ side = "BOTH"

[[dependencies.toolkit]]
modId = "architectury"
mandatory = true
required = true
versionRange = "[11.0.11,)"
ordering = "AFTER"
side = "BOTH"

0 comments on commit e8ae331

Please sign in to comment.