Skip to content

Commit

Permalink
Update to v1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
FxMorin committed Jun 14, 2023
1 parent 399e4d1 commit ca617ac
Show file tree
Hide file tree
Showing 47 changed files with 96 additions and 347 deletions.
23 changes: 12 additions & 11 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@
org.gradle.jvmargs=-Xmx2G

# Fabric Properties
# check these on https://fabricmc.net/use or https://modmuss50.me/fabric.html
display_minecraft_version=1.19.4
minecraft_version=1.19.4
yarn_mappings=1.19.4+build.2
loader_version=0.14.3
carpet_minecraft_version=1.19.4
# check available versions on maven for the given minecraft version you are using
carpet_core_version=1.4.101+v230319
# check these on https://fabricmc.net/use or https://modmuss50.me/fabric.html
minecraft_version=1.20
display_minecraft_version=1.20
yarn_mappings=1.20+build.1
loader_version=0.14.3
carpet_minecraft_version=1.20
# check available versions on maven for the given minecraft version you are using
carpet_core_version=1.4.112+v230608


# Mod Properties
mod_version = 1.14.0
maven_group = carpet-fixes
archives_base_name = carpet-fixes
mod_version = 1.15.0
maven_group = carpet-fixes
archives_base_name = carpet-fixes


# Dependencies
Expand Down
29 changes: 3 additions & 26 deletions src/main/java/carpetfixes/CFSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import carpet.api.settings.Rule;
import carpetfixes.settings.Validators;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;

