Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
org.gradle.jvmargs=-Xmx4G

# Fabric Properties
minecraft_version=1.21.8
yarn_mappings=1.21.8+build.1
loader_version=0.16.14
minecraft_version=1.21.9
yarn_mappings=1.21.9+build.1
loader_version=0.17.2
loom_version=1.11-SNAPSHOT

# Fabric API
fabric_version=0.131.0+1.21.8
fabric_version=0.134.0+1.21.9

# Mod Properties
mod_version=0.0.1-beta68-1.21.8
mod_version=0.0.1-beta68-1.21.9
maven_group=net.kyrptonaught
archives_base_name=customportalapi
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void onInitialize() {
CustomPortalApiRegistry.registerPortalFrameTester(FLATPORTAL_FRAMETESTER, FlatPortalAreaHelper::new);
UseItemCallback.EVENT.register(((player, world, hand) -> {
ItemStack stack = player.getStackInHand(hand);
if (!world.isClient) {
if (!world.isClient()) {
Item item = stack.getItem();
if (PortalIgnitionSource.isRegisteredIgnitionSourceWith(item)) {
HitResult hit = player.raycast(6, 1, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
import net.minecraft.client.particle.ParticleFactory;
import net.minecraft.client.particle.PortalParticle;
import net.minecraft.client.particle.SpriteProvider;
import net.minecraft.client.texture.Sprite;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.particle.BlockStateParticleEffect;
import net.minecraft.util.math.random.Random;

public class CustomPortalParticle extends PortalParticle {
protected CustomPortalParticle(ClientWorld clientWorld, double d, double e, double f, double g, double h, double i) {
super(clientWorld, d, e, f, g, h, i);
protected CustomPortalParticle(ClientWorld clientWorld, double d, double e, double f, double g, double h, double i, Sprite sprite) {
super(clientWorld, d, e, f, g, h, i, sprite);
}

@Environment(EnvType.CLIENT)
Expand All @@ -26,10 +28,10 @@ public Factory(SpriteProvider spriteProvider) {
this.spriteProvider = spriteProvider;
}

public Particle createParticle(BlockStateParticleEffect blockStateParticleEffect, ClientWorld clientWorld, double d, double e, double f, double g, double h, double i) {
@Override
public Particle createParticle(BlockStateParticleEffect blockStateParticleEffect, ClientWorld clientWorld, double d, double e, double f, double g, double h, double i, Random random) {
// Particle portalParticle = (new PortalParticle.Factory(spriteProvider).createParticle(null,clientWorld,d,e,f,g,h,i));
CustomPortalParticle portalParticle = new CustomPortalParticle(clientWorld, d, e, f, g, h, i);
portalParticle.setSprite(this.spriteProvider);
CustomPortalParticle portalParticle = new CustomPortalParticle(clientWorld, d, e, f, g, h, i, this.spriteProvider.getSprite(random));
Block block = blockStateParticleEffect.getBlockState().getBlock();
PortalLink link = CustomPortalApiRegistry.getPortalLinkFromBase(block);
if (link != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private PortalLink isCustomPortal(ClientPlayerEntity player) {
BlockPos portalPos = portalManager != null && portalManager.isInPortal() ? ((PortalManagerAccessor) portalManager).getPos() : null;

if (portalBlock instanceof CustomPortalBlock)
return CustomPortalApiRegistry.getPortalLinkFromBase(((CustomPortalBlock) portalBlock).getPortalBase(player.clientWorld, portalPos));
return CustomPortalApiRegistry.getPortalLinkFromBase(((CustomPortalBlock) portalBlock).getPortalBase(player.getEntityWorld(), portalPos));

return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private void isCustomPortal(ClientPlayerEntity player) {
}

if (portalBlock instanceof CustomPortalBlock) {
PortalLink link = CustomPortalApiRegistry.getPortalLinkFromBase(((CustomPortalBlock) portalBlock).getPortalBase(player.clientWorld, portalPos));
PortalLink link = CustomPortalApiRegistry.getPortalLinkFromBase(((CustomPortalBlock) portalBlock).getPortalBase(player.getEntityWorld(), portalPos));
if (link != null) {
lastColor = link.colorID;
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ public PotionEntityMixin(EntityType<? extends ThrownItemEntity> entityType, Worl

@Inject(method = "extinguishFire", at = @At("HEAD"))
public void attemptPortalLight(BlockPos pos, CallbackInfo ci) {
PortalPlacer.attemptPortalLight(this.getWorld(), pos, PortalIgnitionSource.WATER);
PortalPlacer.attemptPortalLight(this.getEntityWorld(), pos, PortalIgnitionSource.WATER);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ public static RegistryKey<World> wrapRegistryKey(Identifier dimID) {
}

private static TeleportTarget customTPTarget(ServerWorld destinationWorld, Entity entity, BlockPos enteredPortalPos, Block frameBlock, PortalFrameTester.PortalFrameTesterFactory portalFrameTesterFactory) {
Direction.Axis portalAxis = CustomPortalHelper.getAxisFrom(entity.getWorld().getBlockState(enteredPortalPos));
BlockLocating.Rectangle fromPortalRectangle = portalFrameTesterFactory.createInstanceOfPortalFrameTester().init(entity.getWorld(), enteredPortalPos, portalAxis, frameBlock).getRectangle();
Direction.Axis portalAxis = CustomPortalHelper.getAxisFrom(entity.getEntityWorld().getBlockState(enteredPortalPos));
BlockLocating.Rectangle fromPortalRectangle = portalFrameTesterFactory.createInstanceOfPortalFrameTester().init(entity.getEntityWorld(), enteredPortalPos, portalAxis, frameBlock).getRectangle();

if (fromPortalRectangle.lowerLeft == null)
return null;

DimensionalBlockPos destinationPos = CustomPortalsMod.portalLinkingStorage.getDestination(fromPortalRectangle.lowerLeft, entity.getWorld().getRegistryKey());
DimensionalBlockPos destinationPos = CustomPortalsMod.portalLinkingStorage.getDestination(fromPortalRectangle.lowerLeft, entity.getEntityWorld().getRegistryKey());

if (destinationPos != null && destinationPos.dimensionType.equals(destinationWorld.getRegistryKey().getValue())) {
PortalFrameTester portalFrameTester = portalFrameTesterFactory.createInstanceOfPortalFrameTester().init(destinationWorld, destinationPos.pos, portalAxis, frameBlock);
Expand All @@ -74,13 +74,13 @@ public static TeleportTarget createDestinationPortal(ServerWorld destination, En
double zMin = Math.max(-2.9999872E7D, worldBorder.getBoundNorth() + 16.0D);
double xMax = Math.min(2.9999872E7D, worldBorder.getBoundEast() - 16.0D);
double zMax = Math.min(2.9999872E7D, worldBorder.getBoundSouth() - 16.0D);
double scaleFactor = DimensionType.getCoordinateScaleFactor(entity.getWorld().getDimension(), destination.getDimension());
double scaleFactor = DimensionType.getCoordinateScaleFactor(entity.getEntityWorld().getDimension(), destination.getDimension());
BlockPos blockPos3 = BlockPos.ofFloored(MathHelper.clamp(entity.getX() * scaleFactor, xMin, xMax), entity.getY(), MathHelper.clamp(entity.getZ() * scaleFactor, zMin, zMax));
Optional<BlockLocating.Rectangle> portal = PortalPlacer.createDestinationPortal(destination, blockPos3, frameBlock, axis);
if (portal.isPresent()) {
PortalFrameTester portalFrameTester = CustomPortalApiRegistry.getPortalLinkFromBase(frameBlock.getBlock()).getFrameTester().createInstanceOfPortalFrameTester();

CustomPortalsMod.portalLinkingStorage.createLink(portalFramePos.lowerLeft, entity.getWorld().getRegistryKey(), portal.get().lowerLeft, destination.getRegistryKey());
CustomPortalsMod.portalLinkingStorage.createLink(portalFramePos.lowerLeft, entity.getEntityWorld().getRegistryKey(), portal.get().lowerLeft, destination.getRegistryKey());
return portalFrameTester.getTPTargetInPortal(destination, frameBlock.getBlock(), portal.get(), axis, portalFrameTester.getEntityOffsetInPortal(portalFramePos, entity, axis), entity);
}
return idkWhereToPutYou(destination, entity, blockPos3);
Expand Down