Fixed Fabric screen initialization

Removes mixin log entries from framework
Fixes fossil grinder not having a weighted output with fossils
Also adds item save logic to the tank block
Fixes seat registration
This commit is contained in:
2026-05-20 20:05:50 -04:00
parent 95d5ae89e6
commit 50c958ff52
11 changed files with 39 additions and 24 deletions
@@ -29,18 +29,15 @@ public class CommonClass
// code that gets invoked by the entry point of the loader specific projects.
public static void init() {
Constants.LOG.info("Hello from Common init on {}! we are currently in a {} environment!", Services.PLATFORM.getPlatformName(), Services.PLATFORM.getEnvironmentName());
Constants.LOG.info("The ID for diamonds is {}", BuiltInRegistries.ITEM.getKey(Items.DIAMOND));
// It is common for all supported loaders to provide a similar feature that can not be used directly in the
// common code. A popular way to get around this is using Java's built-in service loader feature to create
// your own abstraction layer. You can learn more about this in our provided services class. In this example
// we have an interface in the common code and use a loader specific implementation to delegate our call to
// the platform specific approach.
if (Services.PLATFORM.isModLoaded("examplemod")) {
Constants.LOG.info("Hello to examplemod");
}
//if (Services.PLATFORM.isModLoaded("examplemod")) {
//
// Constants.LOG.info("Hello to examplemod");
//}
// Load config from the loader-specific config dir
JRConfigManager.load(Services.PLATFORM.getConfigDir());
@@ -112,7 +112,7 @@ public class CommonClientClass {
EntityRendererRegistry.register(ModEntities.UTAHRAPTOR, UtahraptorRenderer::new);
//? if <=1.20.1 {
LifecycleEvent.SETUP.register(() -> {
ClientLifecycleEvent.CLIENT_SETUP.register(minecraft -> {
MenuRegistry.registerScreenFactory(ModMenuTypes.GENERATOR_MENU.get(), GeneratorScreen::new);
MenuRegistry.registerScreenFactory(ModMenuTypes.DNA_EXTRACTOR_MENU.get(), DNAExtractorScreen::new);
MenuRegistry.registerScreenFactory(ModMenuTypes.DNA_ANALYZER_MENU.get(), DNAAnalyzerScreen::new);
@@ -12,6 +12,7 @@ import net.cmr.jurassicrevived.platform.services.IItemFluidHelper;
import net.minecraft.core.BlockPos;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtOps;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component;
@@ -294,7 +295,7 @@ public class TankBlockEntity extends BlockEntity implements ExtendedMenuProvider
@Override
protected void saveAdditional(CompoundTag pTag) {
super.saveAdditional(pTag);
pTag.put("Inventory", itemHandler.createTag());
pTag.put("Inventory", saveInventory());
if (!fluidStack.isEmpty()) {
CompoundTag fluidTag = new CompoundTag();
fluidStack.write(fluidTag);
@@ -305,7 +306,7 @@ public class TankBlockEntity extends BlockEntity implements ExtendedMenuProvider
@Override
public void load(CompoundTag pTag) {
super.load(pTag);
itemHandler.fromTag(pTag.getList("Inventory", 10));
loadInventory(pTag.getList("Inventory", 10));
if (pTag.contains("Fluid")) {
this.fluidStack = FluidStack.read(pTag.getCompound("Fluid"));
} else {
@@ -314,6 +315,35 @@ public class TankBlockEntity extends BlockEntity implements ExtendedMenuProvider
}
//?}
private ListTag saveInventory() {
ListTag listTag = new ListTag();
for (int slot = 0; slot < itemHandler.getContainerSize(); slot++) {
ItemStack stack = itemHandler.getItem(slot);
if (!stack.isEmpty()) {
CompoundTag stackTag = new CompoundTag();
stackTag.putByte("Slot", (byte) slot);
stack.save(stackTag);
listTag.add(stackTag);
}
}
return listTag;
}
private void loadInventory(ListTag listTag) {
itemHandler.clearContent();
for (int i = 0; i < listTag.size(); i++) {
CompoundTag stackTag = listTag.getCompound(i);
int slot = stackTag.getByte("Slot") & 255;
if (slot >= 0 && slot < itemHandler.getContainerSize()) {
itemHandler.setItem(slot, ItemStack.of(stackTag));
}
}
}
@Nullable
@Override
public Packet<ClientGamePacketListener> getUpdatePacket() {
@@ -180,7 +180,7 @@ public class FossilGrindingRecipeBuilder {
if (!weights.isEmpty()) {
JsonObject weightsObj = new JsonObject();
weights.forEach((k, v) -> weightsObj.addProperty(k.toString(), v));
json.add("weights", weightsObj);
json.add("weighted_outputs", weightsObj);
}
}
@@ -28,7 +28,7 @@ public class ModEntities {
.sized(0.001f, 0.001f)
.clientTrackingRange(16)
.updateInterval(1)
.build("jurassicrevived:seat")
.build("seat")
);
public static final RegistrySupplier<EntityType<AlbertosaurusEntity>> ALBERTOSAURUS =