Revert "Fix ingredients being "empty" when playing multiplayer"
This reverts commit f56884705a
.
This commit is contained in:
parent
260be58951
commit
e88c29be57
@ -7,7 +7,6 @@ import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.event.TagsUpdatedEvent;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
@ -152,10 +151,6 @@ public final class OverdriveThatMatters {
|
||||
ToolsConfig.INSTANCE.register();
|
||||
}
|
||||
|
||||
private void tagsUpdated(TagsUpdatedEvent event) {
|
||||
Ingredient.invalidateAll();
|
||||
}
|
||||
|
||||
private void setup(final FMLCommonSetupEvent event) {
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, DrivePool.INSTANCE::onWorldSave);
|
||||
|
||||
@ -205,8 +200,6 @@ public final class OverdriveThatMatters {
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, DevChestBlockEntity.Companion::mappingsChanged);
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, this::tagsUpdated);
|
||||
|
||||
MatteryPlayerNetworkChannel.INSTANCE.register();
|
||||
MenuNetworkChannel.INSTANCE.register();
|
||||
WeaponNetworkChannel.INSTANCE.register();
|
||||
|
@ -1,19 +0,0 @@
|
||||
package ru.dbotthepony.mc.otm.mixin;
|
||||
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
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(Ingredient.class)
|
||||
public abstract class IngredientMixin {
|
||||
@Inject(
|
||||
method = "getItems()[Lnet/minecraft/world/item/ItemStack;",
|
||||
at = @At("HEAD")
|
||||
)
|
||||
public void getItemsPatch(CallbackInfoReturnable<ItemStack[]> info) {
|
||||
((Ingredient) (Object) this).checkInvalidation();
|
||||
}
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
package ru.dbotthepony.mc.otm.data
|
||||
|
||||
import com.google.gson.JsonParseException
|
||||
import com.google.gson.JsonSyntaxException
|
||||
import com.mojang.datafixers.util.Pair
|
||||
import com.mojang.serialization.Codec
|
||||
@ -15,12 +14,10 @@ object IngredientCodec : Codec<Ingredient> {
|
||||
}
|
||||
|
||||
override fun <T : Any> decode(ops: DynamicOps<T>, input: T): DataResult<Pair<Ingredient, T>> {
|
||||
return try {
|
||||
DataResult.success(Pair(Ingredient.fromJson(ops.convertTo(JsonOps.INSTANCE, input)), ops.empty()))
|
||||
try {
|
||||
return DataResult.success(Pair(Ingredient.fromJson(ops.convertTo(JsonOps.INSTANCE, input)), ops.empty()))
|
||||
} catch (err: JsonSyntaxException) {
|
||||
DataResult.error { "Error decoding Ingredient: ${err.message}" }
|
||||
} catch (err: JsonParseException) {
|
||||
DataResult.error { "Error decoding Ingredient: ${err.message}" }
|
||||
return DataResult.error { "Error decoding Ingredient: ${err.message}" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,9 @@ class PlatePressRecipe(
|
||||
}
|
||||
|
||||
override fun getIngredients(): NonNullList<Ingredient> {
|
||||
if (isIncomplete)
|
||||
return super.getIngredients()
|
||||
|
||||
return NonNullList.of(Ingredient.EMPTY, input)
|
||||
}
|
||||
|
||||
|
@ -15,8 +15,7 @@
|
||||
"MixinAbstractHurtingProjectile",
|
||||
"SimpleCriterionTriggerMixin",
|
||||
"InventoryChangeTriggerMixin",
|
||||
"MixinPlayer",
|
||||
"IngredientMixin"
|
||||
"MixinPlayer"
|
||||
],
|
||||
"client": [
|
||||
"MixinGameRenderer",
|
||||
|
Loading…
Reference in New Issue
Block a user