-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'architectury-1.19.4' into architectury-1.20
# Conflicts: # common/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/PFMImmersivePortals.java
- Loading branch information
Showing
20 changed files
with
978 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ out/ | |
.gradle/ | ||
output/ | ||
bin/ | ||
libs/ | ||
|
||
.classpath | ||
.project | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 5 additions & 38 deletions
43
common/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/PFMImmersivePortals.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,11 @@ | ||
package com.unlikepaladin.pfm.compat.imm_ptl; | ||
|
||
import com.unlikepaladin.pfm.compat.PFMClientModCompatibility; | ||
import com.unlikepaladin.pfm.compat.PFMModCompatibility; | ||
import com.unlikepaladin.pfm.compat.imm_ptl.client.PFMImmersivePortalsClient; | ||
import com.unlikepaladin.pfm.compat.imm_ptl.entity.PFMMirrorEntity; | ||
import com.unlikepaladin.pfm.registry.EntityRegistry; | ||
import com.unlikepaladin.pfm.registry.PaladinFurnitureModBlocksItems; | ||
import net.minecraft.block.AbstractBlock; | ||
import net.minecraft.block.MapColor; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.SpawnGroup; | ||
import dev.architectury.injectables.annotations.ExpectPlatform; | ||
|
||
import java.util.Optional; | ||
|
||
public class PFMImmersivePortals implements PFMModCompatibility { | ||
private PFMClientModCompatibility clientModCompatibility; | ||
public PFMImmersivePortals(){ | ||
} | ||
public static final EntityType<PFMMirrorEntity> MIRROR = EntityType.Builder.create(PFMMirrorEntity::new, SpawnGroup.MISC).setDimensions(0.0F, 0.0F).makeFireImmune().disableSummon().build("mirror_entity"); | ||
|
||
@Override | ||
public void registerEntityTypes() { | ||
EntityRegistry.registerEntityType("mirror_entity", MIRROR); | ||
} | ||
|
||
@Override | ||
public void createBlocks() { | ||
PaladinFurnitureModBlocksItems.WHITE_MIRROR = new PFMMirrorBlockIP(AbstractBlock.Settings.create().mapColor(MapColor.WHITE).nonOpaque()); | ||
PaladinFurnitureModBlocksItems.GRAY_MIRROR = new PFMMirrorBlockIP(AbstractBlock.Settings.create().mapColor(MapColor.GRAY).nonOpaque()); | ||
} | ||
|
||
@Override | ||
public String getModId() { | ||
return "immersive_portals"; | ||
} | ||
|
||
@Override | ||
public Optional<PFMClientModCompatibility> getClientModCompatiblity() { | ||
if (clientModCompatibility == null) | ||
clientModCompatibility = new PFMImmersivePortalsClient(this); | ||
return Optional.of(clientModCompatibility); | ||
public class PFMImmersivePortals { | ||
@ExpectPlatform | ||
public static PFMModCompatibility getInstance() { | ||
throw new AssertionError(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...ic/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/fabric/PFMImmersivePortalsImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.unlikepaladin.pfm.compat.imm_ptl.fabric; | ||
|
||
import com.unlikepaladin.pfm.compat.PFMClientModCompatibility; | ||
import com.unlikepaladin.pfm.compat.PFMModCompatibility; | ||
import com.unlikepaladin.pfm.compat.imm_ptl.fabric.client.PFMImmersivePortalsClient; | ||
import com.unlikepaladin.pfm.compat.imm_ptl.fabric.entity.PFMMirrorEntity; | ||
import com.unlikepaladin.pfm.registry.EntityRegistry; | ||
import com.unlikepaladin.pfm.registry.PaladinFurnitureModBlocksItems; | ||
import net.minecraft.block.AbstractBlock; | ||
import net.minecraft.block.MapColor; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.SpawnGroup; | ||
|
||
import java.util.Optional; | ||
|
||
public class PFMImmersivePortalsImpl implements PFMModCompatibility { | ||
private PFMClientModCompatibility clientModCompatibility; | ||
public static final EntityType<PFMMirrorEntity> MIRROR = EntityType.Builder.create(PFMMirrorEntity::new, SpawnGroup.MISC).setDimensions(0.0F, 0.0F).makeFireImmune().disableSummon().build("mirror_entity"); | ||
|
||
@Override | ||
public void registerEntityTypes() { | ||
EntityRegistry.registerEntityType("mirror_entity", MIRROR); | ||
} | ||
|
||
@Override | ||
public void createBlocks() { | ||
PaladinFurnitureModBlocksItems.WHITE_MIRROR = new PFMMirrorBlockIP(AbstractBlock.Settings.create().mapColor(MapColor.WHITE).nonOpaque()); | ||
PaladinFurnitureModBlocksItems.GRAY_MIRROR = new PFMMirrorBlockIP(AbstractBlock.Settings.create().mapColor(MapColor.GRAY).nonOpaque()); | ||
} | ||
|
||
@Override | ||
public String getModId() { | ||
return "immersive_portals"; | ||
} | ||
|
||
@Override | ||
public Optional<PFMClientModCompatibility> getClientModCompatiblity() { | ||
if (clientModCompatibility == null) | ||
clientModCompatibility = new PFMImmersivePortalsClient(this); | ||
return Optional.of(clientModCompatibility); | ||
} | ||
public static PFMModCompatibility getInstance() { | ||
return new PFMImmersivePortalsImpl(); | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
fabric/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/fabric/PFMMirrorBlockIP.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package com.unlikepaladin.pfm.compat.imm_ptl.fabric; | ||
|
||
import com.unlikepaladin.pfm.PaladinFurnitureMod; | ||
import com.unlikepaladin.pfm.blocks.MirrorBlock; | ||
import com.unlikepaladin.pfm.compat.imm_ptl.fabric.entity.PFMMirrorEntity; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.server.world.ServerWorld; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.Box; | ||
import net.minecraft.util.math.Direction; | ||
import net.minecraft.world.World; | ||
import net.minecraft.world.WorldAccess; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class PFMMirrorBlockIP extends MirrorBlock { | ||
protected PFMMirrorBlockIP(Settings settings) { | ||
super(settings); | ||
} | ||
|
||
@Override | ||
public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) { | ||
super.onPlaced(world, pos, state, placer, itemStack); | ||
if (PaladinFurnitureMod.getPFMConfig().doImmersivePortalsMirrorsSpawn()) { | ||
if (!world.isClient && world.getNonSpectatingEntities(PFMMirrorEntity.class, new Box(pos)).isEmpty()) { | ||
PFMMirrorEntity.createMirror((ServerWorld) world, pos, state.get(FACING).getOpposite()); | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { | ||
super.onBreak(world, pos, state, player); | ||
if (PaladinFurnitureMod.getPFMConfig().doImmersivePortalsMirrorsSpawn()) { | ||
List<PFMMirrorEntity> mirrorBlockEntities; | ||
if (!world.isClient && !(mirrorBlockEntities = world.getNonSpectatingEntities(PFMMirrorEntity.class, new Box(pos))).isEmpty()) { | ||
mirrorBlockEntities.forEach(pfmMirrorEntity -> { | ||
((PFMMirrorEntity)pfmMirrorEntity).remove(Entity.RemovalReason.KILLED); | ||
}); | ||
world.updateNeighbors(pos, state.getBlock()); | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { | ||
if (PaladinFurnitureMod.getPFMConfig().doImmersivePortalsMirrorsSpawn() && !world.isClient()) { | ||
List<PFMMirrorEntity> mirrorBlockEntities = new ArrayList<>(); | ||
if (canConnect(neighborState, state)) { | ||
mirrorBlockEntities.addAll(world.getNonSpectatingEntities(PFMMirrorEntity.class, new Box(neighborPos))); | ||
} | ||
if (!(world.getNonSpectatingEntities(PFMMirrorEntity.class, new Box(pos)).isEmpty())) { | ||
mirrorBlockEntities.addAll(world.getNonSpectatingEntities(PFMMirrorEntity.class, new Box(pos))); | ||
mirrorBlockEntities.forEach(pfmMirrorEntity -> { | ||
((Entity)pfmMirrorEntity).remove(Entity.RemovalReason.KILLED); | ||
}); | ||
} | ||
PFMMirrorEntity.createMirror((ServerWorld) world, pos, state.get(FACING).getOpposite()); | ||
world.updateNeighbors(pos, state.getBlock()); | ||
} | ||
return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...main/java/com/unlikepaladin/pfm/compat/imm_ptl/fabric/client/PFMMirrorEntityRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.unlikepaladin.pfm.compat.imm_ptl.fabric.client; | ||
|
||
import com.unlikepaladin.pfm.PaladinFurnitureMod; | ||
import net.minecraft.client.render.VertexConsumerProvider; | ||
import net.minecraft.client.render.entity.EntityRendererFactory; | ||
import net.minecraft.client.util.math.MatrixStack; | ||
import qouteall.imm_ptl.core.portal.Portal; | ||
import qouteall.imm_ptl.core.render.PortalEntityRenderer; | ||
|
||
public class PFMMirrorEntityRenderer extends PortalEntityRenderer { | ||
public PFMMirrorEntityRenderer(EntityRendererFactory.Context context) { | ||
super(context); | ||
} | ||
|
||
@Override | ||
public void render(Portal portal, float yaw, float tickDelta, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light) { | ||
if (PaladinFurnitureMod.getPFMConfig().doImmersivePortalsMirrorsRender()) | ||
super.render(portal, yaw, tickDelta, matrixStack, vertexConsumerProvider, light); | ||
} | ||
} |
Oops, something went wrong.