Skip to content

Commit

Permalink
1.20 as 1.4.112
Browse files Browse the repository at this point in the history
  • Loading branch information
gnembon committed Jun 8, 2023
1 parent dee7a65 commit 53097bb
Show file tree
Hide file tree
Showing 16 changed files with 44 additions and 41 deletions.
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.19.4
yarn_mappings=1.19.4+build.1
loader_version=0.14.17
minecraft_version=1.20
yarn_mappings=1.20+build.1
loader_version=0.14.21
# check available versions on maven (https://masa.dy.fi/maven/carpet/fabric-carpet/) for the given minecraft version you are using
carpet_core_version=1.4.100+v230314
carpet_core_version=1.4.112+v230608

# Mod Properties
mod_version = 1.4.100
mod_version = 1.4.112
maven_group = carpet-extra
archives_base_name = carpet-extra

Expand All @@ -21,7 +21,7 @@ org.gradle.jvmargs=-Xmx1G
# The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5)
# This is needed because CF uses too vague names for prereleases and release candidates
# Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN]
release-curse-versions = Minecraft 1.19:1.19.4
release-curse-versions = Minecraft 1.20:1.20
# Whether or not to build another branch on release
release-extra-branch = false
# The name of the second branch to release
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/carpetextra/commands/PingCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static void register(CommandDispatcher<ServerCommandSource> dispatcher)
{
ServerPlayerEntity playerEntity = c.getSource().getPlayer();
int ping = playerEntity.pingMilliseconds;
c.getSource().sendFeedback(Text.literal("Your ping is: " + ping + " ms"), false);
c.getSource().sendFeedback(() -> Text.literal("Your ping is: " + ping + " ms"), false);
return 1;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private static ItemStack tryFeed(List<AnimalEntity> animals, ItemStack foodStack
// grow up baby animal slightly
animal.growUp((int)(-animal.getBreedingAge() / 200), true);
// spawn growth sparkle particle
animal.world.addParticle(ParticleTypes.HAPPY_VILLAGER, animal.getParticleX(1.0D), animal.getRandomBodyY() + 0.5D, animal.getParticleZ(1.0D), 0.0D, 0.0D, 0.0D);
animal.getWorld().addParticle(ParticleTypes.HAPPY_VILLAGER, animal.getParticleX(1.0D), animal.getRandomBodyY() + 0.5D, animal.getParticleZ(1.0D), 0.0D, 0.0D, 0.0D);

// eat item
return eatItem(animal, foodStack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import carpetextra.CarpetExtraSettings;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.passive.PassiveEntity;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -16,15 +18,15 @@ public abstract class AnimalEntity_dispenserMixin
@Shadow /*@Nullable*/ public abstract ServerPlayerEntity getLovingPlayer();

@Inject(
method = "breed",
method = "breed(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/entity/passive/AnimalEntity;Lnet/minecraft/entity/passive/PassiveEntity;)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/server/world/ServerWorld;spawnEntity(Lnet/minecraft/entity/Entity;)Z",
ordinal = 0
),
cancellable = true
)
protected void onSpawnExperience(ServerWorld serverWorld, AnimalEntity other, CallbackInfo ci) {
protected void onSpawnExperience(ServerWorld world, AnimalEntity other, PassiveEntity baby, CallbackInfo ci) {
ServerPlayerEntity serverPlayerEntity_1 = getLovingPlayer();
if (serverPlayerEntity_1 == null) {
serverPlayerEntity_1 = other.getLovingPlayer();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/carpetextra/mixins/ChickenEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public ActionResult interactMob(PlayerEntity playerEntity_1, Hand hand_1)
ItemStack stack = playerEntity_1.getStackInHand(hand_1);
if (CarpetExtraSettings.chickenShearing && stack.getItem() == Items.SHEARS && !this.isBaby())
{
boolean tookDamage = this.damage(playerEntity_1.world.getDamageSources().generic(), 1);
boolean tookDamage = this.damage(playerEntity_1.getWorld().getDamageSources().generic(), 1);
if (tookDamage)
{
this.dropItem(Items.FEATHER, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private void tryCraft(ServerWorld world, BlockPos pos, CallbackInfo ci)
if (!itemStack_3.isEmpty()) {
if (itemStack_2.isEmpty()) {
dispenserBlockEntity_1.setStack(int_1, itemStack_3);
} else if (itemStack_2.isItemEqual(itemStack_3) && ItemStack.areNbtEqual(itemStack_2, itemStack_3)) {
} else if (ItemStack.canCombine(itemStack_2, itemStack_3)) {
itemStack_3.increment(itemStack_2.getCount());
dispenserBlockEntity_1.setStack(int_1, itemStack_3);
} else {
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/carpetextra/mixins/FallingBlockEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private void onTick(CallbackInfo ci, Block block_1, BlockPos blockPos_2, boolean
{
if (CarpetExtraSettings.renewableIce)
{
Block below = this.world.getBlockState(BlockPos.ofFloored(this.getX(), this.getY() - 0.059999999776482582D, this.getZ())).getBlock();
Block below = this.getWorld().getBlockState(BlockPos.ofFloored(this.getX(), this.getY() - 0.059999999776482582D, this.getZ())).getBlock();
if (iceProgression.containsKey(below))
{
if (currentIce != below)
Expand All @@ -65,24 +65,24 @@ private void onTick(CallbackInfo ci, Block block_1, BlockPos blockPos_2, boolean
}
if (iceCount < 2)
{
world.breakBlock(blockPos_2.down(), false, null);
this.onGround = false;
getWorld().breakBlock(blockPos_2.down(), false, null);
this.setOnGround(false);
iceCount++;
ci.cancel();
}
else
{
BlockState newBlock = iceProgression.get(below).getDefaultState();
world.setBlockState(blockPos_2.down(), newBlock, 3);
world.syncWorldEvent(2001, blockPos_2.down(), Block.getRawIdFromState(newBlock));
getWorld().setBlockState(blockPos_2.down(), newBlock, 3);
getWorld().syncWorldEvent(2001, blockPos_2.down(), Block.getRawIdFromState(newBlock));
}
}
}

if (CarpetExtraSettings.renewableSand && this.world.getBlockState(BlockPos.ofFloored(this.getX(), this.getY() - 0.06, this.getZ())).getBlock() == Blocks.COBBLESTONE)
if (CarpetExtraSettings.renewableSand && this.getWorld().getBlockState(BlockPos.ofFloored(this.getX(), this.getY() - 0.06, this.getZ())).getBlock() == Blocks.COBBLESTONE)
{
world.breakBlock(blockPos_2.down(), false);
world.setBlockState(blockPos_2.down(), Blocks.SAND.getDefaultState(), 3);
getWorld().breakBlock(blockPos_2.down(), false);
getWorld().setBlockState(blockPos_2.down(), Blocks.SAND.getDefaultState(), 3);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private boolean operate(HopperMinecartEntity hopperMinecartEntity){
private static final Vec3d ascending_south_offset= new Vec3d( 0,1,-1).normalize().multiply(-1);

private Vec3d getBlockBelowCartOffset(){
BlockState blockState_1 = this.world.getBlockState(new BlockPos(MathHelper.floor(this.getX()), MathHelper.floor(this.getY()), MathHelper.floor(this.getZ())));
BlockState blockState_1 = this.getWorld().getBlockState(new BlockPos(MathHelper.floor(this.getX()), MathHelper.floor(this.getY()), MathHelper.floor(this.getZ())));
if (blockState_1.isIn(BlockTags.RAILS)) {
RailShape railShape = (RailShape)blockState_1.get(((AbstractRailBlock)blockState_1.getBlock()).getShapeProperty());
switch (railShape){
Expand All @@ -84,7 +84,7 @@ private Inventory getOutputInventory() {
Vec3d offsetToInventory = getBlockBelowCartOffset();
//The visual rotation point of the minecart is roughly 0.5 above its feet (determined visually ingame)
//Search 0.5 Blocks below the feet for an inventory
Inventory inv = HopperBlockEntity.getInventoryAt(this.world, BlockPos.ofFloored(this.getX() + offsetToInventory.x, this.getY() + 0.5 + offsetToInventory.y, this.getZ() + offsetToInventory.z));
Inventory inv = HopperBlockEntity.getInventoryAt(this.getWorld(), BlockPos.ofFloored(this.getX() + offsetToInventory.x, this.getY() + 0.5 + offsetToInventory.y, this.getZ() + offsetToInventory.z));

//There is probably a way nicer way to determine the access side of the target inventory
if(inv instanceof BlockEntity){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ public ItemFrameEntity_comparatorBetterItemFramesMixin(EntityType<? extends Item
@Inject(method = "setHeldItemStack(Lnet/minecraft/item/ItemStack;Z)V", at = @At(value = "INVOKE", target="Lnet/minecraft/world/World;updateComparators(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/Block;)V"), cancellable = true)
private void onStackChangeUpdateComparatorDownwards(ItemStack value, boolean update, CallbackInfo ci) {
if (CarpetExtraSettings.comparatorBetterItemFrames.id == 3) {
this.world.updateComparators(this.attachmentPos.offset(this.getHorizontalFacing().getOpposite()), Blocks.AIR);
this.getWorld().updateComparators(this.attachmentPos.offset(this.getHorizontalFacing().getOpposite()), Blocks.AIR);
}
}

@Inject(method = "setRotation(IZ)V", at = @At(value = "INVOKE", target="Lnet/minecraft/world/World;updateComparators(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/Block;)V"), cancellable = true)
private void onRotationUpdateComparatorDownwards(int value, boolean bl, CallbackInfo ci) {
if (CarpetExtraSettings.comparatorBetterItemFrames.id == 3) {
this.world.updateComparators(this.attachmentPos.offset(this.getHorizontalFacing().getOpposite()), Blocks.AIR);
this.getWorld().updateComparators(this.attachmentPos.offset(this.getHorizontalFacing().getOpposite()), Blocks.AIR);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private void giveClockPower(CallbackInfoReturnable<Integer> cir) {
if(CarpetExtraSettings.comparatorReadsClock && this.getHeldItemStack().getItem() == Items.CLOCK) {
int power;
//Every 1500 ticks, increase signal strength by one
power = (int)(this.world.getTimeOfDay() % 24000) / 1500;
power = (int)(this.getWorld().getTimeOfDay() % 24000) / 1500;
//in case negative time of day every happens, make comparator output the according positive value
if(power < 0)
power = power + 16;
Expand All @@ -43,10 +43,10 @@ public void tick() {
if(CarpetExtraSettings.comparatorReadsClock && this.getHeldItemStack().getItem() == Items.CLOCK) {
//This doesn't handle time set commands yet
//Every 1500 ticks, increase signal strength by one, so update comparators exactly then
if(this.world.getTimeOfDay() % 1500 == 0 || firstTick) {
if(this.getWorld().getTimeOfDay() % 1500 == 0 || firstTick) {
firstTick = false;
if(this.attachmentPos != null) {
this.world.updateComparators(this.attachmentPos, Blocks.AIR);
this.getWorld().updateComparators(this.attachmentPos, Blocks.AIR);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/carpetextra/mixins/LivingEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ private void convertSandToSoulsand(DamageSource damageSource_1, CallbackInfo ci)
return;

BlockPos pos = BlockPos.ofFloored(this.getX(), this.getY(), this.getZ());
BlockState statePos = this.world.getBlockState(pos);
BlockState statePos = this.getWorld().getBlockState(pos);

BlockPos below = pos.down(1);
BlockState stateBelow = this.world.getBlockState(below);
BlockState stateBelow = this.getWorld().getBlockState(below);

if (statePos.getBlock() == Blocks.FIRE && stateBelow.isIn(BlockTags.SAND))
{
this.world.setBlockState(below, Blocks.SOUL_SAND.getDefaultState());
this.getWorld().setBlockState(below, Blocks.SOUL_SAND.getDefaultState());
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/carpetextra/mixins/SkeletonEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ protected SkeletonEntityMixin(EntityType<? extends AbstractSkeletonEntity> type,
@Override
public void onStruckByLightning(ServerWorld serverWorld, LightningEntity lightningEntity)
{
if (!this.world.isClient && !this.isRemoved() && CarpetExtraSettings.renewableWitherSkeletons)
if (!this.getWorld().isClient && !this.isRemoved() && CarpetExtraSettings.renewableWitherSkeletons)
{
WitherSkeletonEntity witherSkelly = new WitherSkeletonEntity(EntityType.WITHER_SKELETON, this.world);
WitherSkeletonEntity witherSkelly = new WitherSkeletonEntity(EntityType.WITHER_SKELETON, this.getWorld());
witherSkelly.refreshPositionAndAngles(this.getX(), this.getY(), this.getZ(), this.getYaw(), this.getPitch()); // yaw pitch
witherSkelly.initialize(serverWorld, this.world.getLocalDifficulty(witherSkelly.getBlockPos()), SpawnReason.CONVERSION, null, null);
witherSkelly.initialize(serverWorld, this.getWorld().getLocalDifficulty(witherSkelly.getBlockPos()), SpawnReason.CONVERSION, null, null);
witherSkelly.setAiDisabled(this.isAiDisabled());

if (this.hasCustomName())
Expand All @@ -36,7 +36,7 @@ public void onStruckByLightning(ServerWorld serverWorld, LightningEntity lightni
witherSkelly.setCustomNameVisible(this.isCustomNameVisible());
}

this.world.spawnEntity(witherSkelly);
this.getWorld().spawnEntity(witherSkelly);

if (getVehicle() != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
import org.spongepowered.asm.mixin.injection.ModifyConstant;

@Mixin(SpongeBlock.class)
public abstract class AbsorbWaterMixin {
public abstract class SpongeBlockMixin {

@ModifyConstant(
method = "absorbWater",
constant = @Constant(intValue = 64)
constant = @Constant(intValue = 65)
)
private int onCheckBlockLimit(int blockLimit) {
return CarpetExtraSettings.maxSpongeSuck;
return CarpetExtraSettings.maxSpongeSuck + 1;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.sound.SoundCategory;
import net.minecraft.state.property.Properties;
Expand Down Expand Up @@ -125,7 +126,7 @@ public Direction[] getPlacementDirections() {

BlockState currentBlockState = world.getBlockState(pos);
FluidState currentFluidState = world.getFluidState(pos);
if ((currentBlockState.isAir() || currentBlockState.getMaterial().isReplaceable()) && currentBlockState.getBlock() != block && state.canPlaceAt(world, pos)) {
if ((currentBlockState.isAir() || currentBlockState.isIn(BlockTags.REPLACEABLE)) && currentBlockState.getBlock() != block && state.canPlaceAt(world, pos)) {
state = Block.postProcessState(state, world, pos);
boolean blockWasPlaced = world.setBlockState(pos, state);
block.onPlaced(world, pos, state, null, itemStack);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/carpet-extra.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"ThrownEntityMixin",
"BlockItemMixin_accurateBlockPlacement",
"HopperMinecartEntity_transferItemsOutFeatureMixin",
"AbsorbWaterMixin",
"SpongeBlockMixin",
"DropperBlock_craftingMixin",
"DispenserBlockEntity_craftingMixin",

Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

"depends": {
"fabricloader": ">=0.11.6",
"carpet": ">=1.4.84",
"minecraft": "1.19.4",
"carpet": ">=1.4.112",
"minecraft": "1.20",
"java": ">=17"
},
"custom": {
Expand Down

0 comments on commit 53097bb

Please sign in to comment.