Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to 1.21.1 #117

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'

- name: Validate Gradle wrapper
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
files: |
${{ matrix.loader }}/build/libs/!(*-@(dev|sources|javadoc)).jar
${{ matrix.loader }}/build/libs/*-@(dev|sources|javadocs).jar
java: Java 17
java: Java 21
name: >
[
${{ env.loader_name }} ${{ env.mc_version }}
Expand All @@ -75,7 +75,7 @@ jobs:
files: |
${{ matrix.loader }}/build/libs/!(*-@(dev|sources|javadoc)).jar
${{ matrix.loader }}/build/libs/*-@(dev|sources|javadocs).jar
java: Java 17
java: Java 21
name: >
[
${{ env.loader_name }} ${{ env.mc_version }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ eclipse
run
runs
/neoforge/runs/
/neoforge/src/generated/
34 changes: 17 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
plugins {
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.7"
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.9"
}

subprojects {
apply plugin: 'java'

java.toolchain.languageVersion = JavaLanguageVersion.of(17)
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
java.withSourcesJar()
java.withJavadocJar()

Expand Down Expand Up @@ -60,27 +60,27 @@ subprojects {

tasks.withType(JavaCompile).configureEach {
it.options.encoding = 'UTF-8'
it.options.getRelease().set(17)
it.options.getRelease().set(21)
}

processResources {
def expandProps = [
"version" : version,
"group" : project.group, //Else we target the task's group.
"minecraft_version" : minecraft_version,
"neoforge_version" : neoforge_version,
"neoforge_loader_version_range": neoforge_loader_version_range,
"minecraft_version_range" : minecraft_version_range,
"fabric_version" : fabric_version,
"fabric_loader_version" : fabric_loader_version,
"mod_name" : mod_name,
"mod_author" : mod_author,
"mod_id" : mod_id,
"mod_license" : mod_license,
"mod_description" : project.mod_description,
"version" : version,
"group" : project.group, //Else we target the task's group.
"minecraft_version" : minecraft_version,
"neoforge_version" : neoforge_version,
"minecraft_neoforge_version_range" : minecraft_neoforge_version_range,
"fabric_version" : fabric_version,
"fabric_loader_version" : fabric_loader_version,
"minecraft_fabric_version_range" : minecraft_fabric_version_range,
"mod_name" : mod_name,
"mod_author" : mod_author,
"mod_id" : mod_id,
"mod_license" : mod_license,
"mod_description" : project.mod_description,
]

filesMatching(['pack.mcmeta', 'fabric.mod.json', 'META-INF/mods.toml', '*.mixins.json']) {
filesMatching(['pack.mcmeta', 'fabric.mod.json', 'META-INF/neoforge.mods.toml', '*.mixins.json']) {
expand expandProps
}
inputs.properties(expandProps)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package lilypuree.decorative_blocks;

import lilypuree.decorative_blocks.CommonAPI;
import lilypuree.decorative_blocks.blocks.BonfireBlock;
import lilypuree.decorative_blocks.blocks.SupportBlock;
import lilypuree.decorative_blocks.fluid.ThatchBlock;
Expand Down Expand Up @@ -66,9 +65,7 @@ private static InteractionResult shearThatch(Player player, Level level, ItemSta
level.setBlockAndUpdate(pos, CommonAPI.shearMap.get(block).getLiquidBlock().defaultBlockState());
level.gameEvent(player, GameEvent.BLOCK_CHANGE, pos);
player.playSound(SoundEvents.CROP_BREAK, 1.2F, 1.0F);
itemStack.hurtAndBreak(1, player, (entity) -> {
entity.broadcastBreakEvent(EquipmentSlot.MAINHAND);
});
itemStack.hurtAndBreak(1, player, EquipmentSlot.MAINHAND);
return InteractionResult.sidedSuccess(level.isClientSide);
}
return InteractionResult.PASS;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
package lilypuree.decorative_blocks;

import lilypuree.decorative_blocks.blocks.IWoodenBlock;
import lilypuree.decorative_blocks.blocks.PalisadeBlock;
import lilypuree.decorative_blocks.blocks.SeatBlock;
import lilypuree.decorative_blocks.blocks.SupportBlock;
import lilypuree.decorative_blocks.blocks.types.VanillaWoodTypes;
import lilypuree.decorative_blocks.mixin.FireBlockInvoker;
import lilypuree.decorative_blocks.registration.DBBlocks;
import lilypuree.decorative_blocks.registration.Registration;
import lilypuree.decorative_blocks.items.BlockstateCopyItem;
import lilypuree.decorative_blocks.mixin.FireBlockInvoker;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.level.block.Blocks;

Expand All @@ -20,16 +16,6 @@ public static void init() {
CommonAPI.bonfireMap.put(Blocks.FIRE, DBBlocks.BONFIRE.get());
CommonAPI.bonfireMap.put(Blocks.SOUL_FIRE, DBBlocks.SOUL_BONFIRE.get());

BuiltInRegistries.BLOCK.forEach(block -> {
if (block instanceof PalisadeBlock) {
BlockstateCopyItem.addProperties(block, PalisadeBlock.NORTH, PalisadeBlock.EAST, PalisadeBlock.SOUTH, PalisadeBlock.WEST);
} else if (block instanceof SeatBlock) {
BlockstateCopyItem.addProperties(block, SeatBlock.FACING, SeatBlock.POST, SeatBlock.ATTACHED);
} else if (block instanceof SupportBlock) {
BlockstateCopyItem.addProperties(block, SupportBlock.HORIZONTAL_SHAPE, SupportBlock.VERTICAL_SHAPE, SupportBlock.FACING, SupportBlock.UP);
}
});

FireBlockInvoker invoker = ((FireBlockInvoker) ((Object) Blocks.FIRE));
BuiltInRegistries.BLOCK.forEach(block -> {
if (block instanceof IWoodenBlock woodenBlock) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.mojang.serialization.MapCodec;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.BlockGetter;
Expand Down Expand Up @@ -58,15 +57,13 @@ public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos,
}

@Override
public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hit) {
state = state.cycle(OPEN);
worldIn.setBlock(pos, state, 2);
level.setBlock(pos, state, 2);
if (state.getValue(WATERLOGGED)) {
worldIn.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(worldIn));
level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level));
}
this.playSound(player, worldIn, pos, state.getValue(OPEN));
return InteractionResult.sidedSuccess(worldIn.isClientSide);
this.playSound(player, level, pos, state.getValue(OPEN));
return InteractionResult.sidedSuccess(level.isClientSide);
}


}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package lilypuree.decorative_blocks.blocks;

import lilypuree.decorative_blocks.registration.DBBlocks;
import lilypuree.decorative_blocks.platform.Services;
import lilypuree.decorative_blocks.registration.DBBlocks;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.particles.ParticleTypes;
Expand All @@ -11,7 +11,6 @@
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
Expand Down Expand Up @@ -52,12 +51,12 @@ public VoxelShape getCollisionShape(BlockState state, BlockGetter worldIn, Block

@Override
public void entityInside(BlockState state, Level worldIn, BlockPos pos, Entity entityIn) {
if (!entityIn.fireImmune() && entityIn instanceof LivingEntity && !EnchantmentHelper.hasFrostWalker((LivingEntity) entityIn)) {
if (!entityIn.fireImmune() && entityIn instanceof LivingEntity) {
entityIn.hurt(entityIn.damageSources().inFire(), 1.0F);
if (Services.PLATFORM.isModLoaded("soulfired")) {
Services.SOULFIRED.setSecondsOnFire(entityIn, 3, state.is(DBBlocks.SOUL_BONFIRE.get()));
} else
entityIn.setSecondsOnFire(3);
entityIn.igniteForSeconds(3);
}
super.entityInside(state, worldIn, pos, entityIn);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import net.minecraft.sounds.SoundSource;
import net.minecraft.util.RandomSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
Expand All @@ -18,7 +18,6 @@
import net.minecraft.world.item.Items;
import net.minecraft.world.item.ShovelItem;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
Expand Down Expand Up @@ -50,9 +49,9 @@ public BrazierBlock(Properties properties, boolean isSoul) {

@Override
public void entityInside(BlockState state, Level worldIn, BlockPos pos, Entity entityIn) {
if (!entityIn.fireImmune() && state.getValue(LIT) && entityIn instanceof LivingEntity && !EnchantmentHelper.hasFrostWalker((LivingEntity) entityIn)) {
if (!entityIn.fireImmune() && state.getValue(LIT) && entityIn instanceof LivingEntity) {
if (entityIn.getY() >= state.getCollisionShape(worldIn, pos).max(Direction.Axis.Y) + pos.getY() - 0.1f) {
entityIn.hurt(entityIn.damageSources().inFire(), 1.0F);
entityIn.hurt(entityIn.damageSources().campfire(), 1.0F);
}
}
super.entityInside(state, worldIn, pos, entityIn);
Expand All @@ -76,27 +75,26 @@ public BlockState updateShape(BlockState stateIn, Direction facing, BlockState f
}

@Override
public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
ItemStack heldItem = player.getItemInHand(handIn);
protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
if (state.getValue(LIT)) {
if (heldItem.getItem() instanceof ShovelItem) {
worldIn.playSound(null, pos, SoundEvents.GENERIC_EXTINGUISH_FIRE, SoundSource.BLOCKS, 0.8F, 1.0F);
if (stack.getItem() instanceof ShovelItem) {
level.playSound(null, pos, SoundEvents.GENERIC_EXTINGUISH_FIRE, SoundSource.BLOCKS, 0.8F, 1.0F);

worldIn.setBlockAndUpdate(pos, state.setValue(LIT, Boolean.FALSE));
return InteractionResult.SUCCESS;
level.setBlockAndUpdate(pos, state.setValue(LIT, Boolean.FALSE));
return ItemInteractionResult.SUCCESS;
}
} else if (!state.getValue(WATERLOGGED)) {
if (hit.getDirection() == Direction.UP && heldItem.getItem() == Items.FLINT_AND_STEEL || heldItem.getItem() == Items.FIRE_CHARGE) {
if (hit.getDirection() == Direction.UP && stack.getItem() == Items.FLINT_AND_STEEL || stack.getItem() == Items.FIRE_CHARGE) {

SoundEvent sound = (heldItem.getItem() == Items.FIRE_CHARGE) ? SoundEvents.FIRECHARGE_USE : SoundEvents.FLINTANDSTEEL_USE;
worldIn.playSound(null, pos, sound, SoundSource.BLOCKS, 1.0F, worldIn.random.nextFloat() * 0.4F + 0.8F);
SoundEvent sound = (stack.getItem() == Items.FIRE_CHARGE) ? SoundEvents.FIRECHARGE_USE : SoundEvents.FLINTANDSTEEL_USE;
level.playSound(null, pos, sound, SoundSource.BLOCKS, 1.0F, level.random.nextFloat() * 0.4F + 0.8F);

worldIn.setBlockAndUpdate(pos, state.setValue(LIT, true));
return InteractionResult.CONSUME;
level.setBlockAndUpdate(pos, state.setValue(LIT, true));
return ItemInteractionResult.SUCCESS;

}
}
return super.use(state, worldIn, pos, player, handIn, hit);
return super.useItemOn(stack, state, level, pos, player, hand, hit);
}

@Override
Expand Down Expand Up @@ -166,7 +164,7 @@ protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockSt
}

@Override
public boolean isPathfindable(BlockState state, BlockGetter worldIn, BlockPos pos, PathComputationType type) {
public boolean isPathfindable(BlockState state, PathComputationType pathComputationType) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package lilypuree.decorative_blocks.blocks;

import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.BlockGetter;
Expand Down Expand Up @@ -51,13 +50,13 @@ public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos,
}

@Override
public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hit) {
state = state.cycle(OPEN);
worldIn.setBlock(pos, state, 2);
level.setBlock(pos, state, 2);
if (state.getValue(WATERLOGGED)) {
worldIn.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(worldIn));
level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level));
}
this.playSound(player, worldIn, pos, state.getValue(OPEN));
this.playSound(player, level, pos, state.getValue(OPEN));
return InteractionResult.SUCCESS;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public WoodType getWoodType() {
}

@Override
public boolean isPathfindable(BlockState state, BlockGetter worldIn, BlockPos pos, PathComputationType type) {
public boolean isPathfindable(BlockState state, PathComputationType pathComputationType) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockSt
}

@Override
public boolean isPathfindable(BlockState p_196266_1_, BlockGetter p_196266_2_, BlockPos p_196266_3_, PathComputationType p_196266_4_) {
public boolean isPathfindable(BlockState state, PathComputationType pathComputationType) {
return false;
}
}
Loading