11<#--
22 # MCreator (https://mcreator.net/)
33 # Copyright (C) 2012-2020, Pylo
4- # Copyright (C) 2020-2024 , Pylo, opensource contributors
4+ # Copyright (C) 2020-2025 , Pylo, opensource contributors
55 #
66 # This program is free software: you can redistribute it and/or modify
77 # it under the terms of the GNU General Public License as published by
3333package ${package} .world.teleporter;
3434
3535@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public class ${name} Teleporter implements ITeleporter {
36- public static final TicketType<BlockPos > CUSTOM_PORTAL = TicketType.create("${registryname} _portal", Vec3i::compareTo, 300);
36+ private static final TicketType<BlockPos > CUSTOM_PORTAL = TicketType.create("${registryname} _portal", Vec3i::compareTo, 300);
3737 private static PointOfInterestType poi = null;
3838 private Vec3d lastPortalVec;
3939 private Direction teleportDirection;
@@ -48,31 +48,25 @@ package ${package}.world.teleporter;
4848 this.teleportDirection = teleportDirection;
4949 }
5050
51- @SubscribeEvent public void registerPointOfInterest(RegistryEvent.Register<PointOfInterestType > event) {
52- try {
53- Method method = ObfuscationReflectionHelper.findMethod(PointOfInterestType.class, "func_226359_a_", String.class, Set.class, int.class, int.class);
54- method.setAccessible(true);
55- poi = (PointOfInterestType) method.invoke(null, "${registryname} _portal", Sets.newHashSet(ImmutableSet.copyOf(portal.getStateContainer().getValidStates())), 0, 1);
56- event.getRegistry().register(poi);
57- } catch (Exception e) {
58- e.printStackTrace();
59- }
60- }
51+ @SubscribeEvent public static void registerPointOfInterest(RegistryEvent.Register<PointOfInterestType > event) {
52+ poi = new PointOfInterestType("${registryname} _portal", Sets.newHashSet(ImmutableSet.copyOf(${JavaModName} Blocks.${registryname?upper_case } _PORTAL.get().getStateContainer().getValidStates())), 0, 1).setRegistryName("${registryname} _portal");
53+ ForgeRegistries.POI_TYPES.register(poi);
54+ }
6155
6256 ${mcc.getMethod("net.minecraft.world.Teleporter", "placeInExistingPortal", "BlockPos", "Vec3d", "Direction", "double", "double", "boolean")
63- .replace("NetherPortalBlock.createPatternHelper", name + mappedBlockToBlockStateCode(data.portalFrame) + ".getBlock()." + createPatternHelper")
64- .replace("PointOfInterestType.NETHER_PORTAL", "poi")
65- .replace("TicketType.PORTAL", "CUSTOM_PORTAL")
66- .replace("Blocks.NETHER_PORTAL", JavaModName + "Blocks." + registryname?upper_case + "_PORTAL.get()")}
57+ .replace("NetherPortalBlock.createPatternHelper", name + "PortalBlock. createPatternHelper")
58+ .replace("PointOfInterestType.NETHER_PORTAL", "poi")
59+ .replace("TicketType.PORTAL", "CUSTOM_PORTAL")
60+ .replace("Blocks.NETHER_PORTAL", JavaModName + "Blocks." + registryname?upper_case + "_PORTAL.get()")}
6761
6862 ${mcc.getMethod("net.minecraft.world.Teleporter", "placeInPortal", "Entity", "float")
69- .replace("p_222268_1_.getTeleportDirection()", "teleportDirection")
70- .replace("p_222268_1_.getLastPortalVec()", "lastPortalVec")}
63+ .replace("p_222268_1_.getTeleportDirection()", "teleportDirection")
64+ .replace("p_222268_1_.getLastPortalVec()", "lastPortalVec")}
7165
7266 ${mcc.getMethod("net.minecraft.world.Teleporter", "makePortal", "Entity")
73- .replace("Blocks.OBSIDIAN", mappedBlockToBlock(data.portalFrame)?string)
74- .replace(",blockstate,18);", ",blockstate,18);\nthis.world.getPointOfInterestManager().add(blockpos$mutable, poi);")
75- .replace("Blocks.NETHER_PORTAL", JavaModName + "Blocks." + registryname?upper_case + "_PORTAL.get()")}
67+ .replace("Blocks.OBSIDIAN", mappedBlockToBlock(data.portalFrame)?string)
68+ .replace(",blockstate,18);", ",blockstate,18);\nthis.world.getPointOfInterestManager().add(blockpos$mutable, poi);")
69+ .replace("Blocks.NETHER_PORTAL", JavaModName + "Blocks." + registryname?upper_case + "_PORTAL.get()")}
7670
7771 @Override public Entity placeEntity(Entity entity, ServerWorld serverworld, ServerWorld serverworld1, float yaw, Function<Boolean , Entity > repositionEntity) {
7872 double d0 = entity.getPosX();
0 commit comments