update to 1.20

This commit is contained in:
QuImUfu 2023-06-11 00:14:34 +02:00
parent 580d46a36c
commit 2ed2891b71
9 changed files with 53 additions and 64 deletions

View File

@ -83,7 +83,7 @@ dependencies {
include(modApi("de.siphalor.tweed4:tweed4-annotated-$project.minecraft_version_major")) include(modApi("de.siphalor.tweed4:tweed4-annotated-$project.minecraft_version_major"))
include(modApi("de.siphalor.tweed4:tweed4-data-$project.minecraft_version_major")) include(modApi("de.siphalor.tweed4:tweed4-data-$project.minecraft_version_major"))
include(modApi("de.siphalor.tweed4:tweed4-data-hjson-$project.minecraft_version_major")) include(modApi("de.siphalor.tweed4:tweed4-data-hjson-$project.minecraft_version_major"))
include(modApi("de.siphalor.tweed4:tweed4-tailor-cloth-$project.minecraft_version_major")) //include(modApi("de.siphalor.tweed4:tweed4-tailor-cloth-$project.minecraft_version_major"))
include(modApi("de.siphalor.tweed4:tweed4-tailor-screen-$project.minecraft_version_major")) include(modApi("de.siphalor.tweed4:tweed4-tailor-screen-$project.minecraft_version_major"))
@ -102,10 +102,9 @@ configurations.include.dependencies.each {
} }
processResources { processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") { filesMatching("fabric.mod.json") {
expand "version": project.version expand(project.properties)
} }
} }
@ -134,6 +133,7 @@ import com.modrinth.minotaur.dependencies.ModDependency
modrinth { modrinth {
projectId = 'QXA901PE' // The ID of your Modrinth project. Slugs will not work. projectId = 'QXA901PE' // The ID of your Modrinth project. Slugs will not work.
uploadFile = remapJar // Tells Minotaur to use the remapped jar uploadFile = remapJar // Tells Minotaur to use the remapped jar
versionType = "beta"
dependencies = [ dependencies = [
new ModDependency('P7dR8mSH', 'required'), //required dependency on Fabric API new ModDependency('P7dR8mSH', 'required'), //required dependency on Fabric API
new ModDependency('zJpHMkdD', 'required') //required dependency on Immersive Portals new ModDependency('zJpHMkdD', 'required') //required dependency on Immersive Portals

View File

@ -4,20 +4,21 @@ org.gradle.parallel=true
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/develop # check these on https://fabricmc.net/develop
minecraft_version=1.19.4 minecraft_version=1.20
minecraft_version_major=1.19 yarn_mappings=1.20+build.1
yarn_mappings=1.19.4+build.2 loader_version=0.14.21
loader_version=0.14.19 minecraft_version_major=1.20
# Mod Properties # Mod Properties
mod_version=1.0.0 mod_version=0.9.1
maven_group=quimufu.colourful-portals maven_group=quimufu.colourful-portals
archives_base_name=colourful-portals archives_base_name=colourful-portals
# Dependencies # Dependencies
fabric_version=0.81.1+1.19.4 fabric_version=0.83.0+1.20
cardinal_components_version=5.1.0 cardinal_components_version=5.2.1
immersive_portals_version=v2.6.9-mc1.19.4 immersive_portals_version_short=3.0.1
tweed_version=1.3.0+mc1.19.4 immersive_portals_version=v3.0.1-mc1.20
tweed_version=1.3.0+mc1.20-pre1
sodium_version=0.4.10 sodium_version=0.4.10
cloth_config_version=10.0.96 cloth_config_version=11.0.99

View File

@ -4,33 +4,26 @@ 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.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry; import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry;
import net.fabricmc.fabric.api.event.player.AttackBlockCallback;
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.Material; import net.minecraft.block.enums.Instrument;
import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.RenderLayer;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.*; import net.minecraft.item.*;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry; import net.minecraft.registry.Registry;
import net.minecraft.server.world.ServerWorld; import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.Rarity; import net.minecraft.util.Rarity;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.World;
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.client.PortalFluidRenderHandler;
import quimufu.colourful_portals.config.ColourfulPortalConfig; import quimufu.colourful_portals.config.ColourfulPortalConfig;
import quimufu.colourful_portals.portal.PortalManager;
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;
import quimufu.colourful_portals.portal_fluid.PortalFluidBucketItem; import quimufu.colourful_portals.portal_fluid.PortalFluidBucketItem;
@ -43,12 +36,12 @@ public class ColourfulPortalsMod implements ModInitializer, ClientModInitializer
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
public static final HashSet<Identifier> PORTAL_BLOCKS = new HashSet<>(); public static final HashSet<Identifier> PORTAL_BLOCKS = new HashSet<>();
public static final PortalBlock PORTAL_BLOCK = new PortalBlock(FabricBlockSettings.of(Material.GLASS).strength(-1.0f, 3600000.8f).dropsNothing().nonOpaque().luminance(15).allowsSpawning(ColourfulPortalsMod::never).solidBlock(ColourfulPortalsMod::never).suffocates(ColourfulPortalsMod::never).blockVision(ColourfulPortalsMod::never).ticksRandomly()); public static final PortalBlock PORTAL_BLOCK = new PortalBlock(FabricBlockSettings.create().instrument(Instrument.HAT).sounds(BlockSoundGroup.GLASS).strength(-1.0f, 3600000.8f).dropsNothing().nonOpaque().luminance(15).allowsSpawning(ColourfulPortalsMod::never).solidBlock(ColourfulPortalsMod::never).suffocates(ColourfulPortalsMod::never).blockVision(ColourfulPortalsMod::never).ticksRandomly());
public static final BlockItem PORTAL_BLOCK_ITEM = new BlockItem(PORTAL_BLOCK, new FabricItemSettings().rarity(Rarity.EPIC)); public static final BlockItem PORTAL_BLOCK_ITEM = new BlockItem(PORTAL_BLOCK, new FabricItemSettings().rarity(Rarity.EPIC));
public static final Item BLOB_DARK = new Item(new FabricItemSettings()); public static final Item BLOB_DARK = new Item(new FabricItemSettings());
public static final Item BLOB_BRIGHT = new Item(new FabricItemSettings()); public static final Item BLOB_BRIGHT = new Item(new FabricItemSettings());
public static final PortalFluid PORTAL_FLUID = new PortalFluid(); public static final PortalFluid PORTAL_FLUID = new PortalFluid();
public static final PortalFluidBlock PORTAL_FLUID_BLOCk = new PortalFluidBlock(PORTAL_FLUID, FabricBlockSettings.of(Material.WATER).luminance(15).noCollision().strength(100.0f).dropsNothing()); public static final PortalFluidBlock PORTAL_FLUID_BLOCk = new PortalFluidBlock(PORTAL_FLUID, FabricBlockSettings.create().sounds(BlockSoundGroup.field_44608).luminance(15).noCollision().strength(100.0f).dropsNothing());
public static final BucketItem PORTAL_FLUID_BUCKET_ITEM = new PortalFluidBucketItem(PORTAL_FLUID, new FabricItemSettings().recipeRemainder(Items.BUCKET).maxCount(1).rarity(Rarity.RARE)); public static final BucketItem PORTAL_FLUID_BUCKET_ITEM = new PortalFluidBucketItem(PORTAL_FLUID, new FabricItemSettings().recipeRemainder(Items.BUCKET).maxCount(1).rarity(Rarity.RARE));
private static boolean never(BlockState blockState, BlockView blockView, BlockPos blockPos, EntityType<?> entityType) { private static boolean never(BlockState blockState, BlockView blockView, BlockPos blockPos, EntityType<?> entityType) {

View File

@ -26,31 +26,31 @@ import quimufu.colourful_portals.portal.PortalManager;
public class PortalBlock extends Block implements FluidFillable { public class PortalBlock extends Block implements FluidFillable {
public static final EnumProperty<Direction.Axis> AXIS = Properties.AXIS; public static final EnumProperty<Direction.Axis> AXIS = Properties.AXIS;
public static final EnumProperty<DyeColor> DYE_COLOR = EnumProperty.of("colour", DyeColor.class);; public static final EnumProperty<DyeColor> DYE_COLOR = EnumProperty.of("colour", DyeColor.class);
public static final VoxelShape X_AABB = Block.createCuboidShape( public static final VoxelShape X_AABB = Block.createCuboidShape(
7.0D, 7.0D,
0.0D, 0.0D,
0.0D, 0.0D,
9.0D, 9.0D,
16.0D, 16.0D,
16.0D 16.0D
); );
public static final VoxelShape Y_AABB = Block.createCuboidShape( public static final VoxelShape Y_AABB = Block.createCuboidShape(
0.0D, 0.0D,
7.0D, 7.0D,
0.0D, 0.0D,
16.0D, 16.0D,
9.0D, 9.0D,
16.0D 16.0D
); );
public static final VoxelShape Z_AABB = Block.createCuboidShape( public static final VoxelShape Z_AABB = Block.createCuboidShape(
0.0D, 0.0D,
0.0D, 0.0D,
7.0D, 7.0D,
16.0D, 16.0D,
16.0D, 16.0D,
9.0D 9.0D
); );
public PortalBlock(Settings settings) { public PortalBlock(Settings settings) {
@ -59,12 +59,10 @@ public class PortalBlock extends Block implements FluidFillable {
} }
@Override @Override
public VoxelShape getOutlineShape( public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos blockPos, ShapeContext shapeContext) {
BlockState state, BlockView world, BlockPos blockPos, ShapeContext shapeContext if (shapeContext.isHolding(Items.DEBUG_STICK)
) {
if(shapeContext.isHolding(Items.DEBUG_STICK)
|| shapeContext.isHolding(ColourfulPortalsMod.PORTAL_BLOCK_ITEM) || shapeContext.isHolding(ColourfulPortalsMod.PORTAL_BLOCK_ITEM)
|| shapeContext.isHolding(ColourfulPortalsMod.PORTAL_FLUID_BUCKET_ITEM)){ || shapeContext.isHolding(ColourfulPortalsMod.PORTAL_FLUID_BUCKET_ITEM)) {
return switch (state.get(AXIS)) { return switch (state.get(AXIS)) {
case Z -> Z_AABB; case Z -> Z_AABB;
case Y -> Y_AABB; case Y -> Y_AABB;
@ -122,7 +120,7 @@ public class PortalBlock extends Block implements FluidFillable {
@Override @Override
public boolean canFillWithFluid(BlockView world, BlockPos pos, BlockState state, Fluid fluid) { public boolean canFillWithFluid(BlockView world, BlockPos pos, BlockState state, Fluid fluid) {
if(((World)world).isClient() && fluid == ColourfulPortalsMod.PORTAL_FLUID){ if (((World) world).isClient() && fluid == ColourfulPortalsMod.PORTAL_FLUID) {
return true; return true;
} }
return fluid == ColourfulPortalsMod.PORTAL_FLUID return fluid == ColourfulPortalsMod.PORTAL_FLUID
@ -132,7 +130,7 @@ public class PortalBlock extends Block implements FluidFillable {
@Override @Override
public boolean tryFillWithFluid(WorldAccess world, BlockPos pos, BlockState state, FluidState fluidState) { public boolean tryFillWithFluid(WorldAccess world, BlockPos pos, BlockState state, FluidState fluidState) {
if(((World)world).isClient() && fluidState.isOf(ColourfulPortalsMod.PORTAL_FLUID)){ if (world.isClient() && fluidState.isOf(ColourfulPortalsMod.PORTAL_FLUID)) {
return true; return true;
} }
return fluidState.isOf(ColourfulPortalsMod.PORTAL_FLUID) return fluidState.isOf(ColourfulPortalsMod.PORTAL_FLUID)

View File

@ -6,14 +6,14 @@ import de.siphalor.tweed4.annotated.AConfigEntry;
import de.siphalor.tweed4.annotated.ATweedConfig; import de.siphalor.tweed4.annotated.ATweedConfig;
import de.siphalor.tweed4.config.ConfigEnvironment; import de.siphalor.tweed4.config.ConfigEnvironment;
import de.siphalor.tweed4.config.ConfigScope; import de.siphalor.tweed4.config.ConfigScope;
import de.siphalor.tweed4.tailor.cloth.ClothData; //import de.siphalor.tweed4.tailor.cloth.ClothData;
import net.minecraft.util.DyeColor; import net.minecraft.util.DyeColor;
import quimufu.colourful_portals.ColourfulPortalsMod; import quimufu.colourful_portals.ColourfulPortalsMod;
import java.util.Map; import java.util.Map;
@ATweedConfig(serializer = "tweed4:hjson", scope = ConfigScope.GAME, environment = ConfigEnvironment.SERVER, tailors = {"tweed4:lang_json_descriptions", "tweed4:coat", "tweed4:json_schema"}, casing = CaseFormat.LOWER_HYPHEN) @ATweedConfig(serializer = "tweed4:hjson", scope = ConfigScope.GAME, environment = ConfigEnvironment.SERVER, tailors = {"tweed4:lang_json_descriptions", "tweed4:coat", "tweed4:json_schema"}, casing = CaseFormat.LOWER_HYPHEN)
@ClothData(modid = ColourfulPortalsMod.MOD_ID) //@ClothData(modid = ColourfulPortalsMod.MOD_ID)
public class ColourfulPortalConfig { public class ColourfulPortalConfig {
@AConfigEntry(comment = @AConfigEntry(comment =

View File

@ -7,6 +7,7 @@ import net.minecraft.fluid.FluidState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.loot.context.LootContext; import net.minecraft.loot.context.LootContext;
import net.minecraft.loot.context.LootContextParameterSet;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundEvent; import net.minecraft.sound.SoundEvent;
import net.minecraft.state.StateManager; import net.minecraft.state.StateManager;
@ -90,7 +91,7 @@ public class PortalFluidBlock
} }
@Override @Override
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) { public List<ItemStack> getDroppedStacks(BlockState state, LootContextParameterSet.Builder builder) {
return Collections.emptyList(); return Collections.emptyList();
} }

View File

@ -3,7 +3,6 @@ package quimufu.colourful_portals.portal_fluid;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.FluidFillable; import net.minecraft.block.FluidFillable;
import net.minecraft.block.Material;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BucketItem; import net.minecraft.item.BucketItem;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -62,7 +61,6 @@ public class PortalFluidBucketItem extends BucketItem {
public boolean placeFluid(PlayerEntity player, World world, BlockPos pos, BlockHitResult hitResult) { public boolean placeFluid(PlayerEntity player, World world, BlockPos pos, BlockHitResult hitResult) {
BlockState blockState = world.getBlockState(pos); BlockState blockState = world.getBlockState(pos);
Block block = blockState.getBlock(); Block block = blockState.getBlock();
Material material = blockState.getMaterial();
boolean shouldTryPlace = blockState.isAir() boolean shouldTryPlace = blockState.isAir()
|| blockState.canBucketPlace(this.fluid) || blockState.canBucketPlace(this.fluid)
|| block instanceof FluidFillable && ((FluidFillable) block).canFillWithFluid(world, pos, blockState, this.fluid); || block instanceof FluidFillable && ((FluidFillable) block).canFillWithFluid(world, pos, blockState, this.fluid);
@ -83,7 +81,7 @@ public class PortalFluidBucketItem extends BucketItem {
} }
if (!world.isClient && blockState.canBucketPlace(this.fluid) && !material.isLiquid()) { if (!world.isClient && blockState.canBucketPlace(this.fluid) && !blockState.isLiquid()) {
world.breakBlock(pos, true); world.breakBlock(pos, true);
} }
if (world.setBlockState(pos, this.fluid.getDefaultState().getBlockState(), Block.NOTIFY_ALL | Block.REDRAW_ON_MAIN_THREAD) || blockState.getFluidState().isStill()) { if (world.setBlockState(pos, this.fluid.getDefaultState().getBlockState(), Block.NOTIFY_ALL | Block.REDRAW_ON_MAIN_THREAD) || blockState.getFluidState().isStill()) {

View File

@ -11,6 +11,7 @@
"plugin": "quimufu.colourful_portals.MixinConfig", "plugin": "quimufu.colourful_portals.MixinConfig",
"client": [ "client": [
"InterpolationMixin", "InterpolationMixin",
"SodiumFluidRendererMixin" "SodiumFluidRendererMixin",
"FrontClippingMixin"
] ]
} }

View File

@ -41,14 +41,11 @@
"colourful_portals.mixins.json" "colourful_portals.mixins.json"
], ],
"depends": { "depends": {
"fabricloader": ">=0.14.19", "fabricloader": ">=${loader_version}",
"imm_ptl_core": ">=2.6.9", "imm_ptl_core": ">=${immersive_portals_version_short}",
"q_misc_util": ">=2.6.9", "q_misc_util": ">=${immersive_portals_version_short}",
"minecraft": "~1.19.4", "minecraft": "~${minecraft_version}",
"java": ">=17", "java": ">=17",
"fabric-api": "*" "fabric-api": "*"
},
"suggests": {
"another-mod": "*"
} }
} }