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

Commit be8cf8f

Browse files
committed
Pretty much all of the Forge exposed registries
1 parent 087c16c commit be8cf8f

29 files changed

Lines changed: 1556 additions & 1 deletion
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+
32+
@Mixin(Activity.class)
33+
public class MixinActivity implements ExtendedForgeRegistryEntry<Activity> {
34+
@Unique
35+
private Identifier registryName;
36+
37+
@Override
38+
public IForgeRegistryEntry setRegistryName(Identifier name) {
39+
this.registryName = name;
40+
41+
return this;
42+
}
43+
44+
public Identifier getRegistryName() {
45+
Identifier current = Registry.ACTIVITY.getId((Activity) (Object) this);
46+
Identifier set = registryName;
47+
48+
return current != null ? current : set;
49+
}
50+
51+
public Class<Activity> getRegistryType() {
52+
return Activity.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.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+
32+
@Mixin(BiomeSourceType.class)
33+
public class MixinBiomeSourceType implements ExtendedForgeRegistryEntry<BiomeSourceType> {
34+
@Unique
35+
private Identifier registryName;
36+
37+
@Override
38+
public IForgeRegistryEntry setRegistryName(Identifier name) {
39+
this.registryName = name;
40+
41+
return this;
42+
}
43+
44+
public Identifier getRegistryName() {
45+
Identifier current = Registry.BIOME_SOURCE_TYPE.getId((BiomeSourceType) (Object) this);
46+
Identifier set = registryName;
47+
48+
return current != null ? current : set;
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+
32+
@Mixin(BlockEntityType.class)
33+
public class MixinBlockEntityType implements ExtendedForgeRegistryEntry<BlockEntityType> {
34+
@Unique
35+
private Identifier registryName;
36+
37+
@Override
38+
public IForgeRegistryEntry setRegistryName(Identifier name) {
39+
this.registryName = name;
40+
41+
return this;
42+
}
43+
44+
public Identifier getRegistryName() {
45+
Identifier current = Registry.BLOCK_ENTITY.getId((BlockEntityType) (Object) this);
46+
Identifier set = registryName;
47+
48+
return current != null ? current : set;
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+
32+
@Mixin(Carver.class)
33+
public class MixinCarver implements ExtendedForgeRegistryEntry<Carver> {
34+
@Unique
35+
private Identifier registryName;
36+
37+
@Override
38+
public IForgeRegistryEntry setRegistryName(Identifier name) {
39+
this.registryName = name;
40+
41+
return this;
42+
}
43+
44+
public Identifier getRegistryName() {
45+
Identifier current = Registry.CARVER.getId((Carver) (Object) this);
46+
Identifier set = registryName;
47+
48+
return current != null ? current : set;
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+
32+
@Mixin(ChunkGeneratorType.class)
33+
public class MixinChunkGeneratorType implements ExtendedForgeRegistryEntry<ChunkGeneratorType> {
34+
@Unique
35+
private Identifier registryName;
36+
37+
@Override
38+
public IForgeRegistryEntry setRegistryName(Identifier name) {
39+
this.registryName = name;
40+
41+
return this;
42+
}
43+
44+
public Identifier getRegistryName() {
45+
Identifier current = Registry.CHUNK_GENERATOR_TYPE.getId((ChunkGeneratorType) (Object) this);
46+
Identifier set = registryName;
47+
48+
return current != null ? current : set;
49+
}
50+
51+
public Class<ChunkGeneratorType> getRegistryType() {
52+
return ChunkGeneratorType.class;
53+
}
54+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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+
32+
@Mixin(ChunkStatus.class)
33+
public class MixinChunkStatus implements ExtendedForgeRegistryEntry<ChunkStatus> {
34+
@Unique
35+
private Identifier registryName;
36+
37+
@Override
38+
public IForgeRegistryEntry setRegistryName(Identifier name) {
39+
this.registryName = name;
40+
41+
return this;
42+
}
43+
44+
public Identifier getRegistryName() {
45+
Identifier current = Registry.CHUNK_STATUS.getId((ChunkStatus) (Object) this);
46+
Identifier set = registryName;
47+
48+
if (set == null) {
49+
set = Registry.CHUNK_STATUS.getDefaultId();
50+
}
51+
52+
return current != Registry.CHUNK_STATUS.getDefaultId() ? current : set;
53+
}
54+
55+
public Class<ChunkStatus> getRegistryType() {
56+
return ChunkStatus.class;
57+
}
58+
}
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+
32+
@Mixin(ContainerType.class)
33+
public class MixinContainerType implements ExtendedForgeRegistryEntry<ContainerType> {
34+
@Unique
35+
private Identifier registryName;
36+
37+
@Override
38+
public IForgeRegistryEntry setRegistryName(Identifier name) {
39+
this.registryName = name;
40+
41+
return this;
42+
}
43+
44+
public Identifier getRegistryName() {
45+
Identifier current = Registry.CONTAINER.getId((ContainerType) (Object) this);
46+
Identifier set = registryName;
47+
48+
return current != null ? current : set;
49+
}
50+
51+
public Class<ContainerType> getRegistryType() {
52+
return ContainerType.class;
53+
}
54+
}

0 commit comments

Comments
 (0)