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:
@@ -29,18 +29,15 @@ public class CommonClass
|
|||||||
// code that gets invoked by the entry point of the loader specific projects.
|
// code that gets invoked by the entry point of the loader specific projects.
|
||||||
public static void init() {
|
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
|
// 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
|
// 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
|
// 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
|
// we have an interface in the common code and use a loader specific implementation to delegate our call to
|
||||||
// the platform specific approach.
|
// the platform specific approach.
|
||||||
if (Services.PLATFORM.isModLoaded("examplemod")) {
|
//if (Services.PLATFORM.isModLoaded("examplemod")) {
|
||||||
|
//
|
||||||
Constants.LOG.info("Hello to examplemod");
|
// Constants.LOG.info("Hello to examplemod");
|
||||||
}
|
//}
|
||||||
|
|
||||||
// Load config from the loader-specific config dir
|
// Load config from the loader-specific config dir
|
||||||
JRConfigManager.load(Services.PLATFORM.getConfigDir());
|
JRConfigManager.load(Services.PLATFORM.getConfigDir());
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ public class CommonClientClass {
|
|||||||
EntityRendererRegistry.register(ModEntities.UTAHRAPTOR, UtahraptorRenderer::new);
|
EntityRendererRegistry.register(ModEntities.UTAHRAPTOR, UtahraptorRenderer::new);
|
||||||
|
|
||||||
//? if <=1.20.1 {
|
//? if <=1.20.1 {
|
||||||
LifecycleEvent.SETUP.register(() -> {
|
ClientLifecycleEvent.CLIENT_SETUP.register(minecraft -> {
|
||||||
MenuRegistry.registerScreenFactory(ModMenuTypes.GENERATOR_MENU.get(), GeneratorScreen::new);
|
MenuRegistry.registerScreenFactory(ModMenuTypes.GENERATOR_MENU.get(), GeneratorScreen::new);
|
||||||
MenuRegistry.registerScreenFactory(ModMenuTypes.DNA_EXTRACTOR_MENU.get(), DNAExtractorScreen::new);
|
MenuRegistry.registerScreenFactory(ModMenuTypes.DNA_EXTRACTOR_MENU.get(), DNAExtractorScreen::new);
|
||||||
MenuRegistry.registerScreenFactory(ModMenuTypes.DNA_ANALYZER_MENU.get(), DNAAnalyzerScreen::new);
|
MenuRegistry.registerScreenFactory(ModMenuTypes.DNA_ANALYZER_MENU.get(), DNAAnalyzerScreen::new);
|
||||||
|
|||||||
+32
-2
@@ -12,6 +12,7 @@ import net.cmr.jurassicrevived.platform.services.IItemFluidHelper;
|
|||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.nbt.ListTag;
|
||||||
import net.minecraft.nbt.NbtOps;
|
import net.minecraft.nbt.NbtOps;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
@@ -294,7 +295,7 @@ public class TankBlockEntity extends BlockEntity implements ExtendedMenuProvider
|
|||||||
@Override
|
@Override
|
||||||
protected void saveAdditional(CompoundTag pTag) {
|
protected void saveAdditional(CompoundTag pTag) {
|
||||||
super.saveAdditional(pTag);
|
super.saveAdditional(pTag);
|
||||||
pTag.put("Inventory", itemHandler.createTag());
|
pTag.put("Inventory", saveInventory());
|
||||||
if (!fluidStack.isEmpty()) {
|
if (!fluidStack.isEmpty()) {
|
||||||
CompoundTag fluidTag = new CompoundTag();
|
CompoundTag fluidTag = new CompoundTag();
|
||||||
fluidStack.write(fluidTag);
|
fluidStack.write(fluidTag);
|
||||||
@@ -305,7 +306,7 @@ public class TankBlockEntity extends BlockEntity implements ExtendedMenuProvider
|
|||||||
@Override
|
@Override
|
||||||
public void load(CompoundTag pTag) {
|
public void load(CompoundTag pTag) {
|
||||||
super.load(pTag);
|
super.load(pTag);
|
||||||
itemHandler.fromTag(pTag.getList("Inventory", 10));
|
loadInventory(pTag.getList("Inventory", 10));
|
||||||
if (pTag.contains("Fluid")) {
|
if (pTag.contains("Fluid")) {
|
||||||
this.fluidStack = FluidStack.read(pTag.getCompound("Fluid"));
|
this.fluidStack = FluidStack.read(pTag.getCompound("Fluid"));
|
||||||
} else {
|
} 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
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public Packet<ClientGamePacketListener> getUpdatePacket() {
|
public Packet<ClientGamePacketListener> getUpdatePacket() {
|
||||||
|
|||||||
+1
-1
@@ -180,7 +180,7 @@ public class FossilGrindingRecipeBuilder {
|
|||||||
if (!weights.isEmpty()) {
|
if (!weights.isEmpty()) {
|
||||||
JsonObject weightsObj = new JsonObject();
|
JsonObject weightsObj = new JsonObject();
|
||||||
weights.forEach((k, v) -> weightsObj.addProperty(k.toString(), v));
|
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)
|
.sized(0.001f, 0.001f)
|
||||||
.clientTrackingRange(16)
|
.clientTrackingRange(16)
|
||||||
.updateInterval(1)
|
.updateInterval(1)
|
||||||
.build("jurassicrevived:seat")
|
.build("seat")
|
||||||
);
|
);
|
||||||
|
|
||||||
public static final RegistrySupplier<EntityType<AlbertosaurusEntity>> ALBERTOSAURUS =
|
public static final RegistrySupplier<EntityType<AlbertosaurusEntity>> ALBERTOSAURUS =
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ public class JRMod implements ModInitializer
|
|||||||
// project.
|
// project.
|
||||||
|
|
||||||
// Use Fabric to bootstrap the Common mod.
|
// Use Fabric to bootstrap the Common mod.
|
||||||
Constants.LOG.info("Hello Fabric world!");
|
|
||||||
CommonClass.init();
|
CommonClass.init();
|
||||||
|
|
||||||
FluidStorage.SIDED.registerForBlockEntities((be, side) ->
|
FluidStorage.SIDED.registerForBlockEntities((be, side) ->
|
||||||
|
|||||||
@@ -14,8 +14,5 @@ public class MixinTitleScreen
|
|||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "init()V")
|
@Inject(at = @At("HEAD"), method = "init()V")
|
||||||
private void init(CallbackInfo info) {
|
private void init(CallbackInfo info) {
|
||||||
|
|
||||||
Constants.LOG.info("This line is printed by an example mod mixin from Fabric!");
|
|
||||||
Constants.LOG.info("MC Version: {}", Minecraft.getInstance().getVersionType());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,7 +22,6 @@ public class JRMod {
|
|||||||
EventBuses.registerModEventBus(Constants.MOD_ID, FMLJavaModLoadingContext.get().getModEventBus());
|
EventBuses.registerModEventBus(Constants.MOD_ID, FMLJavaModLoadingContext.get().getModEventBus());
|
||||||
|
|
||||||
// Use Forge to bootstrap the Common mod.
|
// Use Forge to bootstrap the Common mod.
|
||||||
Constants.LOG.info("Hello Forge world!");
|
|
||||||
CommonClass.init();
|
CommonClass.init();
|
||||||
|
|
||||||
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> CommonClientClass::init);
|
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> CommonClientClass::init);
|
||||||
|
|||||||
@@ -13,8 +13,5 @@ public class MixinTitleScreen {
|
|||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "init()V")
|
@Inject(at = @At("HEAD"), method = "init()V")
|
||||||
private void init(CallbackInfo info) {
|
private void init(CallbackInfo info) {
|
||||||
|
|
||||||
Constants.LOG.info("This line is printed by an example mod mixin from Forge!");
|
|
||||||
Constants.LOG.info("MC Version: {}", Minecraft.getInstance().getVersionType());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -13,7 +13,6 @@ import java.util.function.Supplier;
|
|||||||
public class JRMod {
|
public class JRMod {
|
||||||
|
|
||||||
public JRMod(IEventBus eventBus) {
|
public JRMod(IEventBus eventBus) {
|
||||||
Constants.LOG.info("Hello NeoForge world!");
|
|
||||||
CommonClass.init();
|
CommonClass.init();
|
||||||
|
|
||||||
ModLoadingContext.get().getActiveContainer().registerExtensionPoint(
|
ModLoadingContext.get().getActiveContainer().registerExtensionPoint(
|
||||||
|
|||||||
@@ -14,8 +14,5 @@ public class MixinTitleScreen
|
|||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "init()V")
|
@Inject(at = @At("HEAD"), method = "init()V")
|
||||||
private void init(CallbackInfo info) {
|
private void init(CallbackInfo info) {
|
||||||
|
|
||||||
Constants.LOG.info("This line is printed by an example mod mixin from NeoForge!");
|
|
||||||
Constants.LOG.info("MC Version: {}", Minecraft.getInstance().getVersionType());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user