Expand All @@ -20,7 +21,7 @@ public class CFSettings {
public static boolean scheduleWorldBorderReset = false;
public static boolean useCustomRedstoneUpdates = false;
public static final ThreadLocal<Set<BlockPos>> LAST_DIRT = ThreadLocal.withInitial(HashSet::new);
public static final Predicate<BlockState> IS_REPLACEABLE = (state) -> state.getMaterial().isReplaceable();
public static final Predicate<BlockState> IS_REPLACEABLE = AbstractBlock.AbstractBlockState::isReplaceable;
public static final ThreadLocal<Boolean> IS_TICK_SAVE = ThreadLocal.withInitial(() -> false);

//By FX - PR0CESS
Expand Down Expand Up @@ -576,12 +577,6 @@ public class CFSettings {
)
public static boolean explosionsBypassWorldBorderFix = false;

//by FX - PR0CESS
@Rule(
categories = {BUGFIX}
)
public static boolean playerStepEventFix = false;

//by FX - PR0CESS
@Rule(
categories = {BUGFIX}
Expand Down Expand Up @@ -898,13 +893,7 @@ public class CFSettings {
@Rule(
categories = {BUGFIX}
)
public static boolean boatsCreatedTooHighFix = false;

//By FX - PR0CESS
@Rule(
categories = {BUGFIX}
)
public static boolean boatsStuckInDispensersFix = false;
public static boolean boatTooFarFromDispenserFix = false;

//By FX - PR0CESS
@Rule(
Expand Down Expand Up @@ -1122,24 +1111,12 @@ public class CFSettings {
)
public static boolean potionEffectsAffectDeadEntitiesFix = false;

//By FX - PR0CESS
@Rule(
categories = {BUGFIX}
)
public static boolean movableCoralFanFix = false;

//By FX - PR0CESS
@Rule(
categories = {BUGFIX}
)
public static boolean obsidianPlatformDestroysBlocksFix = false;

//By FX - PR0CESS
@Rule(
categories = {BUGFIX}
)
public static boolean grindstonesNotMovableFix = false;

//By FX - PR0CESS
@Rule(
categories = {BUGFIX, CLIENT}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/carpetfixes/helpers/CenterUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static void iterateTouchingBlocks(Entity entity, Consumer<BlockPos.Mutabl
Box box = entity.getBoundingBox();
BlockPos blockPos = BlockPos.ofFloored(box.minX + OFFSET, entity.getBlockY(), box.minZ + OFFSET);
BlockPos blockPos2 = BlockPos.ofFloored(box.maxX - OFFSET, entity.getBlockY(), box.maxZ - OFFSET);
if (entity.world.isRegionLoaded(blockPos, blockPos2)) {
if (entity.getWorld().isRegionLoaded(blockPos, blockPos2)) {
BlockPos.Mutable mutable = new BlockPos.Mutable();
for(int i = blockPos.getX(); i <= blockPos2.getX(); ++i)
for(int k = blockPos.getZ(); k <= blockPos2.getZ(); ++k)
Expand All @@ -32,14 +32,14 @@ public static void checkFallCollision(Entity entity, float fallDistance) {
Box box = entity.getBoundingBox();
BlockPos blockPos = BlockPos.ofFloored(box.minX + OFFSET, entity.getBlockY(), box.minZ + OFFSET);
BlockPos blockPos2 = BlockPos.ofFloored(box.maxX - OFFSET, entity.getBlockY(), box.maxZ - OFFSET);
if (entity.world.isRegionLoaded(blockPos, blockPos2)) {
if (entity.getWorld().isRegionLoaded(blockPos, blockPos2)) {
BlockPos.Mutable mutable = new BlockPos.Mutable();
boolean createdEvent = false;
for(int i = blockPos.getX(); i <= blockPos2.getX(); ++i) {
for(int k = blockPos.getZ(); k <= blockPos2.getZ(); ++k) {
mutable.set(i, blockPos.getY(), k);
BlockState state = entity.world.getBlockState(mutable);
state.getBlock().onLandedUpon(entity.world, state, mutable, entity, fallDistance);
BlockState state = entity.getWorld().getBlockState(mutable);
state.getBlock().onLandedUpon(entity.getWorld(), state, mutable, entity, fallDistance);
if (!createdEvent && !state.isAir() && !state.isIn(BlockTags.OCCLUDES_VIBRATION_SIGNALS)) {
entity.emitGameEvent(GameEvent.HIT_GROUND);
createdEvent = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public BeehiveBlockEntity_dupeMixin(BlockEntityType<?> type, BlockPos pos, Block
cancellable = true
)
private void tryEnterHiveIfLoaded(Entity entity, boolean hasNectar, int ticksInHive, CallbackInfo ci) {
if (CFSettings.beeDupeFix && !entity.world.isChunkLoaded(
if (CFSettings.beeDupeFix && !entity.getWorld().isChunkLoaded(
ChunkSectionPos.getSectionCoord(this.pos.getX()),
ChunkSectionPos.getSectionCoord(this.pos.getY())
)) ci.cancel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,14 @@
public class BoatDispenserBehavior_offsetMixin {


@ModifyConstant(
method = "dispenseSilently",
constant = @Constant(doubleValue = 1.0)
)
private double offsetLower(double constant) {
return CFSettings.boatsCreatedTooHighFix ? 0.5 : constant;
}


@ModifyConstant(
method = "dispenseSilently",
constant = @Constant(
floatValue = 1.125F,
doubleValue = 0.5625,
ordinal = 0
)
)
private float spawnFurtherX(float constant) {
return CFSettings.boatsStuckInDispensersFix ? 1.2F : constant;
}


@ModifyConstant(
method = "dispenseSilently",
constant = @Constant(
floatValue = 1.125F,
ordinal = 2
)
)
private float spawnFurtherZ(float constant) {
return CFSettings.boatsStuckInDispensersFix ? 1.2F : constant;
private double spawnFurther(double constant) {
return CFSettings.boatTooFarFromDispenserFix ? 0.50001 : constant;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
import carpetfixes.CFSettings;
import net.minecraft.block.BlockState;
import net.minecraft.block.CarvedPumpkinBlock;
import net.minecraft.block.pattern.CachedBlockPosition;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import java.util.function.Predicate;

/**
* Allows replaceable materials to be within the iron golem structure when the iron golem attempts to spawn.
*/
Expand All @@ -18,31 +15,25 @@ public abstract class CarvedPumpkinBlock_spawningMixin {


@Redirect(
method = "getIronGolemPattern()Lnet/minecraft/block/pattern/BlockPattern;",
method = "method_51167",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/pattern/CachedBlockPosition;" +
"matchesBlockState(Ljava/util/function/Predicate;)Ljava/util/function/Predicate;",
ordinal = 2
target = "Lnet/minecraft/block/BlockState;isAir()Z"
)
)
private Predicate<CachedBlockPosition> replaceableMaterialPredicate(Predicate<BlockState> state){
if (CFSettings.witherGolemSpawningFix) state = CFSettings.IS_REPLACEABLE;
return CachedBlockPosition.matchesBlockState(state);
private static boolean replaceableMaterialPredicate(BlockState state) {
return CFSettings.witherGolemSpawningFix ? state.isReplaceable() : state.isAir();
}


@Redirect(
method = "getIronGolemDispenserPattern()Lnet/minecraft/block/pattern/BlockPattern;",
method = "method_51168",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/pattern/CachedBlockPosition;" +
"matchesBlockState(Ljava/util/function/Predicate;)Ljava/util/function/Predicate;",
ordinal = 1
target = "Lnet/minecraft/block/BlockState;isAir()Z"
)
)
private Predicate<CachedBlockPosition> replaceableMaterialPredicateDispenser(Predicate<BlockState> state){
if (CFSettings.witherGolemSpawningFix) state = CFSettings.IS_REPLACEABLE;
return CachedBlockPosition.matchesBlockState(state);
private static boolean replaceableMaterialPredicateDispenser(BlockState state) {
return CFSettings.witherGolemSpawningFix ? state.isReplaceable() : state.isAir();
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.RedstoneView;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
Expand Down Expand Up @@ -42,7 +43,7 @@ protected PistonBlock_headlessMixin(Settings settings) {

@Shadow
@Final
private boolean shouldExtend(World world, BlockPos pos, Direction pistonFace) {
private boolean shouldExtend(RedstoneView world, BlockPos pos, Direction pistonFace) {
return true;
}

Expand All @@ -52,7 +53,7 @@ private boolean shouldExtend(World world, BlockPos pos, Direction pistonFace) {
"Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)V",
at = @At(
value = "INVOKE_ASSIGN",
target = "Lnet/minecraft/block/PistonBlock;shouldExtend(Lnet/minecraft/world/World;" +
target = "Lnet/minecraft/block/PistonBlock;shouldExtend(Lnet/minecraft/world/RedstoneView;" +
"Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;)Z",
shift = At.Shift.AFTER
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private BlockState powderSnowNotJustFeet(Entity entity) {
if (CFSettings.entityBlockCollisionUsingCenterFix && entity instanceof PlayerEntity)
return Blocks.POWDER_SNOW.getDefaultState();
if (CFSettings.powderSnowOnlySlowIfFeetInBlockFix && entity instanceof PlayerEntity) {
BlockState stateAbove = entity.world.getBlockState(entity.getBlockPos().up());
BlockState stateAbove = entity.getWorld().getBlockState(entity.getBlockPos().up());
if (stateAbove.isOf(Blocks.POWDER_SNOW)) return stateAbove;
}
return entity.getBlockStateAtPos();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
import carpetfixes.CFSettings;
import net.minecraft.block.BlockState;
import net.minecraft.block.WitherSkullBlock;
import net.minecraft.block.pattern.CachedBlockPosition;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import java.util.function.Predicate;

/**
* Allows replaceable materials to be within the wither structure when the wither is spawning
*/
Expand All @@ -19,30 +16,25 @@ public class WitherSkullBlock_spawningMixin {


@Redirect(
method = "getWitherBossPattern()Lnet/minecraft/block/pattern/BlockPattern;",
method = "method_51174",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/pattern/CachedBlockPosition;" +
"matchesBlockState(Ljava/util/function/Predicate;)Ljava/util/function/Predicate;",
ordinal = 1
target = "Lnet/minecraft/block/BlockState;isAir()Z"
)
)
private static Predicate<CachedBlockPosition> replaceableMaterialPredicate(Predicate<BlockState> state) {
if (CFSettings.witherGolemSpawningFix) state = CFSettings.IS_REPLACEABLE;
return CachedBlockPosition.matchesBlockState(state);
private static boolean replaceableMaterialPredicate(BlockState state) {
return CFSettings.witherGolemSpawningFix ? state.isReplaceable() : state.isAir();
}


@Redirect(
method = "getWitherDispenserPattern()Lnet/minecraft/block/pattern/BlockPattern;",
method = "method_51175",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/pattern/CachedBlockPosition;" +
"matchesBlockState(Ljava/util/function/Predicate;)Ljava/util/function/Predicate;"
target = "Lnet/minecraft/block/BlockState;isAir()Z"
)
)
private static Predicate<CachedBlockPosition> replaceableMaterialPredicateDispenser(Predicate<BlockState> state) {
if (CFSettings.witherGolemSpawningFix) state = CFSettings.IS_REPLACEABLE;
return CachedBlockPosition.matchesBlockState(state);
private static boolean replaceableMaterialPredicateDispenser(BlockState state) {
return CFSettings.witherGolemSpawningFix ? state.isReplaceable() : state.isAir();
}
}

This file was deleted.

This file was deleted.

Loading

0 comments on commit ca617ac

Please sign in to comment.