Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit ae3b817

Browse files
authored
Merge pull request #36 from florensie/moar-registries
Moar registries, also do RenderingRegistry
2 parents fcfff13 + 87d5da6 commit ae3b817

31 files changed

+1368
-5
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Minecraft Forge, Patchwork Project
3+
* Copyright (c) 2016-2020, 2019-2020
4+
*
5+
* This library is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU Lesser General Public
7+
* License as published by the Free Software Foundation version 2.1
8+
* of the License.
9+
*
10+
* This library is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
* Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public
16+
* License along with this library; if not, write to the Free Software
17+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
package com.patchworkmc.mixin.registries;
21+
22+
import net.minecraftforge.registries.IForgeRegistryEntry;
23+
import org.spongepowered.asm.mixin.Mixin;
24+
import org.spongepowered.asm.mixin.Unique;
25+
26+
import net.minecraft.entity.ai.brain.Activity;
27+
import net.minecraft.util.Identifier;
28+
import net.minecraft.util.registry.Registry;
29+
30+
import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry;
31+
import com.patchworkmc.impl.registries.Identifiers;
32+
33+
@Mixin(Activity.class)
34+
public class MixinActivity implements ExtendedForgeRegistryEntry<Activity> {
35+
@Unique
36+
private Identifier registryName;
37+
38+
@Override
39+
public IForgeRegistryEntry<Activity> setRegistryName(Identifier name) {
40+
this.registryName = name;
41+
42+
return this;
43+
}
44+
45+
public Identifier getRegistryName() {
46+
Activity activity = (Activity) (Object) this;
47+
48+
return Identifiers.getOrFallback(Registry.ACTIVITY, activity, registryName);
49+
}
50+
51+
public Class<Activity> getRegistryType() {
52+
return Activity.class;
53+
}
54+
}

