Skip to content

Commit

Permalink
Initial port to 1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
3TUSK committed Jun 8, 2023
1 parent e0594c6 commit a893985
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 115 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '[6.0,6.2)'
classpath group: 'org.parchmentmc', name: 'librarian', version: '1.+'
}
}
Expand All @@ -22,13 +22,13 @@ java.toolchain.languageVersion = JavaLanguageVersion.of(17)
// definitions at gradle/teacon-forge.gradle
teacon {
modId = 'xkdeco'
modVersion = '0.3.0'
modVersion = '0.4.0'
modLicense = 'BSD-3-Clause'
modGitHubRepo = 'teaconmc/XKDeco'
modAuthors = ['xekr (XeKr)', 'ustc-zzzz', 'LucunJi']
modDescription = 'XeKr\'s Decorations for Minecraft 1.19.'
modDescription = 'XeKr\'s Decorations for Minecraft 1.20.'

platform = 'forge-1.19.4-45.0.58'
platform = 'forge-1.20-46.0.1'
parchment = null

// uncomment these lines if you need
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions src/main/java/org/teacon/xkdeco/XKDeco.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.teacon.xkdeco.data.XKDecoEnUsLangProvider;
import org.teacon.xkdeco.entity.CushionEntity;
import org.teacon.xkdeco.init.XKDecoObjects;
import org.teacon.xkdeco.item.XKDecoCreativeModTab;

import javax.annotation.ParametersAreNonnullByDefault;

Expand All @@ -27,6 +28,7 @@ public XKDeco() {
XKDecoObjects.BLOCKS.register(modEventBus);
XKDecoObjects.ITEMS.register(modEventBus);
XKDecoObjects.BLOCK_ENTITY.register(modEventBus);
XKDecoCreativeModTab.TABS.register(modEventBus);

modEventBus.addListener(EventPriority.LOWEST, XKDecoObjects::addSpecialWallBlocks);
modEventBus.addListener(EventPriority.LOWEST, XKDecoObjects::addSpecialWallItems);
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/teacon/xkdeco/block/PlantSlabBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.SlabType;
import net.minecraft.world.level.lighting.LayerLightEngine;
import net.minecraft.world.level.lighting.LightEngine;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
Expand All @@ -21,7 +21,6 @@
import org.teacon.xkdeco.XKDeco;

import javax.annotation.ParametersAreNonnullByDefault;
import java.util.Random;

@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
Expand Down Expand Up @@ -75,7 +74,7 @@ public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
if (this.isPath && state.getValue(TYPE) != SlabType.BOTTOM) {
var aboveState = world.getBlockState(pos.above());
return !aboveState.getMaterial().isSolid() || aboveState.getBlock() instanceof FenceGateBlock;
return !aboveState.isSolid() || aboveState.getBlock() instanceof FenceGateBlock;
}
return true;
}
Expand Down Expand Up @@ -109,7 +108,8 @@ private static boolean canBeGrass(BlockState state, LevelReader world, BlockPos
var aboveState = world.getBlockState(abovePos);
if (!aboveState.is(Blocks.SNOW) || aboveState.getValue(SnowLayerBlock.LAYERS) != 1) {
if (aboveState.getFluidState().getAmount() != 8) {
return LayerLightEngine.getLightBlockInto(world, state, pos, aboveState, abovePos,
// TODO Check if this is the correct impl
return LightEngine.getLightBlockInto(world, state, pos, aboveState, abovePos,
Direction.UP, aboveState.getLightBlock(world, abovePos)) < world.getMaxLightLevel();
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public final class SpecialWardrobeBlock extends AbstractChestBlock<WardrobeBlock
public static final VoxelShape SHAPE_EAST_OPEN = Block.box(0, 0, 0, 15, 16, 16);

public SpecialWardrobeBlock(Properties pProperties) {
super(pProperties, WardrobeBlockEntity.TYPE::get);
super(pProperties.pushReaction(PushReaction.BLOCK), WardrobeBlockEntity.TYPE::get);
}

@SuppressWarnings("deprecation")
Expand Down Expand Up @@ -131,12 +131,6 @@ public BlockState updateShape(BlockState pState, Direction pFacing, BlockState p
}
}

@SuppressWarnings("deprecation")
@Override
public PushReaction getPistonPushReaction(BlockState pState) {
return PushReaction.BLOCK;
}

@Override
public DoubleBlockCombiner.NeighborCombineResult<? extends ChestBlockEntity> combine(BlockState pState, Level pLevel, BlockPos pPos, boolean pOverride) {
return DoubleBlockCombiner.Combiner::acceptNone;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/teacon/xkdeco/client/XKDecoClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static void addDebugText(CustomizeGuiOverlayEvent.DebugText event) {
var direction = ((BlockHitResult) block).getDirection();
var pos = ((BlockHitResult) block).getBlockPos();
if (Direction.Plane.HORIZONTAL.test(direction)) {
var state = cameraEntity.level.getBlockState(pos);
var state = cameraEntity.level().getBlockState(pos);
if (state.getBlock() instanceof XKDecoBlock.Roof roof) {
var sideHeight = roof.getSideHeight(state, direction);
event.getRight().add("Roof Side Height L: %d M: %d R: %d"
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/teacon/xkdeco/entity/CushionEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public CushionEntity(EntityType<CushionEntity> type, Level world) {
}

public CushionEntity(BlockPos pos, Player player) {
super(TYPE.get(), player.level);
super(TYPE.get(), player.level());
this.noPhysics = true;
this.setPos(pos.getX() + 0.5, pos.getY() + 0.375, pos.getZ() + 0.5);
this.setStandingDiffLocation(this.calculateStandingDiff(player));
Expand Down Expand Up @@ -106,14 +106,14 @@ public Packet<ClientGamePacketListener> getAddEntityPacket() {
public Vec3 getDismountLocationForPassenger(LivingEntity entity) {
var targetPosition = this.position().add(this.getStandingDiffLocation());
var targetBelow = new BlockPos((int) targetPosition.x, (int) (targetPosition.y - 1.0), (int) targetPosition.z);
var canStand = entity.level.getBlockState(targetBelow).isFaceSturdy(entity.level, targetBelow, Direction.UP);
var canStand = entity.level().getBlockState(targetBelow).isFaceSturdy(entity.level(), targetBelow, Direction.UP);
return canStand ? targetPosition : targetPosition.add(0.0, 1.0, 0.0);
}

@Override
public void tick() {
super.tick();
if (!this.level.isClientSide()) {
if (!this.level().isClientSide()) {
if (this.getPassengers().isEmpty() || !canBlockBeSeated(this.getBlockStateOn())) {
this.remove(RemovalReason.DISCARDED);
}
Expand Down
Loading

0 comments on commit a893985

Please sign in to comment.