Skip to content

Commit

Permalink
Merge branch 'architectury-1.18.2' into architectury-1.19.2
Browse files Browse the repository at this point in the history
  • Loading branch information
UnlikePaladin committed Nov 5, 2023
2 parents 3b184d9 + 72d3031 commit 670e9c1
Show file tree
Hide file tree
Showing 18 changed files with 980 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void commonInit() {
if (getModList().contains("farmersdelight"))
pfmModCompatibilities.add(PFMFarmersDelight.getInstance());
if (getModList().contains("imm_ptl_core"))
pfmModCompatibilities.add(new PFMImmersivePortals());
pfmModCompatibilities.add(PFMImmersivePortals.getInstance());
}

@ExpectPlatform
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,10 @@ public static Identifier getLogId(Block block, String postFix) {
if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) {
return id;
}
id = new Identifier(namespace, "block/alpha_oak_log");
if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) {
return id;
}
}
return new Identifier(namespace, "block/" + path);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,45 +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.block.Material;
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.of(Material.STONE, MapColor.WHITE).nonOpaque());
PaladinFurnitureModBlocksItems.GRAY_MIRROR = new PFMMirrorBlockIP(AbstractBlock.Settings.of(Material.STONE, 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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public Optional<WoodVariant> getVariantFromBlock(Block baseBlock, Identifier blo
}
String namespace = blockId.getNamespace();
if (name != null && !namespace.equals("securitycraft") &&
!namespace.equals("absentbydesign") && !(namespace.equals("terrestria") && path.contains("sakura")) && !(namespace.equals("betternether") && path.contains("nether_mushroom")) && !namespace.equals("chipped")) {
!namespace.equals("absentbydesign") && !(namespace.equals("terrestria") && path.contains("sakura")) && !(namespace.equals("betternether") && path.contains("nether_mushroom")) && !namespace.equals("chipped") && !(namespace.equals("regions_unexplored") && path.contains("alpha"))) {

BlockState state = baseBlock.getDefaultState();
//can't check if the block is a full one, so I do this. Adding some checks here
Expand Down
13 changes: 11 additions & 2 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ else {

if (rootProject.immersive_portals_compatibility_fabric == "true"){
dependencies {
modRuntimeOnly ("com.github.iPortalTeam.ImmersivePortalsMod:imm_ptl_core:${rootProject.immersive_portals_version_fabric}"){
modImplementation ("com.github.iPortalTeam.ImmersivePortalsMod:imm_ptl_core:${rootProject.immersive_portals_version_fabric}"){
exclude(group: "net.fabricmc.fabric-api")
transitive(false)
}
modRuntimeOnly("com.github.iPortalTeam.ImmersivePortalsMod:q_misc_util:${rootProject.immersive_portals_version_fabric}"){
modImplementation("com.github.iPortalTeam.ImmersivePortalsMod:q_misc_util:${rootProject.immersive_portals_version_fabric}"){
exclude(group: "net.fabricmc.fabric-api")
transitive(false)
}
Expand Down Expand Up @@ -189,6 +189,15 @@ dependencies {

modCompileOnly "curse.maven:balm-fabric-500525:${rootProject.balm_version_fabric}"
modCompileOnly "curse.maven:cooking-for-blockheads-fabric-634546:${rootProject.cookingforblockheads_version_fabric}"

modCompileOnly("com.github.iPortalTeam.ImmersivePortalsMod:imm_ptl_core:${rootProject.immersive_portals_version_fabric}"){
exclude(group: "net.fabricmc.fabric-api")
transitive(false)
}
modCompileOnly("com.github.iPortalTeam.ImmersivePortalsMod:q_misc_util:${rootProject.immersive_portals_version_fabric}"){
exclude(group: "net.fabricmc.fabric-api")
transitive(false)
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
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.block.Material;
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.of(Material.STONE, MapColor.WHITE).nonOpaque());
PaladinFurnitureModBlocksItems.GRAY_MIRROR = new PFMMirrorBlockIP(AbstractBlock.Settings.of(Material.STONE, 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();
}
}
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);
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.unlikepaladin.pfm.compat.imm_ptl.client;
package com.unlikepaladin.pfm.compat.imm_ptl.fabric.client;

import com.unlikepaladin.pfm.client.EntityRenderRegistry;
import com.unlikepaladin.pfm.compat.PFMClientModCompatibility;
import com.unlikepaladin.pfm.compat.PFMModCompatibility;
import com.unlikepaladin.pfm.compat.imm_ptl.PFMImmersivePortals;
import qouteall.imm_ptl.core.render.PortalEntityRenderer;
import com.unlikepaladin.pfm.compat.imm_ptl.fabric.PFMImmersivePortalsImpl;

public class PFMImmersivePortalsClient implements PFMClientModCompatibility {
private final PFMImmersivePortals parent;
public PFMImmersivePortalsClient(PFMImmersivePortals parent) {
private final PFMImmersivePortalsImpl parent;
public PFMImmersivePortalsClient(PFMImmersivePortalsImpl parent) {
this.parent = parent;
}
@Override
Expand All @@ -18,6 +17,6 @@ public PFMModCompatibility getCompatiblity() {

@Override
public void registerEntityRenderer() {
EntityRenderRegistry.registerEntityRender(PFMImmersivePortals.MIRROR, PFMMirrorEntityRenderer::new);
EntityRenderRegistry.registerEntityRender(PFMImmersivePortalsImpl.MIRROR, PFMMirrorEntityRenderer::new);
}
}
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);
}
}
Loading

0 comments on commit 670e9c1

Please sign in to comment.