patchwork-registries/src/main/java/com/patchworkmc/mixin/registries/MixinBiome.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class MixinBiome implements ExtendedForgeRegistryEntry<Biome> {
3636
private Identifier registryName;
3737

3838
@Override
39-
public IForgeRegistryEntry setRegistryName(Identifier name) {
39+
public IForgeRegistryEntry<Biome> setRegistryName(Identifier name) {
4040
this.registryName = name;
4141

4242
return this;
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Minecraft Forge, Patchwork Project
3+
* Copyright (c) 2016-2020, 2019-2020
4+
*
5+
* This library is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU Lesser General Public
7+
* License as published by the Free Software Foundation version 2.1
8+
* of the License.
9+
*
10+
* This library is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
* Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public
16+
* License along with this library; if not, write to the Free Software
17+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
package com.patchworkmc.mixin.registries;
21+
22+
import net.minecraftforge.registries.IForgeRegistryEntry;
23+
import org.spongepowered.asm.mixin.Mixin;
24+
import org.spongepowered.asm.mixin.Unique;
25+
26+
import net.minecraft.world.biome.source.BiomeSourceType;
27+
import net.minecraft.util.Identifier;
28+
import net.minecraft.util.registry.Registry;
29+
30+
import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry;
31+
import com.patchworkmc.impl.registries.Identifiers;
32+
33+
@Mixin(BiomeSourceType.class)
34+
public class MixinBiomeSourceType implements ExtendedForgeRegistryEntry<BiomeSourceType> {
35+
@Unique
36+
private Identifier registryName;
37+
38+
@Override
39+
public IForgeRegistryEntry<BiomeSourceType> setRegistryName(Identifier name) {
40+
this.registryName = name;
41+
42+
return this;
43+
}
44+
45+
public Identifier getRegistryName() {
46+
BiomeSourceType<?, ?> biomeSourceType = (BiomeSourceType<?, ?>) (Object) this;
47+
48+
return Identifiers.getOrFallback(Registry.BIOME_SOURCE_TYPE, biomeSourceType, registryName);
49+
}
50+
51+
public Class<BiomeSourceType> getRegistryType() {
52+
return BiomeSourceType.class;
53+
}
54+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Minecraft Forge, Patchwork Project
3+
* Copyright (c) 2016-2020, 2019-2020
4+
*
5+
* This library is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU Lesser General Public
7+
* License as published by the Free Software Foundation version 2.1
8+
* of the License.
9+
*
10+
* This library is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
* Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public
16+
* License along with this library; if not, write to the Free Software
17+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
package com.patchworkmc.mixin.registries;
21+
22+
import net.minecraftforge.registries.IForgeRegistryEntry;
23+
import org.spongepowered.asm.mixin.Mixin;
24+
import org.spongepowered.asm.mixin.Unique;
25+
26+
import net.minecraft.block.entity.BlockEntityType;
27+
import net.minecraft.util.Identifier;
28+
import net.minecraft.util.registry.Registry;
29+
30+
import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry;
31+
import com.patchworkmc.impl.registries.Identifiers;
32+
33+
@Mixin(BlockEntityType.class)
34+
public class MixinBlockEntityType implements ExtendedForgeRegistryEntry<BlockEntityType> {
35+
@Unique
36+
private Identifier registryName;
37+
38+
@Override
39+
public IForgeRegistryEntry<BlockEntityType> setRegistryName(Identifier name) {
40+
this.registryName = name;
41+
42+
return this;
43+
}
44+
45+
public Identifier getRegistryName() {
46+
BlockEntityType<?> blockEntityType = (BlockEntityType<?>) (Object) this;
47+
48+
return Identifiers.getOrFallback(Registry.BLOCK_ENTITY, blockEntityType, registryName);
49+
}
50+
51+
public Class<BlockEntityType> getRegistryType() {
52+
return BlockEntityType.class;
53+
}
54+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Minecraft Forge, Patchwork Project
3+
* Copyright (c) 2016-2020, 2019-2020
4+
*
5+
* This library is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU Lesser General Public
7+
* License as published by the Free Software Foundation version 2.1
8+
* of the License.
9+
*
10+
* This library is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
* Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public
16+
* License along with this library; if not, write to the Free Software
17+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
package com.patchworkmc.mixin.registries;
21+
22+
import net.minecraftforge.registries.IForgeRegistryEntry;
23+
import org.spongepowered.asm.mixin.Mixin;
24+
import org.spongepowered.asm.mixin.Unique;
25+
26+
import net.minecraft.world.gen.carver.Carver;
27+
import net.minecraft.util.Identifier;
28+
import net.minecraft.util.registry.Registry;
29+
30+
import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry;
31+
import com.patchworkmc.impl.registries.Identifiers;
32+
33+
@Mixin(Carver.class)
34+
public class MixinCarver implements ExtendedForgeRegistryEntry<Carver> {
35+
@Unique
36+
private Identifier registryName;
37+
38+
@Override
39+
public IForgeRegistryEntry<Carver> setRegistryName(Identifier name) {
40+
this.registryName = name;
41+
42+
return this;
43+
}
44+
45+
public Identifier getRegistryName() {
46+
Carver<?> carver = (Carver<?>) (Object) this;
47+
48+
return Identifiers.getOrFallback(Registry.CARVER, carver, registryName);
49+
}
50+
51+
public Class<Carver> getRegistryType() {
52+
return Carver.class;
53+
}
54+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Minecraft Forge, Patchwork Project
3+
* Copyright (c) 2016-2020, 2019-2020
4+
*
5+
* This library is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU Lesser General Public
7+
* License as published by the Free Software Foundation version 2.1
8+
* of the License.
9+
*
10+
* This library is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
* Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public
16+
* License along with this library; if not, write to the Free Software
17+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
package com.patchworkmc.mixin.registries;
21+
22+
import net.minecraftforge.registries.IForgeRegistryEntry;
23+
import org.spongepowered.asm.mixin.Mixin;
24+
import org.spongepowered.asm.mixin.Unique;
25+
26+
import net.minecraft.world.gen.chunk.ChunkGeneratorType;
27+
import net.minecraft.util.Identifier;
28+
import net.minecraft.util.registry.Registry;
29+
30+
import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry;
31+
import com.patchworkmc.impl.registries.Identifiers;
32+
33+
@Mixin(ChunkGeneratorType.class)
34+
public class MixinChunkGeneratorType implements ExtendedForgeRegistryEntry<ChunkGeneratorType> {
35+
@Unique
36+
private Identifier registryName;
37+
38+
@Override
39+
public IForgeRegistryEntry<ChunkGeneratorType> setRegistryName(Identifier name) {
40+
this.registryName = name;
41+
42+
return this;
43+
}
44+
45+
public Identifier getRegistryName() {
46+
ChunkGeneratorType<?, ?> chunkGeneratorType = (ChunkGeneratorType<?, ?>) (Object) this;
47+
48+
return Identifiers.getOrFallback(Registry.CHUNK_GENERATOR_TYPE, chunkGeneratorType, registryName);
49+
}
50+
51+
public Class<ChunkGeneratorType> getRegistryType() {
52+
return ChunkGeneratorType.class;
53+
}
54+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Minecraft Forge, Patchwork Project
3+
* Copyright (c) 2016-2020, 2019-2020
4+
*
5+
* This library is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU Lesser General Public
7+
* License as published by the Free Software Foundation version 2.1
8+
* of the License.
9+
*
10+
* This library is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
* Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public
16+
* License along with this library; if not, write to the Free Software
17+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
package com.patchworkmc.mixin.registries;
21+
22+
import net.minecraftforge.registries.IForgeRegistryEntry;
23+
import org.spongepowered.asm.mixin.Mixin;
24+
import org.spongepowered.asm.mixin.Unique;
25+
26+
import net.minecraft.world.chunk.ChunkStatus;
27+
import net.minecraft.util.Identifier;
28+
import net.minecraft.util.registry.Registry;
29+
30+
import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry;
31+
import com.patchworkmc.impl.registries.Identifiers;
32+
33+
@Mixin(ChunkStatus.class)
34+
public class MixinChunkStatus implements ExtendedForgeRegistryEntry<ChunkStatus> {
35+
@Unique
36+
private Identifier registryName;
37+
38+
@Override
39+
public IForgeRegistryEntry<ChunkStatus> setRegistryName(Identifier name) {
40+
this.registryName = name;
41+
42+
return this;
43+
}
44+
45+
public Identifier getRegistryName() {
46+
ChunkStatus chunkStatus = (ChunkStatus) (Object) this;
47+
48+
return Identifiers.getOrFallback(Registry.CHUNK_STATUS, chunkStatus, registryName);
49+
}
50+
51+
public Class<ChunkStatus> getRegistryType() {
52+
return ChunkStatus.class;
53+
}
54+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Minecraft Forge, Patchwork Project
3+
* Copyright (c) 2016-2020, 2019-2020
4+
*
5+
* This library is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU Lesser General Public
7+
* License as published by the Free Software Foundation version 2.1
8+
* of the License.
9+
*
10+
* This library is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
* Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public
16+
* License along with this library; if not, write to the Free Software
17+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
package com.patchworkmc.mixin.registries;
21+
22+
import net.minecraftforge.registries.IForgeRegistryEntry;
23+
import org.spongepowered.asm.mixin.Mixin;
24+
import org.spongepowered.asm.mixin.Unique;
25+
26+
import net.minecraft.container.ContainerType;
27+
import net.minecraft.util.Identifier;
28+
import net.minecraft.util.registry.Registry;
29+
30+
import com.patchworkmc.impl.registries.ExtendedForgeRegistryEntry;
31+
import com.patchworkmc.impl.registries.Identifiers;
32+
33+
@Mixin(ContainerType.class)
34+
public class MixinContainerType implements ExtendedForgeRegistryEntry<ContainerType> {
35+
@Unique
36+
private Identifier registryName;
37+
38+
@Override
39+
public IForgeRegistryEntry<ContainerType> setRegistryName(Identifier name) {
40+
this.registryName = name;
41+
42+
return this;
43+
}
44+
45+
public Identifier getRegistryName() {
46+
ContainerType<?> containerType = (ContainerType<?>) (Object) this;
47+
48+
return Identifiers.getOrFallback(Registry.CONTAINER, containerType, registryName);
49+
}
50+
51+
public Class<ContainerType> getRegistryType() {
52+
return ContainerType.class;
53+
}
54+
}

0 commit comments

Comments
 (0)