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..bfe26c4f --- /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; +import com.patchworkmc.impl.registries.Identifiers; + +@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() { + Activity activity = (Activity) (Object) this; + + return Identifiers.getOrFallback(Registry.ACTIVITY, activity, registryName); + } + + public Class getRegistryType() { + return Activity.class; + } +} 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 new file mode 100644 index 00000000..08fe59e4 --- /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; +import com.patchworkmc.impl.registries.Identifiers; + +@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() { + BiomeSourceType biomeSourceType = (BiomeSourceType) (Object) this; + + return Identifiers.getOrFallback(Registry.BIOME_SOURCE_TYPE, biomeSourceType, registryName); + } + + 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..b42af8a3 --- /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; +import com.patchworkmc.impl.registries.Identifiers; + +@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() { + BlockEntityType blockEntityType = (BlockEntityType) (Object) this; + + return Identifiers.getOrFallback(Registry.BLOCK_ENTITY, blockEntityType, registryName); + } + + 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..80adf7f6 --- /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; +import com.patchworkmc.impl.registries.Identifiers; + +@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() { + Carver carver = (Carver) (Object) this; + + return Identifiers.getOrFallback(Registry.CARVER, carver, registryName); + } + + 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..0f67090a --- /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; +import com.patchworkmc.impl.registries.Identifiers; + +@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() { + ChunkGeneratorType chunkGeneratorType = (ChunkGeneratorType) (Object) this; + + return Identifiers.getOrFallback(Registry.CHUNK_GENERATOR_TYPE, chunkGeneratorType, registryName); + } + + 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..23df3c47 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinChunkStatus.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.chunk.ChunkStatus; +import net.minecraft.util.Identifier; +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 { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + ChunkStatus chunkStatus = (ChunkStatus) (Object) this; + + return Identifiers.getOrFallback(Registry.CHUNK_STATUS, chunkStatus, registryName); + } + + 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..41b82381 --- /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; +import com.patchworkmc.impl.registries.Identifiers; + +@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() { + ContainerType containerType = (ContainerType) (Object) this; + + return Identifiers.getOrFallback(Registry.CONTAINER, containerType, registryName); + } + + public Class getRegistryType() { + return ContainerType.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..8ff166c7 --- /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; +import com.patchworkmc.impl.registries.Identifiers; + +@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() { + Decorator decorator = (Decorator) (Object) this; + + return Identifiers.getOrFallback(Registry.DECORATOR, decorator, registryName); + } + + 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..4d74a997 --- /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; +import com.patchworkmc.impl.registries.Identifiers; + +@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() { + Enchantment enchantment = (Enchantment) (Object) this; + + return Identifiers.getOrFallback(Registry.ENCHANTMENT, enchantment, registryName); + } + + 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..d76b37e8 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinEntityType.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.EntityType; +import net.minecraft.util.Identifier; +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 { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + EntityType entityType = (EntityType) (Object) this; + + return Identifiers.getOrFallback(Registry.ENTITY_TYPE, entityType, registryName); + } + + public Class getRegistryType() { + return EntityType.class; + } +} 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 new file mode 100644 index 00000000..8d15e643 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinFluid.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.fluid.Fluid; +import net.minecraft.util.Identifier; +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 { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Fluid fluid = (Fluid) (Object) this; + + return Identifiers.getOrFallback(Registry.FLUID, fluid, registryName); + } + + public Class getRegistryType() { + return Fluid.class; + } +} 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 new file mode 100644 index 00000000..81d35850 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinMemoryModuleType.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.MemoryModuleType; +import net.minecraft.util.Identifier; +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 { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + MemoryModuleType memoryModuleType = (MemoryModuleType) (Object) this; + + return Identifiers.getOrFallback(Registry.MEMORY_MODULE_TYPE, memoryModuleType, registryName); + } + + 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..35c693c3 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPaintingMotive.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.decoration.painting.PaintingMotive; +import net.minecraft.util.Identifier; +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 { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + PaintingMotive paintingMotive = (PaintingMotive) (Object) this; + + return Identifiers.getOrFallback(Registry.MOTIVE, paintingMotive, registryName); + } + + 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..8138d081 --- /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; +import com.patchworkmc.impl.registries.Identifiers; + +@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() { + ParticleType particleType = (ParticleType) (Object) this; + + return Identifiers.getOrFallback(Registry.PARTICLE_TYPE, particleType, registryName); + } + + 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..65f8a484 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPointOfInterestType.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.village.PointOfInterestType; +import net.minecraft.util.Identifier; +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 { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + PointOfInterestType pointOfInterestType = (PointOfInterestType) (Object) this; + + return Identifiers.getOrFallback(Registry.POINT_OF_INTEREST_TYPE, pointOfInterestType, registryName); + } + + 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..56e1d881 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinPotion.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.potion.Potion; +import net.minecraft.util.Identifier; +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 { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + Potion potion = (Potion) (Object) this; + + return Identifiers.getOrFallback(Registry.POTION, potion, registryName); + } + + 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/MixinRecipeSerializerSubclass.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinRecipeSerializerSubclass.java new file mode 100644 index 00000000..4b1680d6 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinRecipeSerializerSubclass.java @@ -0,0 +1,59 @@ +/* + * 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.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/MixinSchedule.java b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSchedule.java new file mode 100644 index 00000000..23ea9810 --- /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; +import com.patchworkmc.impl.registries.Identifiers; + +@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() { + Schedule schedule = (Schedule) (Object) this; + + return Identifiers.getOrFallback(Registry.SCHEDULE, schedule, registryName); + } + + 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..9765da91 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinSensorType.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.sensor.SensorType; +import net.minecraft.util.Identifier; +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 { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + SensorType sensorType = (SensorType) (Object) this; + + return Identifiers.getOrFallback(Registry.SENSOR_TYPE, sensorType, registryName); + } + + public Class getRegistryType() { + return SensorType.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..7e9a3050 --- /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; +import com.patchworkmc.impl.registries.Identifiers; + +@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() { + SoundEvent soundEvent = (SoundEvent) (Object) this; + + return Identifiers.getOrFallback(Registry.SOUND_EVENT, soundEvent, registryName); + } + + public Class getRegistryType() { + return SoundEvent.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..b58bc40b --- /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; +import com.patchworkmc.impl.registries.Identifiers; + +@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() { + StatType statType = (StatType) (Object) this; + + return Identifiers.getOrFallback(Registry.STAT_TYPE, statType, registryName); + } + + 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..0793f264 --- /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; +import com.patchworkmc.impl.registries.Identifiers; + +@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() { + StatusEffect statusEffect = (StatusEffect) (Object) this; + + return Identifiers.getOrFallback(Registry.STATUS_EFFECT, statusEffect, registryName); + } + + public Class getRegistryType() { + return StatusEffect.class; + } +} 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 new file mode 100644 index 00000000..1fc9b724 --- /dev/null +++ b/patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinVillagerProfession.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.village.VillagerProfession; +import net.minecraft.util.Identifier; +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 { + @Unique + private Identifier registryName; + + @Override + public IForgeRegistryEntry setRegistryName(Identifier name) { + this.registryName = name; + + return this; + } + + public Identifier getRegistryName() { + VillagerProfession villagerProfession = (VillagerProfession) (Object) this; + + return Identifiers.getOrFallback(Registry.VILLAGER_PROFESSION, villagerProfession, registryName); + } + + public Class getRegistryType() { + return VillagerProfession.class; + } +} 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..a4c0b90f --- /dev/null +++ b/patchwork-registries/src/main/java/net/minecraftforge/fml/client/registry/RenderingRegistry.java @@ -0,0 +1,36 @@ +/* + * 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.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)); + } +} diff --git a/patchwork-registries/src/main/resources/patchwork-registries.mixins.json b/patchwork-registries/src/main/resources/patchwork-registries.mixins.json index 4953d8d7..06dd84ce 100644 --- a/patchwork-registries/src/main/resources/patchwork-registries.mixins.json +++ b/patchwork-registries/src/main/resources/patchwork-registries.mixins.json @@ -3,11 +3,35 @@ "package": "com.patchworkmc.mixin.registries", "compatibilityLevel": "JAVA_8", "mixins": [ + "MixinActivity", "MixinBiome", + "MixinBiomeSourceType", "MixinBlock", + "MixinBlockEntityType", + "MixinCarver", + "MixinChunkGeneratorType", + "MixinChunkStatus", + "MixinContainerType", + "MixinDecorator", + "MixinEnchantment", + "MixinEntityType", "MixinFeature", + "MixinFluid", "MixinItem", - "MixinSurfaceBuilder" + "MixinMemoryModuleType", + "MixinPaintingMotive", + "MixinParticleType", + "MixinPointOfInterestType", + "MixinPotion", + "MixinRecipeSerializer", + "MixinRecipeSerializerSubclass", + "MixinSchedule", + "MixinSensorType", + "MixinSoundEvent", + "MixinStatType", + "MixinStatusEffect", + "MixinSurfaceBuilder", + "MixinVillagerProfession" ], "injectors": { "defaultRequire": 1