From 087c16c0aa5e769b27d01f312057492dafed14fb Mon Sep 17 00:00:00 2001 From: Florens Pauwels Date: Fri, 24 Jan 2020 19:12:37 +0100 Subject: [PATCH 1/9] Entity rendering registry --- .../fml/client/registry/IRenderFactory.java | 28 +++++++++++++ .../client/registry/RenderingRegistry.java | 40 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 patchwork-registries/src/main/java/net/minecraftforge/fml/client/registry/IRenderFactory.java create mode 100644 patchwork-registries/src/main/java/net/minecraftforge/fml/client/registry/RenderingRegistry.java diff --git a/patchwork-registries/src/main/java/net/minecraftforge/fml/client/registry/IRenderFactory.java b/patchwork-registries/src/main/java/net/minecraftforge/fml/client/registry/IRenderFactory.java new file mode 100644 index 00000000..6c40f4bd --- /dev/null +++ b/patchwork-registries/src/main/java/net/minecraftforge/fml/client/registry/IRenderFactory.java @@ -0,0 +1,28 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package net.minecraftforge.fml.client.registry; + +import net.minecraft.client.render.entity.EntityRenderer; +import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.entity.Entity; + +public interface IRenderFactory { + EntityRenderer createRenderFor(EntityRenderDispatcher manager); +} diff --git a/patchwork-registries/src/main/java/net/minecraftforge/fml/client/registry/RenderingRegistry.java b/patchwork-registries/src/main/java/net/minecraftforge/fml/client/registry/RenderingRegistry.java new file mode 100644 index 00000000..1a76752d --- /dev/null +++ b/patchwork-registries/src/main/java/net/minecraftforge/fml/client/registry/RenderingRegistry.java @@ -0,0 +1,40 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package net.minecraftforge.fml.client.registry; + +import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.entity.Entity; + +import net.fabricmc.fabric.api.client.render.EntityRendererRegistry; + +public class RenderingRegistry { + /** + * Register an entity rendering handler. This will, after mod initialization, be inserted into the main + * render map for entities. + * Call this during {@link net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent}. + * This method is safe to call during parallel mod loading. + */ + public static void registerEntityRenderingHandler(Class entityClass, IRenderFactory renderFactory) { + EntityRendererRegistry.INSTANCE.register(entityClass, (dispatcher, context) -> renderFactory.createRenderFor(dispatcher)); + } + + // This is here just in case a mod calls it, entity renderers are loaded by the Fabric API + public static void loadEntityRenderers(EntityRenderDispatcher manager) { } +} From be8cf8f9a89155dd0ed917e12712de5d484acf42 Mon Sep 17 00:00:00 2001 From: Florens Pauwels Date: Sat, 25 Jan 2020 14:21:03 +0100 Subject: [PATCH 2/9] Pretty much all of the Forge exposed registries --- .../mixin/registries/MixinActivity.java | 54 +++++++++++++++++ .../registries/MixinBiomeSourceType.java | 54 +++++++++++++++++ .../registries/MixinBlockEntityType.java | 54 +++++++++++++++++ .../mixin/registries/MixinCarver.java | 54 +++++++++++++++++ .../registries/MixinChunkGeneratorType.java | 54 +++++++++++++++++ .../mixin/registries/MixinChunkStatus.java | 58 +++++++++++++++++++ .../mixin/registries/MixinContainerType.java | 54 +++++++++++++++++ .../MixinCookingRecipeSerializer.java | 55 ++++++++++++++++++ .../MixinCuttingRecipeSerializer.java | 55 ++++++++++++++++++ .../mixin/registries/MixinDecorator.java | 54 +++++++++++++++++ .../mixin/registries/MixinEnchantment.java | 54 +++++++++++++++++ .../mixin/registries/MixinEntityType.java | 58 +++++++++++++++++++ .../mixin/registries/MixinFluid.java | 58 +++++++++++++++++++ .../registries/MixinMemoryModuleType.java | 58 +++++++++++++++++++ .../mixin/registries/MixinPaintingMotive.java | 58 +++++++++++++++++++ .../mixin/registries/MixinParticleType.java | 54 +++++++++++++++++ .../registries/MixinPointOfInterestType.java | 58 +++++++++++++++++++ .../mixin/registries/MixinPotion.java | 58 +++++++++++++++++++ .../registries/MixinRecipeSerializer.java | 28 +++++++++ .../mixin/registries/MixinSchedule.java | 54 +++++++++++++++++ .../mixin/registries/MixinSensorType.java | 58 +++++++++++++++++++ .../MixinShapedRecipeSerializer.java | 55 ++++++++++++++++++ .../MixinShapelessRecipeSerializer.java | 55 ++++++++++++++++++ .../mixin/registries/MixinSoundEvent.java | 54 +++++++++++++++++ .../MixinSpecialRecipeSerializer.java | 55 ++++++++++++++++++ .../mixin/registries/MixinStatType.java | 54 +++++++++++++++++ .../mixin/registries/MixinStatusEffect.java | 54 +++++++++++++++++ .../registries/MixinVillagerProfession.java | 58 +++++++++++++++++++ .../patchwork-registries.mixins.json | 30 +++++++++- 29 files changed, 1556 insertions(+), 1 deletion(-) create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinActivity.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiomeSourceType.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBlockEntityType.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCarver.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkGeneratorType.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkStatus.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinContainerType.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCookingRecipeSerializer.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCuttingRecipeSerializer.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinDecorator.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEnchantment.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEntityType.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinFluid.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinMemoryModuleType.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPaintingMotive.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinParticleType.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPointOfInterestType.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPotion.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinRecipeSerializer.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSchedule.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSensorType.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapedRecipeSerializer.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapelessRecipeSerializer.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSoundEvent.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSpecialRecipeSerializer.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatType.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatusEffect.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinVillagerProfession.java diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinActivity.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinActivity.java new file mode 100644 index 00000000..ed75166c --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinActivity.java @@ -0,0 +1,54 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.entity.ai.brain.Activity; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(Activity.class) +public class MixinActivity implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.ACTIVITY.getId((Activity) (Object) this); + Identifier set = registryName; + + return current != null ? current : set; + } + + public Class getRegistryType() { + return Activity.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiomeSourceType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiomeSourceType.java new file mode 100644 index 00000000..1875d39b --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiomeSourceType.java @@ -0,0 +1,54 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.world.biome.source.BiomeSourceType; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(BiomeSourceType.class) +public class MixinBiomeSourceType implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.BIOME_SOURCE_TYPE.getId((BiomeSourceType) (Object) this); + Identifier set = registryName; + + return current != null ? current : set; + } + + public Class getRegistryType() { + return BiomeSourceType.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBlockEntityType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBlockEntityType.java new file mode 100644 index 00000000..5850488a --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBlockEntityType.java @@ -0,0 +1,54 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(BlockEntityType.class) +public class MixinBlockEntityType implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.BLOCK_ENTITY.getId((BlockEntityType) (Object) this); + Identifier set = registryName; + + return current != null ? current : set; + } + + public Class getRegistryType() { + return BlockEntityType.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCarver.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCarver.java new file mode 100644 index 00000000..c9fd8041 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCarver.java @@ -0,0 +1,54 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.world.gen.carver.Carver; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(Carver.class) +public class MixinCarver implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.CARVER.getId((Carver) (Object) this); + Identifier set = registryName; + + return current != null ? current : set; + } + + public Class getRegistryType() { + return Carver.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkGeneratorType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkGeneratorType.java new file mode 100644 index 00000000..9b07d557 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkGeneratorType.java @@ -0,0 +1,54 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.world.gen.chunk.ChunkGeneratorType; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(ChunkGeneratorType.class) +public class MixinChunkGeneratorType implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.CHUNK_GENERATOR_TYPE.getId((ChunkGeneratorType) (Object) this); + Identifier set = registryName; + + return current != null ? current : set; + } + + public Class getRegistryType() { + return ChunkGeneratorType.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkStatus.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkStatus.java new file mode 100644 index 00000000..46a41df2 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkStatus.java @@ -0,0 +1,58 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.world.chunk.ChunkStatus; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(ChunkStatus.class) +public class MixinChunkStatus implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.CHUNK_STATUS.getId((ChunkStatus) (Object) this); + Identifier set = registryName; + + if (set == null) { + set = Registry.CHUNK_STATUS.getDefaultId(); + } + + return current != Registry.CHUNK_STATUS.getDefaultId() ? current : set; + } + + public Class getRegistryType() { + return ChunkStatus.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinContainerType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinContainerType.java new file mode 100644 index 00000000..f1d53309 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinContainerType.java @@ -0,0 +1,54 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.container.ContainerType; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(ContainerType.class) +public class MixinContainerType implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.CONTAINER.getId((ContainerType) (Object) this); + Identifier set = registryName; + + return current != null ? current : set; + } + + public Class getRegistryType() { + return ContainerType.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCookingRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCookingRecipeSerializer.java new file mode 100644 index 00000000..7f1358cd --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCookingRecipeSerializer.java @@ -0,0 +1,55 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.recipe.RecipeSerializer; +import net.minecraft.recipe.CookingRecipeSerializer; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(CookingRecipeSerializer.class) +public class MixinCookingRecipeSerializer implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.RECIPE_SERIALIZER.getId((CookingRecipeSerializer) (Object) this); + Identifier set = registryName; + + return current != null ? current : set; + } + + public Class getRegistryType() { + return RecipeSerializer.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCuttingRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCuttingRecipeSerializer.java new file mode 100644 index 00000000..596d41ac --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCuttingRecipeSerializer.java @@ -0,0 +1,55 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.recipe.RecipeSerializer; +import net.minecraft.recipe.CuttingRecipe; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(CuttingRecipe.Serializer.class) +public class MixinCuttingRecipeSerializer implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.RECIPE_SERIALIZER.getId((CuttingRecipe.Serializer) (Object) this); + Identifier set = registryName; + + return current != null ? current : set; + } + + public Class getRegistryType() { + return RecipeSerializer.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinDecorator.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinDecorator.java new file mode 100644 index 00000000..4e4ab0e1 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinDecorator.java @@ -0,0 +1,54 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.world.gen.decorator.Decorator; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(Decorator.class) +public class MixinDecorator implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.DECORATOR.getId((Decorator) (Object) this); + Identifier set = registryName; + + return current != null ? current : set; + } + + public Class getRegistryType() { + return Decorator.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEnchantment.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEnchantment.java new file mode 100644 index 00000000..6d858cca --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEnchantment.java @@ -0,0 +1,54 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.enchantment.Enchantment; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(Enchantment.class) +public class MixinEnchantment implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.ENCHANTMENT.getId((Enchantment) (Object) this); + Identifier set = registryName; + + return current != null ? current : set; + } + + public Class getRegistryType() { + return Enchantment.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEntityType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEntityType.java new file mode 100644 index 00000000..1e156717 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEntityType.java @@ -0,0 +1,58 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.entity.EntityType; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(EntityType.class) +public class MixinEntityType implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.ENTITY_TYPE.getId((EntityType) (Object) this); + Identifier set = registryName; + + if (set == null) { + set = Registry.ENTITY_TYPE.getDefaultId(); + } + + return current != Registry.ENTITY_TYPE.getDefaultId() ? current : set; + } + + public Class getRegistryType() { + return EntityType.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinFluid.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinFluid.java new file mode 100644 index 00000000..904edafb --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinFluid.java @@ -0,0 +1,58 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.fluid.Fluid; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(Fluid.class) +public class MixinFluid implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.FLUID.getId((Fluid) (Object) this); + Identifier set = registryName; + + if (set == null) { + set = Registry.FLUID.getDefaultId(); + } + + return current != Registry.FLUID.getDefaultId() ? current : set; + } + + public Class getRegistryType() { + return Fluid.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinMemoryModuleType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinMemoryModuleType.java new file mode 100644 index 00000000..d0bc6756 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinMemoryModuleType.java @@ -0,0 +1,58 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.entity.ai.brain.MemoryModuleType; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(MemoryModuleType.class) +public class MixinMemoryModuleType implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.MEMORY_MODULE_TYPE.getId((MemoryModuleType) (Object) this); + Identifier set = registryName; + + if (set == null) { + set = Registry.MEMORY_MODULE_TYPE.getDefaultId(); + } + + return current != Registry.MEMORY_MODULE_TYPE.getDefaultId() ? current : set; + } + + public Class getRegistryType() { + return MemoryModuleType.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPaintingMotive.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPaintingMotive.java new file mode 100644 index 00000000..13dfa855 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPaintingMotive.java @@ -0,0 +1,58 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.entity.decoration.painting.PaintingMotive; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(PaintingMotive.class) +public class MixinPaintingMotive implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.MOTIVE.getId((PaintingMotive) (Object) this); + Identifier set = registryName; + + if (set == null) { + set = Registry.MOTIVE.getDefaultId(); + } + + return current != Registry.MOTIVE.getDefaultId() ? current : set; + } + + public Class getRegistryType() { + return PaintingMotive.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinParticleType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinParticleType.java new file mode 100644 index 00000000..738505c3 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinParticleType.java @@ -0,0 +1,54 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.particle.ParticleType; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(ParticleType.class) +public class MixinParticleType implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.PARTICLE_TYPE.getId((ParticleType) (Object) this); + Identifier set = registryName; + + return current != null ? current : set; + } + + public Class getRegistryType() { + return ParticleType.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPointOfInterestType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPointOfInterestType.java new file mode 100644 index 00000000..ffce3006 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPointOfInterestType.java @@ -0,0 +1,58 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.village.PointOfInterestType; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(PointOfInterestType.class) +public class MixinPointOfInterestType implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.POINT_OF_INTEREST_TYPE.getId((PointOfInterestType) (Object) this); + Identifier set = registryName; + + if (set == null) { + set = Registry.POINT_OF_INTEREST_TYPE.getDefaultId(); + } + + return current != Registry.POINT_OF_INTEREST_TYPE.getDefaultId() ? current : set; + } + + public Class getRegistryType() { + return PointOfInterestType.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPotion.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPotion.java new file mode 100644 index 00000000..889d15a0 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPotion.java @@ -0,0 +1,58 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.potion.Potion; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(Potion.class) +public class MixinPotion implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.POTION.getId((Potion) (Object) this); + Identifier set = registryName; + + if (set == null) { + set = Registry.POTION.getDefaultId(); + } + + return current != Registry.POTION.getDefaultId() ? current : set; + } + + public Class getRegistryType() { + return Potion.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinRecipeSerializer.java new file mode 100644 index 00000000..2ee4db4a --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinRecipeSerializer.java @@ -0,0 +1,28 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; + +import net.minecraft.recipe.RecipeSerializer; + +@Mixin(RecipeSerializer.class) +public interface MixinRecipeSerializer extends IForgeRegistryEntry> { } diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSchedule.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSchedule.java new file mode 100644 index 00000000..d9d41814 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSchedule.java @@ -0,0 +1,54 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.entity.ai.brain.Schedule; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(Schedule.class) +public class MixinSchedule implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.SCHEDULE.getId((Schedule) (Object) this); + Identifier set = registryName; + + return current != null ? current : set; + } + + public Class getRegistryType() { + return Schedule.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSensorType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSensorType.java new file mode 100644 index 00000000..7f574dd9 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSensorType.java @@ -0,0 +1,58 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.entity.ai.brain.sensor.SensorType; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(SensorType.class) +public class MixinSensorType implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.SENSOR_TYPE.getId((SensorType) (Object) this); + Identifier set = registryName; + + if (set == null) { + set = Registry.SENSOR_TYPE.getDefaultId(); + } + + return current != Registry.SENSOR_TYPE.getDefaultId() ? current : set; + } + + public Class getRegistryType() { + return SensorType.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapedRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapedRecipeSerializer.java new file mode 100644 index 00000000..57042bfe --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapedRecipeSerializer.java @@ -0,0 +1,55 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.recipe.RecipeSerializer; +import net.minecraft.recipe.ShapedRecipe; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(ShapedRecipe.Serializer.class) +public class MixinShapedRecipeSerializer implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.RECIPE_SERIALIZER.getId((ShapedRecipe.Serializer) (Object) this); + Identifier set = registryName; + + return current != null ? current : set; + } + + public Class getRegistryType() { + return RecipeSerializer.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapelessRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapelessRecipeSerializer.java new file mode 100644 index 00000000..e2d03954 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapelessRecipeSerializer.java @@ -0,0 +1,55 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.recipe.RecipeSerializer; +import net.minecraft.recipe.ShapelessRecipe; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(ShapelessRecipe.Serializer.class) +public class MixinShapelessRecipeSerializer implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.RECIPE_SERIALIZER.getId((ShapelessRecipe.Serializer) (Object) this); + Identifier set = registryName; + + return current != null ? current : set; + } + + public Class getRegistryType() { + return RecipeSerializer.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSoundEvent.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSoundEvent.java new file mode 100644 index 00000000..b2d76a15 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSoundEvent.java @@ -0,0 +1,54 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.sound.SoundEvent; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(SoundEvent.class) +public class MixinSoundEvent implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.SOUND_EVENT.getId((SoundEvent) (Object) this); + Identifier set = registryName; + + return current != null ? current : set; + } + + public Class getRegistryType() { + return SoundEvent.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSpecialRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSpecialRecipeSerializer.java new file mode 100644 index 00000000..c8170c1d --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSpecialRecipeSerializer.java @@ -0,0 +1,55 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.recipe.RecipeSerializer; +import net.minecraft.recipe.SpecialRecipeSerializer; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(SpecialRecipeSerializer.class) +public class MixinSpecialRecipeSerializer implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.RECIPE_SERIALIZER.getId((SpecialRecipeSerializer) (Object) this); + Identifier set = registryName; + + return current != null ? current : set; + } + + public Class getRegistryType() { + return RecipeSerializer.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatType.java new file mode 100644 index 00000000..6db2e58f --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatType.java @@ -0,0 +1,54 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.stat.StatType; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(StatType.class) +public class MixinStatType implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.STAT_TYPE.getId((StatType) (Object) this); + Identifier set = registryName; + + return current != null ? current : set; + } + + public Class getRegistryType() { + return StatType.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatusEffect.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatusEffect.java new file mode 100644 index 00000000..da98041f --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatusEffect.java @@ -0,0 +1,54 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.entity.effect.StatusEffect; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(StatusEffect.class) +public class MixinStatusEffect implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.STATUS_EFFECT.getId((StatusEffect) (Object) this); + Identifier set = registryName; + + return current != null ? current : set; + } + + public Class getRegistryType() { + return StatusEffect.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinVillagerProfession.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinVillagerProfession.java new file mode 100644 index 00000000..2d45af14 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinVillagerProfession.java @@ -0,0 +1,58 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.village.VillagerProfession; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; + +@Mixin(VillagerProfession.class) +public class MixinVillagerProfession implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Identifier current = Registry.VILLAGER_PROFESSION.getId((VillagerProfession) (Object) this); + Identifier set = registryName; + + if (set == null) { + set = Registry.VILLAGER_PROFESSION.getDefaultId(); + } + + return current != Registry.VILLAGER_PROFESSION.getDefaultId() ? current : set; + } + + public Class getRegistryType() { + return VillagerProfession.class; + } +} diff --git a/patchwork-registries/src/main/resources/patchwork-registries.mixins.json b/patchwork-registries/src/main/resources/patchwork-registries.mixins.json index 4953d8d7..d05d7922 100644 --- a/patchwork-registries/src/main/resources/patchwork-registries.mixins.json +++ b/patchwork-registries/src/main/resources/patchwork-registries.mixins.json @@ -3,11 +3,39 @@ "package": "com.patchworkmc.mixin.registries", "compatibilityLevel": "JAVA_8", "mixins": [ + "MixinActivity", "MixinBiome", + "MixinBiomeSourceType", "MixinBlock", + "MixinBlockEntityType", + "MixinCarver", + "MixinChunkGeneratorType", + "MixinChunkStatus", + "MixinContainerType", + "MixinCookingRecipeSerializer", + "MixinCuttingRecipeSerializer", + "MixinDecorator", + "MixinEnchantment", + "MixinEntityType", "MixinFeature", + "MixinFluid", "MixinItem", - "MixinSurfaceBuilder" + "MixinMemoryModuleType", + "MixinPaintingMotive", + "MixinParticleType", + "MixinPointOfInterestType", + "MixinPotion", + "MixinRecipeSerializer", + "MixinSchedule", + "MixinSensorType", + "MixinShapedRecipeSerializer", + "MixinShapelessRecipeSerializer", + "MixinSoundEvent", + "MixinSpecialRecipeSerializer", + "MixinStatType", + "MixinStatusEffect", + "MixinSurfaceBuilder", + "MixinVillagerProfession" ], "injectors": { "defaultRequire": 1 From e410be235bd4fd166478705e973d976cbe02e70c Mon Sep 17 00:00:00 2001 From: Florens Pauwels Date: Sat, 25 Jan 2020 17:00:36 +0100 Subject: [PATCH 3/9] Fix sloppy copy pasting --- .../java/com/patchworkmc/mixin/registries/MixinActivity.java | 3 +-- .../main/java/com/patchworkmc/mixin/registries/MixinBiome.java | 3 +-- .../com/patchworkmc/mixin/registries/MixinBiomeSourceType.java | 3 +-- .../com/patchworkmc/mixin/registries/MixinBlockEntityType.java | 3 +-- .../java/com/patchworkmc/mixin/registries/MixinCarver.java | 3 +-- .../patchworkmc/mixin/registries/MixinChunkGeneratorType.java | 3 +-- .../com/patchworkmc/mixin/registries/MixinContainerType.java | 3 +-- .../mixin/registries/MixinCookingRecipeSerializer.java | 3 +-- .../mixin/registries/MixinCuttingRecipeSerializer.java | 3 +-- .../java/com/patchworkmc/mixin/registries/MixinDecorator.java | 3 +-- .../com/patchworkmc/mixin/registries/MixinEnchantment.java | 3 +-- .../java/com/patchworkmc/mixin/registries/MixinFeature.java | 3 +-- .../com/patchworkmc/mixin/registries/MixinParticleType.java | 3 +-- .../java/com/patchworkmc/mixin/registries/MixinSchedule.java | 3 +-- .../mixin/registries/MixinShapedRecipeSerializer.java | 3 +-- .../mixin/registries/MixinShapelessRecipeSerializer.java | 3 +-- .../java/com/patchworkmc/mixin/registries/MixinSoundEvent.java | 3 +-- .../mixin/registries/MixinSpecialRecipeSerializer.java | 3 +-- .../java/com/patchworkmc/mixin/registries/MixinStatType.java | 3 +-- .../com/patchworkmc/mixin/registries/MixinStatusEffect.java | 3 +-- .../com/patchworkmc/mixin/registries/MixinSurfaceBuilder.java | 3 +-- 21 files changed, 21 insertions(+), 42 deletions(-) diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinActivity.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinActivity.java index ed75166c..67922e46 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinActivity.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinActivity.java @@ -43,9 +43,8 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { public Identifier getRegistryName() { Identifier current = Registry.ACTIVITY.getId((Activity) (Object) this); - Identifier set = registryName; - return current != null ? current : set; + return current != null ? current : registryName; } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiome.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiome.java index d99b8bd6..846e0dc5 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiome.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiome.java @@ -43,9 +43,8 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { public Identifier getRegistryName() { Identifier current = Registry.BIOME.getId((Biome) (Object) this); - Identifier set = registryName; - return current != null ? current : set; + return current != null ? current : registryName; } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiomeSourceType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiomeSourceType.java index 1875d39b..5efee5ad 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiomeSourceType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiomeSourceType.java @@ -43,9 +43,8 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { public Identifier getRegistryName() { Identifier current = Registry.BIOME_SOURCE_TYPE.getId((BiomeSourceType) (Object) this); - Identifier set = registryName; - return current != null ? current : set; + return current != null ? current : registryName; } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBlockEntityType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBlockEntityType.java index 5850488a..47a2ae84 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBlockEntityType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBlockEntityType.java @@ -43,9 +43,8 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { public Identifier getRegistryName() { Identifier current = Registry.BLOCK_ENTITY.getId((BlockEntityType) (Object) this); - Identifier set = registryName; - return current != null ? current : set; + return current != null ? current : registryName; } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCarver.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCarver.java index c9fd8041..3a4acdc2 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCarver.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCarver.java @@ -43,9 +43,8 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { public Identifier getRegistryName() { Identifier current = Registry.CARVER.getId((Carver) (Object) this); - Identifier set = registryName; - return current != null ? current : set; + return current != null ? current : registryName; } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkGeneratorType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkGeneratorType.java index 9b07d557..e4f909af 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkGeneratorType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkGeneratorType.java @@ -43,9 +43,8 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { public Identifier getRegistryName() { Identifier current = Registry.CHUNK_GENERATOR_TYPE.getId((ChunkGeneratorType) (Object) this); - Identifier set = registryName; - return current != null ? current : set; + return current != null ? current : registryName; } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinContainerType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinContainerType.java index f1d53309..6c3ede2f 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinContainerType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinContainerType.java @@ -43,9 +43,8 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { public Identifier getRegistryName() { Identifier current = Registry.CONTAINER.getId((ContainerType) (Object) this); - Identifier set = registryName; - return current != null ? current : set; + return current != null ? current : registryName; } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCookingRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCookingRecipeSerializer.java index 7f1358cd..41274d2e 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCookingRecipeSerializer.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCookingRecipeSerializer.java @@ -44,9 +44,8 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { public Identifier getRegistryName() { Identifier current = Registry.RECIPE_SERIALIZER.getId((CookingRecipeSerializer) (Object) this); - Identifier set = registryName; - return current != null ? current : set; + return current != null ? current : registryName; } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCuttingRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCuttingRecipeSerializer.java index 596d41ac..ce6a69b3 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCuttingRecipeSerializer.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCuttingRecipeSerializer.java @@ -44,9 +44,8 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { public Identifier getRegistryName() { Identifier current = Registry.RECIPE_SERIALIZER.getId((CuttingRecipe.Serializer) (Object) this); - Identifier set = registryName; - return current != null ? current : set; + return current != null ? current : registryName; } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinDecorator.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinDecorator.java index 4e4ab0e1..e1ab09af 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinDecorator.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinDecorator.java @@ -43,9 +43,8 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { public Identifier getRegistryName() { Identifier current = Registry.DECORATOR.getId((Decorator) (Object) this); - Identifier set = registryName; - return current != null ? current : set; + return current != null ? current : registryName; } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEnchantment.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEnchantment.java index 6d858cca..4773a8a1 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEnchantment.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEnchantment.java @@ -43,9 +43,8 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { public Identifier getRegistryName() { Identifier current = Registry.ENCHANTMENT.getId((Enchantment) (Object) this); - Identifier set = registryName; - return current != null ? current : set; + return current != null ? current : registryName; } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinFeature.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinFeature.java index d118a95a..fe707fcb 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinFeature.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinFeature.java @@ -43,9 +43,8 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { public Identifier getRegistryName() { Identifier current = Registry.FEATURE.getId((Feature) (Object) this); - Identifier set = registryName; - return current != null ? current : set; + return current != null ? current : registryName; } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinParticleType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinParticleType.java index 738505c3..033d4a09 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinParticleType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinParticleType.java @@ -43,9 +43,8 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { public Identifier getRegistryName() { Identifier current = Registry.PARTICLE_TYPE.getId((ParticleType) (Object) this); - Identifier set = registryName; - return current != null ? current : set; + return current != null ? current : registryName; } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSchedule.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSchedule.java index d9d41814..cfec3048 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSchedule.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSchedule.java @@ -43,9 +43,8 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { public Identifier getRegistryName() { Identifier current = Registry.SCHEDULE.getId((Schedule) (Object) this); - Identifier set = registryName; - return current != null ? current : set; + return current != null ? current : registryName; } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapedRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapedRecipeSerializer.java index 57042bfe..ee02e8db 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapedRecipeSerializer.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapedRecipeSerializer.java @@ -44,9 +44,8 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { public Identifier getRegistryName() { Identifier current = Registry.RECIPE_SERIALIZER.getId((ShapedRecipe.Serializer) (Object) this); - Identifier set = registryName; - return current != null ? current : set; + return current != null ? current : registryName; } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapelessRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapelessRecipeSerializer.java index e2d03954..0363da73 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapelessRecipeSerializer.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapelessRecipeSerializer.java @@ -44,9 +44,8 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { public Identifier getRegistryName() { Identifier current = Registry.RECIPE_SERIALIZER.getId((ShapelessRecipe.Serializer) (Object) this); - Identifier set = registryName; - return current != null ? current : set; + return current != null ? current : registryName; } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSoundEvent.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSoundEvent.java index b2d76a15..e9744ede 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSoundEvent.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSoundEvent.java @@ -43,9 +43,8 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { public Identifier getRegistryName() { Identifier current = Registry.SOUND_EVENT.getId((SoundEvent) (Object) this); - Identifier set = registryName; - return current != null ? current : set; + return current != null ? current : registryName; } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSpecialRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSpecialRecipeSerializer.java index c8170c1d..99009c75 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSpecialRecipeSerializer.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSpecialRecipeSerializer.java @@ -44,9 +44,8 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { public Identifier getRegistryName() { Identifier current = Registry.RECIPE_SERIALIZER.getId((SpecialRecipeSerializer) (Object) this); - Identifier set = registryName; - return current != null ? current : set; + return current != null ? current : registryName; } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatType.java index 6db2e58f..55d886fb 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatType.java @@ -43,9 +43,8 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { public Identifier getRegistryName() { Identifier current = Registry.STAT_TYPE.getId((StatType) (Object) this); - Identifier set = registryName; - return current != null ? current : set; + return current != null ? current : registryName; } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatusEffect.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatusEffect.java index da98041f..92afa6ba 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatusEffect.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatusEffect.java @@ -43,9 +43,8 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { public Identifier getRegistryName() { Identifier current = Registry.STATUS_EFFECT.getId((StatusEffect) (Object) this); - Identifier set = registryName; - return current != null ? current : set; + return current != null ? current : registryName; } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSurfaceBuilder.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSurfaceBuilder.java index e3bfd87b..e85870c8 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSurfaceBuilder.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSurfaceBuilder.java @@ -43,9 +43,8 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { public Identifier getRegistryName() { Identifier current = Registry.SURFACE_BUILDER.getId((SurfaceBuilder) (Object) this); - Identifier set = registryName; - return current != null ? current : set; + return current != null ? current : registryName; } public Class getRegistryType() { From 6362526897d7da233c111f39323399610653ff91 Mon Sep 17 00:00:00 2001 From: Florens Pauwels Date: Sun, 26 Jan 2020 02:41:25 +0100 Subject: [PATCH 4/9] Deduplication --- .../patchworkmc/mixin/registries/MixinActivity.java | 5 +++-- .../mixin/registries/MixinBiomeSourceType.java | 5 +++-- .../mixin/registries/MixinBlockEntityType.java | 5 +++-- .../com/patchworkmc/mixin/registries/MixinCarver.java | 5 +++-- .../mixin/registries/MixinChunkGeneratorType.java | 5 +++-- .../patchworkmc/mixin/registries/MixinChunkStatus.java | 10 +++------- .../mixin/registries/MixinContainerType.java | 5 +++-- .../mixin/registries/MixinCookingRecipeSerializer.java | 5 +++-- .../mixin/registries/MixinCuttingRecipeSerializer.java | 5 +++-- .../patchworkmc/mixin/registries/MixinDecorator.java | 5 +++-- .../patchworkmc/mixin/registries/MixinEnchantment.java | 5 +++-- .../patchworkmc/mixin/registries/MixinEntityType.java | 10 +++------- .../com/patchworkmc/mixin/registries/MixinFluid.java | 10 +++------- .../mixin/registries/MixinMemoryModuleType.java | 10 +++------- .../mixin/registries/MixinPaintingMotive.java | 10 +++------- .../mixin/registries/MixinParticleType.java | 5 +++-- .../mixin/registries/MixinPointOfInterestType.java | 10 +++------- .../com/patchworkmc/mixin/registries/MixinPotion.java | 10 +++------- .../patchworkmc/mixin/registries/MixinSchedule.java | 5 +++-- .../patchworkmc/mixin/registries/MixinSensorType.java | 10 +++------- .../mixin/registries/MixinShapedRecipeSerializer.java | 5 +++-- .../registries/MixinShapelessRecipeSerializer.java | 5 +++-- .../patchworkmc/mixin/registries/MixinSoundEvent.java | 5 +++-- .../mixin/registries/MixinSpecialRecipeSerializer.java | 5 +++-- .../patchworkmc/mixin/registries/MixinStatType.java | 5 +++-- .../mixin/registries/MixinStatusEffect.java | 5 +++-- .../mixin/registries/MixinVillagerProfession.java | 10 +++------- 27 files changed, 81 insertions(+), 99 deletions(-) diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinActivity.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinActivity.java index 67922e46..8558893f 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinActivity.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinActivity.java @@ -28,6 +28,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(Activity.class) public class MixinActivity implements ExtendedForgeRegistryEntry { @@ -42,9 +43,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.ACTIVITY.getId((Activity) (Object) this); + Activity activity = (Activity) (Object) this; - return current != null ? current : registryName; + return Identifiers.getOrFallback(Registry.ACTIVITY, activity, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiomeSourceType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiomeSourceType.java index 5efee5ad..740248f3 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiomeSourceType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiomeSourceType.java @@ -28,6 +28,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(BiomeSourceType.class) public class MixinBiomeSourceType implements ExtendedForgeRegistryEntry { @@ -42,9 +43,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.BIOME_SOURCE_TYPE.getId((BiomeSourceType) (Object) this); + BiomeSourceType biomeSourceType = (BiomeSourceType) (Object) this; - return current != null ? current : registryName; + return Identifiers.getOrFallback(Registry.BIOME_SOURCE_TYPE, biomeSourceType, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBlockEntityType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBlockEntityType.java index 47a2ae84..cf4709a9 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBlockEntityType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBlockEntityType.java @@ -28,6 +28,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(BlockEntityType.class) public class MixinBlockEntityType implements ExtendedForgeRegistryEntry { @@ -42,9 +43,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.BLOCK_ENTITY.getId((BlockEntityType) (Object) this); + BlockEntityType blockEntityType = (BlockEntityType) (Object) this; - return current != null ? current : registryName; + return Identifiers.getOrFallback(Registry.BLOCK_ENTITY, blockEntityType, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCarver.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCarver.java index 3a4acdc2..cbdec2b0 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCarver.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCarver.java @@ -28,6 +28,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(Carver.class) public class MixinCarver implements ExtendedForgeRegistryEntry { @@ -42,9 +43,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.CARVER.getId((Carver) (Object) this); + Carver carver = (Carver) (Object) this; - return current != null ? current : registryName; + return Identifiers.getOrFallback(Registry.CARVER, carver, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkGeneratorType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkGeneratorType.java index e4f909af..949be092 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkGeneratorType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkGeneratorType.java @@ -28,6 +28,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(ChunkGeneratorType.class) public class MixinChunkGeneratorType implements ExtendedForgeRegistryEntry { @@ -42,9 +43,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.CHUNK_GENERATOR_TYPE.getId((ChunkGeneratorType) (Object) this); + ChunkGeneratorType chunkGeneratorType = (ChunkGeneratorType) (Object) this; - return current != null ? current : registryName; + return Identifiers.getOrFallback(Registry.CHUNK_GENERATOR_TYPE, chunkGeneratorType, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkStatus.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkStatus.java index 46a41df2..b1c91723 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkStatus.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkStatus.java @@ -28,6 +28,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(ChunkStatus.class) public class MixinChunkStatus implements ExtendedForgeRegistryEntry { @@ -42,14 +43,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.CHUNK_STATUS.getId((ChunkStatus) (Object) this); - Identifier set = registryName; + ChunkStatus chunkStatus = (ChunkStatus) (Object) this; - if (set == null) { - set = Registry.CHUNK_STATUS.getDefaultId(); - } - - return current != Registry.CHUNK_STATUS.getDefaultId() ? current : set; + return Identifiers.getOrFallback(Registry.CHUNK_STATUS, chunkStatus, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinContainerType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinContainerType.java index 6c3ede2f..7795fefe 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinContainerType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinContainerType.java @@ -28,6 +28,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(ContainerType.class) public class MixinContainerType implements ExtendedForgeRegistryEntry { @@ -42,9 +43,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.CONTAINER.getId((ContainerType) (Object) this); + ContainerType containerType = (ContainerType) (Object) this; - return current != null ? current : registryName; + return Identifiers.getOrFallback(Registry.CONTAINER, containerType, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCookingRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCookingRecipeSerializer.java index 41274d2e..d9e0cbfa 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCookingRecipeSerializer.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCookingRecipeSerializer.java @@ -29,6 +29,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(CookingRecipeSerializer.class) public class MixinCookingRecipeSerializer implements ExtendedForgeRegistryEntry { @@ -43,9 +44,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.RECIPE_SERIALIZER.getId((CookingRecipeSerializer) (Object) this); + CookingRecipeSerializer cookingRecipeSerializer = (CookingRecipeSerializer) (Object) this; - return current != null ? current : registryName; + return Identifiers.getOrFallback(Registry.RECIPE_SERIALIZER, cookingRecipeSerializer, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCuttingRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCuttingRecipeSerializer.java index ce6a69b3..5ee3f229 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCuttingRecipeSerializer.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCuttingRecipeSerializer.java @@ -29,6 +29,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(CuttingRecipe.Serializer.class) public class MixinCuttingRecipeSerializer implements ExtendedForgeRegistryEntry { @@ -43,9 +44,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.RECIPE_SERIALIZER.getId((CuttingRecipe.Serializer) (Object) this); + CuttingRecipe.Serializer cuttingRecipeSerializer = (CuttingRecipe.Serializer) (Object) this; - return current != null ? current : registryName; + return Identifiers.getOrFallback(Registry.RECIPE_SERIALIZER, cuttingRecipeSerializer, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinDecorator.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinDecorator.java index e1ab09af..c2f8e56a 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinDecorator.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinDecorator.java @@ -28,6 +28,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(Decorator.class) public class MixinDecorator implements ExtendedForgeRegistryEntry { @@ -42,9 +43,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.DECORATOR.getId((Decorator) (Object) this); + Decorator decorator = (Decorator) (Object) this; - return current != null ? current : registryName; + return Identifiers.getOrFallback(Registry.DECORATOR, decorator, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEnchantment.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEnchantment.java index 4773a8a1..30d474ac 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEnchantment.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEnchantment.java @@ -28,6 +28,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(Enchantment.class) public class MixinEnchantment implements ExtendedForgeRegistryEntry { @@ -42,9 +43,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.ENCHANTMENT.getId((Enchantment) (Object) this); + Enchantment enchantment = (Enchantment) (Object) this; - return current != null ? current : registryName; + return Identifiers.getOrFallback(Registry.ENCHANTMENT, enchantment, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEntityType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEntityType.java index 1e156717..e47ed7e1 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEntityType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEntityType.java @@ -28,6 +28,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(EntityType.class) public class MixinEntityType implements ExtendedForgeRegistryEntry { @@ -42,14 +43,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.ENTITY_TYPE.getId((EntityType) (Object) this); - Identifier set = registryName; + EntityType entityType = (EntityType) (Object) this; - if (set == null) { - set = Registry.ENTITY_TYPE.getDefaultId(); - } - - return current != Registry.ENTITY_TYPE.getDefaultId() ? current : set; + return Identifiers.getOrFallback(Registry.ENTITY_TYPE, entityType, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinFluid.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinFluid.java index 904edafb..3465a534 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinFluid.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinFluid.java @@ -28,6 +28,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(Fluid.class) public class MixinFluid implements ExtendedForgeRegistryEntry { @@ -42,14 +43,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.FLUID.getId((Fluid) (Object) this); - Identifier set = registryName; + Fluid fluid = (Fluid) (Object) this; - if (set == null) { - set = Registry.FLUID.getDefaultId(); - } - - return current != Registry.FLUID.getDefaultId() ? current : set; + return Identifiers.getOrFallback(Registry.FLUID, fluid, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinMemoryModuleType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinMemoryModuleType.java index d0bc6756..193e73f0 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinMemoryModuleType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinMemoryModuleType.java @@ -28,6 +28,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(MemoryModuleType.class) public class MixinMemoryModuleType implements ExtendedForgeRegistryEntry { @@ -42,14 +43,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.MEMORY_MODULE_TYPE.getId((MemoryModuleType) (Object) this); - Identifier set = registryName; + MemoryModuleType memoryModuleType = (MemoryModuleType) (Object) this; - if (set == null) { - set = Registry.MEMORY_MODULE_TYPE.getDefaultId(); - } - - return current != Registry.MEMORY_MODULE_TYPE.getDefaultId() ? current : set; + return Identifiers.getOrFallback(Registry.MEMORY_MODULE_TYPE, memoryModuleType, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPaintingMotive.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPaintingMotive.java index 13dfa855..fd1beec3 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPaintingMotive.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPaintingMotive.java @@ -28,6 +28,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(PaintingMotive.class) public class MixinPaintingMotive implements ExtendedForgeRegistryEntry { @@ -42,14 +43,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.MOTIVE.getId((PaintingMotive) (Object) this); - Identifier set = registryName; + PaintingMotive paintingMotive = (PaintingMotive) (Object) this; - if (set == null) { - set = Registry.MOTIVE.getDefaultId(); - } - - return current != Registry.MOTIVE.getDefaultId() ? current : set; + return Identifiers.getOrFallback(Registry.MOTIVE, paintingMotive, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinParticleType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinParticleType.java index 033d4a09..28f86f76 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinParticleType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinParticleType.java @@ -28,6 +28,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(ParticleType.class) public class MixinParticleType implements ExtendedForgeRegistryEntry { @@ -42,9 +43,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.PARTICLE_TYPE.getId((ParticleType) (Object) this); + ParticleType particleType = (ParticleType) (Object) this; - return current != null ? current : registryName; + return Identifiers.getOrFallback(Registry.PARTICLE_TYPE, particleType, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPointOfInterestType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPointOfInterestType.java index ffce3006..483fb6ad 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPointOfInterestType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPointOfInterestType.java @@ -28,6 +28,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(PointOfInterestType.class) public class MixinPointOfInterestType implements ExtendedForgeRegistryEntry { @@ -42,14 +43,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.POINT_OF_INTEREST_TYPE.getId((PointOfInterestType) (Object) this); - Identifier set = registryName; + PointOfInterestType pointOfInterestType = (PointOfInterestType) (Object) this; - if (set == null) { - set = Registry.POINT_OF_INTEREST_TYPE.getDefaultId(); - } - - return current != Registry.POINT_OF_INTEREST_TYPE.getDefaultId() ? current : set; + return Identifiers.getOrFallback(Registry.POINT_OF_INTEREST_TYPE, pointOfInterestType, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPotion.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPotion.java index 889d15a0..1d479b7b 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPotion.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPotion.java @@ -28,6 +28,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(Potion.class) public class MixinPotion implements ExtendedForgeRegistryEntry { @@ -42,14 +43,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.POTION.getId((Potion) (Object) this); - Identifier set = registryName; + Potion potion = (Potion) (Object) this; - if (set == null) { - set = Registry.POTION.getDefaultId(); - } - - return current != Registry.POTION.getDefaultId() ? current : set; + return Identifiers.getOrFallback(Registry.POTION, potion, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSchedule.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSchedule.java index cfec3048..53edc0a7 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSchedule.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSchedule.java @@ -28,6 +28,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(Schedule.class) public class MixinSchedule implements ExtendedForgeRegistryEntry { @@ -42,9 +43,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.SCHEDULE.getId((Schedule) (Object) this); + Schedule schedule = (Schedule) (Object) this; - return current != null ? current : registryName; + return Identifiers.getOrFallback(Registry.SCHEDULE, schedule, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSensorType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSensorType.java index 7f574dd9..b20648bc 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSensorType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSensorType.java @@ -28,6 +28,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(SensorType.class) public class MixinSensorType implements ExtendedForgeRegistryEntry { @@ -42,14 +43,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.SENSOR_TYPE.getId((SensorType) (Object) this); - Identifier set = registryName; + SensorType sensorType = (SensorType) (Object) this; - if (set == null) { - set = Registry.SENSOR_TYPE.getDefaultId(); - } - - return current != Registry.SENSOR_TYPE.getDefaultId() ? current : set; + return Identifiers.getOrFallback(Registry.SENSOR_TYPE, sensorType, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapedRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapedRecipeSerializer.java index ee02e8db..eaa77c6d 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapedRecipeSerializer.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapedRecipeSerializer.java @@ -29,6 +29,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(ShapedRecipe.Serializer.class) public class MixinShapedRecipeSerializer implements ExtendedForgeRegistryEntry { @@ -43,9 +44,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.RECIPE_SERIALIZER.getId((ShapedRecipe.Serializer) (Object) this); + ShapedRecipe.Serializer shapedRecipeSerializer = (ShapedRecipe.Serializer) (Object) this; - return current != null ? current : registryName; + return Identifiers.getOrFallback(Registry.RECIPE_SERIALIZER, shapedRecipeSerializer, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapelessRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapelessRecipeSerializer.java index 0363da73..b6fc5908 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapelessRecipeSerializer.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapelessRecipeSerializer.java @@ -29,6 +29,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(ShapelessRecipe.Serializer.class) public class MixinShapelessRecipeSerializer implements ExtendedForgeRegistryEntry { @@ -43,9 +44,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.RECIPE_SERIALIZER.getId((ShapelessRecipe.Serializer) (Object) this); + ShapelessRecipe.Serializer shapelessRecipeSerializer = (ShapelessRecipe.Serializer) (Object) this; - return current != null ? current : registryName; + return Identifiers.getOrFallback(Registry.RECIPE_SERIALIZER, shapelessRecipeSerializer, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSoundEvent.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSoundEvent.java index e9744ede..8619dade 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSoundEvent.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSoundEvent.java @@ -28,6 +28,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(SoundEvent.class) public class MixinSoundEvent implements ExtendedForgeRegistryEntry { @@ -42,9 +43,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.SOUND_EVENT.getId((SoundEvent) (Object) this); + SoundEvent soundEvent = (SoundEvent) (Object) this; - return current != null ? current : registryName; + return Identifiers.getOrFallback(Registry.SOUND_EVENT, soundEvent, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSpecialRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSpecialRecipeSerializer.java index 99009c75..9c343b1e 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSpecialRecipeSerializer.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSpecialRecipeSerializer.java @@ -29,6 +29,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(SpecialRecipeSerializer.class) public class MixinSpecialRecipeSerializer implements ExtendedForgeRegistryEntry { @@ -43,9 +44,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.RECIPE_SERIALIZER.getId((SpecialRecipeSerializer) (Object) this); + SpecialRecipeSerializer specialRecipeSerializer = (SpecialRecipeSerializer) (Object) this; - return current != null ? current : registryName; + return Identifiers.getOrFallback(Registry.RECIPE_SERIALIZER, specialRecipeSerializer, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatType.java index 55d886fb..b46ed042 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatType.java @@ -28,6 +28,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(StatType.class) public class MixinStatType implements ExtendedForgeRegistryEntry { @@ -42,9 +43,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.STAT_TYPE.getId((StatType) (Object) this); + StatType statType = (StatType) (Object) this; - return current != null ? current : registryName; + return Identifiers.getOrFallback(Registry.STAT_TYPE, statType, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatusEffect.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatusEffect.java index 92afa6ba..9a38b9ca 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatusEffect.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatusEffect.java @@ -28,6 +28,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(StatusEffect.class) public class MixinStatusEffect implements ExtendedForgeRegistryEntry { @@ -42,9 +43,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.STATUS_EFFECT.getId((StatusEffect) (Object) this); + StatusEffect statusEffect = (StatusEffect) (Object) this; - return current != null ? current : registryName; + return Identifiers.getOrFallback(Registry.STATUS_EFFECT, statusEffect, registryName); } public Class getRegistryType() { diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinVillagerProfession.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinVillagerProfession.java index 2d45af14..b9431e1f 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinVillagerProfession.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinVillagerProfession.java @@ -28,6 +28,7 @@ import net.minecraft.util.registry.Registry; import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; @Mixin(VillagerProfession.class) public class MixinVillagerProfession implements ExtendedForgeRegistryEntry { @@ -42,14 +43,9 @@ public IForgeRegistryEntry setRegistryName(Identifier name) { } public Identifier getRegistryName() { - Identifier current = Registry.VILLAGER_PROFESSION.getId((VillagerProfession) (Object) this); - Identifier set = registryName; + VillagerProfession villagerProfession = (VillagerProfession) (Object) this; - if (set == null) { - set = Registry.VILLAGER_PROFESSION.getDefaultId(); - } - - return current != Registry.VILLAGER_PROFESSION.getDefaultId() ? current : set; + return Identifiers.getOrFallback(Registry.VILLAGER_PROFESSION, villagerProfession, registryName); } public Class getRegistryType() { From 16c7932e5f14098c1869634829720e76a8df8ba2 Mon Sep 17 00:00:00 2001 From: Florens Pauwels Date: Sun, 26 Jan 2020 02:48:50 +0100 Subject: [PATCH 5/9] =?UTF-8?q?why=20not=20=C2=AF\=5F(=E3=83=84)=5F/=C2=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/patchworkmc/mixin/registries/MixinActivity.java | 2 +- .../main/java/com/patchworkmc/mixin/registries/MixinBiome.java | 2 +- .../com/patchworkmc/mixin/registries/MixinBiomeSourceType.java | 2 +- .../com/patchworkmc/mixin/registries/MixinBlockEntityType.java | 2 +- .../main/java/com/patchworkmc/mixin/registries/MixinCarver.java | 2 +- .../patchworkmc/mixin/registries/MixinChunkGeneratorType.java | 2 +- .../java/com/patchworkmc/mixin/registries/MixinChunkStatus.java | 2 +- .../com/patchworkmc/mixin/registries/MixinContainerType.java | 2 +- .../mixin/registries/MixinCookingRecipeSerializer.java | 2 +- .../mixin/registries/MixinCuttingRecipeSerializer.java | 2 +- .../java/com/patchworkmc/mixin/registries/MixinDecorator.java | 2 +- .../java/com/patchworkmc/mixin/registries/MixinEnchantment.java | 2 +- .../java/com/patchworkmc/mixin/registries/MixinEntityType.java | 2 +- .../java/com/patchworkmc/mixin/registries/MixinFeature.java | 2 +- .../main/java/com/patchworkmc/mixin/registries/MixinFluid.java | 2 +- .../main/java/com/patchworkmc/mixin/registries/MixinItem.java | 2 +- .../com/patchworkmc/mixin/registries/MixinMemoryModuleType.java | 2 +- .../com/patchworkmc/mixin/registries/MixinPaintingMotive.java | 2 +- .../com/patchworkmc/mixin/registries/MixinParticleType.java | 2 +- .../patchworkmc/mixin/registries/MixinPointOfInterestType.java | 2 +- .../main/java/com/patchworkmc/mixin/registries/MixinPotion.java | 2 +- .../java/com/patchworkmc/mixin/registries/MixinSchedule.java | 2 +- .../java/com/patchworkmc/mixin/registries/MixinSensorType.java | 2 +- .../mixin/registries/MixinShapedRecipeSerializer.java | 2 +- .../mixin/registries/MixinShapelessRecipeSerializer.java | 2 +- .../java/com/patchworkmc/mixin/registries/MixinSoundEvent.java | 2 +- .../mixin/registries/MixinSpecialRecipeSerializer.java | 2 +- .../java/com/patchworkmc/mixin/registries/MixinStatType.java | 2 +- .../com/patchworkmc/mixin/registries/MixinStatusEffect.java | 2 +- .../com/patchworkmc/mixin/registries/MixinSurfaceBuilder.java | 2 +- .../patchworkmc/mixin/registries/MixinVillagerProfession.java | 2 +- 31 files changed, 31 insertions(+), 31 deletions(-) diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinActivity.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinActivity.java index 8558893f..bfe26c4f 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinActivity.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinActivity.java @@ -36,7 +36,7 @@ public class MixinActivity implements ExtendedForgeRegistryEntry { private Identifier registryName; @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { + public IForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiome.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiome.java index 920e7db8..d01c2ba1 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiome.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiome.java @@ -36,7 +36,7 @@ public class MixinBiome implements ExtendedForgeRegistryEntry { private Identifier registryName; @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { + public IForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiomeSourceType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiomeSourceType.java index 740248f3..08fe59e4 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiomeSourceType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiomeSourceType.java @@ -36,7 +36,7 @@ public class MixinBiomeSourceType implements ExtendedForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBlockEntityType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBlockEntityType.java index cf4709a9..b42af8a3 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBlockEntityType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBlockEntityType.java @@ -36,7 +36,7 @@ public class MixinBlockEntityType implements ExtendedForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCarver.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCarver.java index cbdec2b0..80adf7f6 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCarver.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCarver.java @@ -36,7 +36,7 @@ public class MixinCarver implements ExtendedForgeRegistryEntry { private Identifier registryName; @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { + public IForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkGeneratorType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkGeneratorType.java index 949be092..0f67090a 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkGeneratorType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkGeneratorType.java @@ -36,7 +36,7 @@ public class MixinChunkGeneratorType implements ExtendedForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkStatus.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkStatus.java index b1c91723..23df3c47 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkStatus.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkStatus.java @@ -36,7 +36,7 @@ public class MixinChunkStatus implements ExtendedForgeRegistryEntry private Identifier registryName; @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { + public IForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinContainerType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinContainerType.java index 7795fefe..41b82381 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinContainerType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinContainerType.java @@ -36,7 +36,7 @@ public class MixinContainerType implements ExtendedForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCookingRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCookingRecipeSerializer.java index d9e0cbfa..3d7403e2 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCookingRecipeSerializer.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCookingRecipeSerializer.java @@ -37,7 +37,7 @@ public class MixinCookingRecipeSerializer implements ExtendedForgeRegistryEntry< private Identifier registryName; @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { + public IForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCuttingRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCuttingRecipeSerializer.java index 5ee3f229..d6795376 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCuttingRecipeSerializer.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCuttingRecipeSerializer.java @@ -37,7 +37,7 @@ public class MixinCuttingRecipeSerializer implements ExtendedForgeRegistryEntry< private Identifier registryName; @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { + public IForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinDecorator.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinDecorator.java index c2f8e56a..8ff166c7 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinDecorator.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinDecorator.java @@ -36,7 +36,7 @@ public class MixinDecorator implements ExtendedForgeRegistryEntry { private Identifier registryName; @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { + public IForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEnchantment.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEnchantment.java index 30d474ac..4d74a997 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEnchantment.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEnchantment.java @@ -36,7 +36,7 @@ public class MixinEnchantment implements ExtendedForgeRegistryEntry private Identifier registryName; @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { + public IForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEntityType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEntityType.java index e47ed7e1..d76b37e8 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEntityType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEntityType.java @@ -36,7 +36,7 @@ public class MixinEntityType implements ExtendedForgeRegistryEntry { private Identifier registryName; @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { + public IForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinFeature.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinFeature.java index a197ff95..ba3eb68f 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinFeature.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinFeature.java @@ -36,7 +36,7 @@ public class MixinFeature implements ExtendedForgeRegistryEntry { private Identifier registryName; @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { + public IForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinFluid.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinFluid.java index 3465a534..8d15e643 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinFluid.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinFluid.java @@ -36,7 +36,7 @@ public class MixinFluid implements ExtendedForgeRegistryEntry { private Identifier registryName; @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { + public IForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinItem.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinItem.java index ea7a2bea..54f8f9ca 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinItem.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinItem.java @@ -36,7 +36,7 @@ public class MixinItem implements ExtendedForgeRegistryEntry { private Identifier registryName; @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { + public IForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinMemoryModuleType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinMemoryModuleType.java index 193e73f0..81d35850 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinMemoryModuleType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinMemoryModuleType.java @@ -36,7 +36,7 @@ public class MixinMemoryModuleType implements ExtendedForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPaintingMotive.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPaintingMotive.java index fd1beec3..35c693c3 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPaintingMotive.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPaintingMotive.java @@ -36,7 +36,7 @@ public class MixinPaintingMotive implements ExtendedForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinParticleType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinParticleType.java index 28f86f76..8138d081 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinParticleType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinParticleType.java @@ -36,7 +36,7 @@ public class MixinParticleType implements ExtendedForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPointOfInterestType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPointOfInterestType.java index 483fb6ad..65f8a484 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPointOfInterestType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPointOfInterestType.java @@ -36,7 +36,7 @@ public class MixinPointOfInterestType implements ExtendedForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPotion.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPotion.java index 1d479b7b..56e1d881 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPotion.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPotion.java @@ -36,7 +36,7 @@ public class MixinPotion implements ExtendedForgeRegistryEntry { private Identifier registryName; @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { + public IForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSchedule.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSchedule.java index 53edc0a7..23ea9810 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSchedule.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSchedule.java @@ -36,7 +36,7 @@ public class MixinSchedule implements ExtendedForgeRegistryEntry { private Identifier registryName; @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { + public IForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSensorType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSensorType.java index b20648bc..9765da91 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSensorType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSensorType.java @@ -36,7 +36,7 @@ public class MixinSensorType implements ExtendedForgeRegistryEntry { private Identifier registryName; @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { + public IForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapedRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapedRecipeSerializer.java index eaa77c6d..46d85ea4 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapedRecipeSerializer.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapedRecipeSerializer.java @@ -37,7 +37,7 @@ public class MixinShapedRecipeSerializer implements ExtendedForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapelessRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapelessRecipeSerializer.java index b6fc5908..c6fa4683 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapelessRecipeSerializer.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapelessRecipeSerializer.java @@ -37,7 +37,7 @@ public class MixinShapelessRecipeSerializer implements ExtendedForgeRegistryEntr private Identifier registryName; @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { + public IForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSoundEvent.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSoundEvent.java index 8619dade..7e9a3050 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSoundEvent.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSoundEvent.java @@ -36,7 +36,7 @@ public class MixinSoundEvent implements ExtendedForgeRegistryEntry { private Identifier registryName; @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { + public IForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSpecialRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSpecialRecipeSerializer.java index 9c343b1e..ce0e9c97 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSpecialRecipeSerializer.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSpecialRecipeSerializer.java @@ -37,7 +37,7 @@ public class MixinSpecialRecipeSerializer implements ExtendedForgeRegistryEntry< private Identifier registryName; @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { + public IForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatType.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatType.java index b46ed042..b58bc40b 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatType.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatType.java @@ -36,7 +36,7 @@ public class MixinStatType implements ExtendedForgeRegistryEntry { private Identifier registryName; @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { + public IForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatusEffect.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatusEffect.java index 9a38b9ca..0793f264 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatusEffect.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinStatusEffect.java @@ -36,7 +36,7 @@ public class MixinStatusEffect implements ExtendedForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSurfaceBuilder.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSurfaceBuilder.java index 33cbf2b5..bbc96c15 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSurfaceBuilder.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSurfaceBuilder.java @@ -36,7 +36,7 @@ public class MixinSurfaceBuilder implements ExtendedForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinVillagerProfession.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinVillagerProfession.java index b9431e1f..1fc9b724 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinVillagerProfession.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinVillagerProfession.java @@ -36,7 +36,7 @@ public class MixinVillagerProfession implements ExtendedForgeRegistryEntry setRegistryName(Identifier name) { this.registryName = name; return this; From 9193935576982b0b2e1ef91723eded3609e92b87 Mon Sep 17 00:00:00 2001 From: Florens Pauwels Date: Sun, 26 Jan 2020 04:10:17 +0100 Subject: [PATCH 6/9] e n h a n c e (RecipeSerializers) --- .../MixinCookingRecipeSerializer.java | 55 ------------------- .../MixinCuttingRecipeSerializer.java | 55 ------------------- .../MixinRecipeSerializerSubclass.java | 40 ++++++++++++++ .../MixinShapedRecipeSerializer.java | 55 ------------------- .../MixinShapelessRecipeSerializer.java | 55 ------------------- .../MixinSpecialRecipeSerializer.java | 55 ------------------- .../patchwork-registries.mixins.json | 6 +- 7 files changed, 41 insertions(+), 280 deletions(-) delete mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCookingRecipeSerializer.java delete mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCuttingRecipeSerializer.java create mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinRecipeSerializerSubclass.java delete mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapedRecipeSerializer.java delete mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapelessRecipeSerializer.java delete mode 100644 patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSpecialRecipeSerializer.java diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCookingRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCookingRecipeSerializer.java deleted file mode 100644 index 3d7403e2..00000000 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCookingRecipeSerializer.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Minecraft Forge, Patchwork Project - * Copyright (c) 2016-2020, 2019-2020 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package com.patchworkmc.mixin.registries; - -import net.minecraftforge.registries.IForgeRegistryEntry; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; - -import net.minecraft.recipe.RecipeSerializer; -import net.minecraft.recipe.CookingRecipeSerializer; -import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; - -import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; -import com.patchworkmc.impl.registries.Identifiers; - -@Mixin(CookingRecipeSerializer.class) -public class MixinCookingRecipeSerializer implements ExtendedForgeRegistryEntry { - @Unique - private Identifier registryName; - - @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { - this.registryName = name; - - return this; - } - - public Identifier getRegistryName() { - CookingRecipeSerializer cookingRecipeSerializer = (CookingRecipeSerializer) (Object) this; - - return Identifiers.getOrFallback(Registry.RECIPE_SERIALIZER, cookingRecipeSerializer, registryName); - } - - public Class getRegistryType() { - return RecipeSerializer.class; - } -} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCuttingRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCuttingRecipeSerializer.java deleted file mode 100644 index d6795376..00000000 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinCuttingRecipeSerializer.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Minecraft Forge, Patchwork Project - * Copyright (c) 2016-2020, 2019-2020 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package com.patchworkmc.mixin.registries; - -import net.minecraftforge.registries.IForgeRegistryEntry; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; - -import net.minecraft.recipe.RecipeSerializer; -import net.minecraft.recipe.CuttingRecipe; -import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; - -import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; -import com.patchworkmc.impl.registries.Identifiers; - -@Mixin(CuttingRecipe.Serializer.class) -public class MixinCuttingRecipeSerializer implements ExtendedForgeRegistryEntry { - @Unique - private Identifier registryName; - - @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { - this.registryName = name; - - return this; - } - - public Identifier getRegistryName() { - CuttingRecipe.Serializer cuttingRecipeSerializer = (CuttingRecipe.Serializer) (Object) this; - - return Identifiers.getOrFallback(Registry.RECIPE_SERIALIZER, cuttingRecipeSerializer, registryName); - } - - public Class getRegistryType() { - return RecipeSerializer.class; - } -} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinRecipeSerializerSubclass.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinRecipeSerializerSubclass.java new file mode 100644 index 00000000..6bbf5e33 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinRecipeSerializerSubclass.java @@ -0,0 +1,40 @@ +package com.patchworkmc.mixin.registries; + +import net.minecraftforge.registries.IForgeRegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +import net.minecraft.recipe.CookingRecipeSerializer; +import net.minecraft.recipe.CuttingRecipe; +import net.minecraft.recipe.RecipeSerializer; +import net.minecraft.recipe.ShapedRecipe; +import net.minecraft.recipe.ShapelessRecipe; +import net.minecraft.recipe.SpecialRecipeSerializer; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; +import com.patchworkmc.impl.registries.Identifiers; + +@Mixin({ShapedRecipe.Serializer.class, ShapelessRecipe.Serializer.class, CookingRecipeSerializer.class, CuttingRecipe.Serializer.class, SpecialRecipeSerializer.class}) +public class MixinRecipeSerializerSubclass implements ExtendedForgeRegistryEntry { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + RecipeSerializer recipeSerializer = (RecipeSerializer) this; + + return Identifiers.getOrFallback(Registry.RECIPE_SERIALIZER, recipeSerializer, registryName); + } + + public Class getRegistryType() { + return RecipeSerializer.class; + } +} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapedRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapedRecipeSerializer.java deleted file mode 100644 index 46d85ea4..00000000 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapedRecipeSerializer.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Minecraft Forge, Patchwork Project - * Copyright (c) 2016-2020, 2019-2020 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package com.patchworkmc.mixin.registries; - -import net.minecraftforge.registries.IForgeRegistryEntry; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; - -import net.minecraft.recipe.RecipeSerializer; -import net.minecraft.recipe.ShapedRecipe; -import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; - -import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; -import com.patchworkmc.impl.registries.Identifiers; - -@Mixin(ShapedRecipe.Serializer.class) -public class MixinShapedRecipeSerializer implements ExtendedForgeRegistryEntry { - @Unique - private Identifier registryName; - - @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { - this.registryName = name; - - return this; - } - - public Identifier getRegistryName() { - ShapedRecipe.Serializer shapedRecipeSerializer = (ShapedRecipe.Serializer) (Object) this; - - return Identifiers.getOrFallback(Registry.RECIPE_SERIALIZER, shapedRecipeSerializer, registryName); - } - - public Class getRegistryType() { - return RecipeSerializer.class; - } -} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapelessRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapelessRecipeSerializer.java deleted file mode 100644 index c6fa4683..00000000 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinShapelessRecipeSerializer.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Minecraft Forge, Patchwork Project - * Copyright (c) 2016-2020, 2019-2020 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package com.patchworkmc.mixin.registries; - -import net.minecraftforge.registries.IForgeRegistryEntry; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; - -import net.minecraft.recipe.RecipeSerializer; -import net.minecraft.recipe.ShapelessRecipe; -import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; - -import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; -import com.patchworkmc.impl.registries.Identifiers; - -@Mixin(ShapelessRecipe.Serializer.class) -public class MixinShapelessRecipeSerializer implements ExtendedForgeRegistryEntry { - @Unique - private Identifier registryName; - - @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { - this.registryName = name; - - return this; - } - - public Identifier getRegistryName() { - ShapelessRecipe.Serializer shapelessRecipeSerializer = (ShapelessRecipe.Serializer) (Object) this; - - return Identifiers.getOrFallback(Registry.RECIPE_SERIALIZER, shapelessRecipeSerializer, registryName); - } - - public Class getRegistryType() { - return RecipeSerializer.class; - } -} diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSpecialRecipeSerializer.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSpecialRecipeSerializer.java deleted file mode 100644 index ce0e9c97..00000000 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSpecialRecipeSerializer.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Minecraft Forge, Patchwork Project - * Copyright (c) 2016-2020, 2019-2020 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package com.patchworkmc.mixin.registries; - -import net.minecraftforge.registries.IForgeRegistryEntry; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; - -import net.minecraft.recipe.RecipeSerializer; -import net.minecraft.recipe.SpecialRecipeSerializer; -import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; - -import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry; -import com.patchworkmc.impl.registries.Identifiers; - -@Mixin(SpecialRecipeSerializer.class) -public class MixinSpecialRecipeSerializer implements ExtendedForgeRegistryEntry { - @Unique - private Identifier registryName; - - @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { - this.registryName = name; - - return this; - } - - public Identifier getRegistryName() { - SpecialRecipeSerializer specialRecipeSerializer = (SpecialRecipeSerializer) (Object) this; - - return Identifiers.getOrFallback(Registry.RECIPE_SERIALIZER, specialRecipeSerializer, registryName); - } - - public Class getRegistryType() { - return RecipeSerializer.class; - } -} diff --git a/patchwork-registries/src/main/resources/patchwork-registries.mixins.json b/patchwork-registries/src/main/resources/patchwork-registries.mixins.json index d05d7922..06dd84ce 100644 --- a/patchwork-registries/src/main/resources/patchwork-registries.mixins.json +++ b/patchwork-registries/src/main/resources/patchwork-registries.mixins.json @@ -12,8 +12,6 @@ "MixinChunkGeneratorType", "MixinChunkStatus", "MixinContainerType", - "MixinCookingRecipeSerializer", - "MixinCuttingRecipeSerializer", "MixinDecorator", "MixinEnchantment", "MixinEntityType", @@ -26,12 +24,10 @@ "MixinPointOfInterestType", "MixinPotion", "MixinRecipeSerializer", + "MixinRecipeSerializerSubclass", "MixinSchedule", "MixinSensorType", - "MixinShapedRecipeSerializer", - "MixinShapelessRecipeSerializer", "MixinSoundEvent", - "MixinSpecialRecipeSerializer", "MixinStatType", "MixinStatusEffect", "MixinSurfaceBuilder", From 6a30418e34437e53d877e759e7c047ab6e2e2172 Mon Sep 17 00:00:00 2001 From: Florens Pauwels Date: Sun, 26 Jan 2020 04:12:08 +0100 Subject: [PATCH 7/9] review --- .../minecraftforge/fml/client/registry/RenderingRegistry.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/patchwork-registries/src/main/java/net/minecraftforge/fml/client/registry/RenderingRegistry.java b/patchwork-registries/src/main/java/net/minecraftforge/fml/client/registry/RenderingRegistry.java index 1a76752d..a4c0b90f 100644 --- a/patchwork-registries/src/main/java/net/minecraftforge/fml/client/registry/RenderingRegistry.java +++ b/patchwork-registries/src/main/java/net/minecraftforge/fml/client/registry/RenderingRegistry.java @@ -19,7 +19,6 @@ package net.minecraftforge.fml.client.registry; -import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.entity.Entity; import net.fabricmc.fabric.api.client.render.EntityRendererRegistry; @@ -34,7 +33,4 @@ public class RenderingRegistry { public static void registerEntityRenderingHandler(Class entityClass, IRenderFactory renderFactory) { EntityRendererRegistry.INSTANCE.register(entityClass, (dispatcher, context) -> renderFactory.createRenderFor(dispatcher)); } - - // This is here just in case a mod calls it, entity renderers are loaded by the Fabric API - public static void loadEntityRenderers(EntityRenderDispatcher manager) { } } From 9e611f427aedfe236699558c7bf7bf953156f3d0 Mon Sep 17 00:00:00 2001 From: Florens Pauwels Date: Sun, 26 Jan 2020 04:15:50 +0100 Subject: [PATCH 8/9] IDEA messed up the indents (I swear it wasn't me) --- .../MixinRecipeSerializerSubclass.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinRecipeSerializerSubclass.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinRecipeSerializerSubclass.java index 6bbf5e33..26c7e4ef 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinRecipeSerializerSubclass.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinRecipeSerializerSubclass.java @@ -18,23 +18,23 @@ @Mixin({ShapedRecipe.Serializer.class, ShapelessRecipe.Serializer.class, CookingRecipeSerializer.class, CuttingRecipe.Serializer.class, SpecialRecipeSerializer.class}) public class MixinRecipeSerializerSubclass implements ExtendedForgeRegistryEntry { - @Unique - private Identifier registryName; + @Unique + private Identifier registryName; - @Override - public IForgeRegistryEntry setRegistryName(Identifier name) { - this.registryName = name; + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; - return this; - } + return this; + } - public Identifier getRegistryName() { - RecipeSerializer recipeSerializer = (RecipeSerializer) this; + public Identifier getRegistryName() { + RecipeSerializer recipeSerializer = (RecipeSerializer) this; - return Identifiers.getOrFallback(Registry.RECIPE_SERIALIZER, recipeSerializer, registryName); - } + return Identifiers.getOrFallback(Registry.RECIPE_SERIALIZER, recipeSerializer, registryName); + } - public Class getRegistryType() { - return RecipeSerializer.class; - } + public Class getRegistryType() { + return RecipeSerializer.class; + } } From 87d5da6724a60c73ea0e844c62a4fb4735de647e Mon Sep 17 00:00:00 2001 From: Florens Pauwels Date: Sun, 26 Jan 2020 04:20:23 +0100 Subject: [PATCH 9/9] License --- .../MixinRecipeSerializerSubclass.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinRecipeSerializerSubclass.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinRecipeSerializerSubclass.java index 26c7e4ef..4b1680d6 100644 --- a/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinRecipeSerializerSubclass.java +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinRecipeSerializerSubclass.java @@ -1,3 +1,22 @@ +/* + * Minecraft Forge, Patchwork Project + * Copyright (c) 2016-2020, 2019-2020 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + package com.patchworkmc.mixin.registries; import net.minecraftforge.registries.IForgeRegistryEntry;