test and fix multiplayer

This commit is contained in:
QuImUfu 2023-06-27 23:47:05 +02:00
parent 83ada2096e
commit 82007f627f
6 changed files with 52 additions and 15 deletions

View File

@ -1,16 +1,12 @@
package quimufu.colourful_portals; package quimufu.colourful_portals;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings; import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroupEntries; import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroupEntries;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.enums.Instrument; import net.minecraft.block.enums.Instrument;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.item.*; import net.minecraft.item.*;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
@ -22,7 +18,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import quimufu.colourful_portals.client.PortalFluidRenderHandler;
import quimufu.colourful_portals.config.ColourfulPortalConfig; import quimufu.colourful_portals.config.ColourfulPortalConfig;
import quimufu.colourful_portals.portal_fluid.PortalFluid; import quimufu.colourful_portals.portal_fluid.PortalFluid;
import quimufu.colourful_portals.portal_fluid.PortalFluidBlock; import quimufu.colourful_portals.portal_fluid.PortalFluidBlock;
@ -30,7 +25,7 @@ import quimufu.colourful_portals.portal_fluid.PortalFluidBucketItem;
import java.util.HashSet; import java.util.HashSet;
public class ColourfulPortalsMod implements ModInitializer, ClientModInitializer { public class ColourfulPortalsMod implements ModInitializer {
public static final String MOD_ID = "colourful_portals"; public static final String MOD_ID = "colourful_portals";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
@ -91,10 +86,4 @@ public class ColourfulPortalsMod implements ModInitializer, ClientModInitializer
content.add(BLOB_DARK); content.add(BLOB_DARK);
} }
public void onInitializeClient() {
BlockRenderLayerMap.INSTANCE.putBlock(PORTAL_BLOCK, RenderLayer.getTranslucent());
BlockRenderLayerMap.INSTANCE.putFluid(PORTAL_FLUID, RenderLayer.getTranslucent());
FluidRenderHandlerRegistry.INSTANCE.register(PORTAL_FLUID, new PortalFluidRenderHandler());
}
} }

View File

@ -0,0 +1,16 @@
package quimufu.colourful_portals;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry;
import net.minecraft.client.render.RenderLayer;
import quimufu.colourful_portals.client.PortalFluidRenderHandler;
public class ColourfulPortalsModClient implements ClientModInitializer {
public void onInitializeClient() {
BlockRenderLayerMap.INSTANCE.putBlock(ColourfulPortalsMod.PORTAL_BLOCK, RenderLayer.getTranslucent());
BlockRenderLayerMap.INSTANCE.putFluid(ColourfulPortalsMod.PORTAL_FLUID, RenderLayer.getTranslucent());
FluidRenderHandlerRegistry.INSTANCE.register(ColourfulPortalsMod.PORTAL_FLUID, new PortalFluidRenderHandler());
}
}

View File

@ -1,6 +1,5 @@
package quimufu.colourful_portals.portal; package quimufu.colourful_portals.portal;
import com.ibm.icu.impl.Pair;
import dev.onyxstudios.cca.api.v3.component.Component; import dev.onyxstudios.cca.api.v3.component.Component;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtElement; import net.minecraft.nbt.NbtElement;
@ -10,6 +9,7 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockBox; import net.minecraft.util.math.BlockBox;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldProperties; import net.minecraft.world.WorldProperties;
import quimufu.colourful_portals.util.Pair;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;

View File

@ -1,6 +1,5 @@
package quimufu.colourful_portals.portal; package quimufu.colourful_portals.portal;
import com.ibm.icu.impl.Pair;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
@ -18,6 +17,7 @@ import qouteall.imm_ptl.core.api.PortalAPI;
import qouteall.imm_ptl.core.portal.Portal; import qouteall.imm_ptl.core.portal.Portal;
import qouteall.q_misc_util.my_util.DQuaternion; import qouteall.q_misc_util.my_util.DQuaternion;
import quimufu.colourful_portals.config.ColourfulPortalConfig; import quimufu.colourful_portals.config.ColourfulPortalConfig;
import quimufu.colourful_portals.util.Pair;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -0,0 +1,32 @@
package quimufu.colourful_portals.util;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import java.util.Objects;
public class Pair<A, B> {
public final A first;
public final B second;
public Pair(A first, B second) {
this.first = first;
this.second = second;
}
public static <A,B> Pair<A,B> of(A first, B second) {
return new Pair<>(first,second);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Pair<?, ?> pair = (Pair<?, ?>) o;
return Objects.equals(first, pair.first) && Objects.equals(second, pair.second);
}
@Override
public int hashCode() {
return Objects.hash(first, second);
}
}

View File

@ -19,7 +19,7 @@
"quimufu.colourful_portals.ColourfulPortalsMod" "quimufu.colourful_portals.ColourfulPortalsMod"
], ],
"client": [ "client": [
"quimufu.colourful_portals.ColourfulPortalsMod" "quimufu.colourful_portals.ColourfulPortalsModClient"
], ],
"cardinal-components": [ "cardinal-components": [
"quimufu.colourful_portals.Components" "quimufu.colourful_portals.Components"