Skip to content

Commit

Permalink
1.19
Browse files Browse the repository at this point in the history
  • Loading branch information
gnembon committed Jun 7, 2022
1 parent 62943f1 commit 922a26d
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 27 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/use or https://modmuss50.me/fabric.html
minecraft_version=22w19a
yarn_mappings=22w19a+build.1
loader_version=0.14.5
minecraft_version=1.19
yarn_mappings=1.19+build.1
loader_version=0.14.6
# check available versions on maven for the given minecraft version you are using
carpet_core_version=1.4.75+v220513
carpet_core_version=1.4.79+v220607

# Mod Properties
mod_version = 1.4.75
mod_version = 1.4.79
maven_group = carpet-extra
archives_base_name = carpet-extra

Expand All @@ -22,7 +22,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-Snapshot
release-curse-versions = Minecraft 1.19:1.19
# Whether or not to build another branch on release
release-extra-branch = false
# The name of the second branch to release
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) {
ItemStack jukeboxItem = ((JukeboxBlockEntity) frontBlockEntity).getRecord();

// set record
((JukeboxBlock) frontBlock).setRecord(world, frontBlockPos, frontBlockState, stack);
((JukeboxBlock) frontBlock).setRecord(null, world, frontBlockPos, frontBlockState, stack);
// play music
world.syncWorldEvent(1010, frontBlockPos, Item.getRawId(stack.getItem()));

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/carpetextra/helpers/CustomSpawnLists.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
import net.minecraft.util.collection.Pool;
import net.minecraft.world.StructureSpawns;
import net.minecraft.world.biome.SpawnSettings;
import net.minecraft.world.gen.structure.StructureTypeKeys;
import net.minecraft.world.gen.structure.StructureKeys;

public class CustomSpawnLists
{
public static void addExtraSpawnRules()
{
SpawnOverrides.addOverride(() -> CarpetExtraSettings.straySpawningInIgloos, SpawnGroup.MONSTER, StructureTypeKeys.IGLOO,
SpawnOverrides.addOverride(() -> CarpetExtraSettings.straySpawningInIgloos, SpawnGroup.MONSTER, StructureKeys.IGLOO,
StructureSpawns.BoundingBox.STRUCTURE, Pool.of(new SpawnSettings.SpawnEntry(EntityType.STRAY, 1, 1, 1)));
SpawnOverrides.addOverride(() -> CarpetExtraSettings.creeperSpawningInJungleTemples, SpawnGroup.MONSTER, StructureTypeKeys.JUNGLE_PYRAMID,
SpawnOverrides.addOverride(() -> CarpetExtraSettings.creeperSpawningInJungleTemples, SpawnGroup.MONSTER, StructureKeys.JUNGLE_PYRAMID,
StructureSpawns.BoundingBox.STRUCTURE, Pool.of(new SpawnSettings.SpawnEntry(EntityType.CREEPER, 1, 1, 1)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import net.minecraft.block.Fertilizable;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.util.math.random.AbstractRandom;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(CactusBlock.class)
Expand All @@ -24,13 +24,13 @@ public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, b
}

@Override
public boolean canGrow(World world, AbstractRandom random, BlockPos pos, BlockState state)
public boolean canGrow(World world, Random random, BlockPos pos, BlockState state)
{
return true;
}

@Override
public void grow(ServerWorld world, AbstractRandom random, BlockPos pos, BlockState state)
public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state)
{
int i = this.countCactusAbove(world, pos);
BlockPos growPos = pos.up(i + 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.random.AbstractRandom;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand Down Expand Up @@ -43,12 +43,11 @@ private void createFallingBlockWithVelocity(World world, BlockPos pos, BlockStat
}

@Inject(
method = "scheduledTick(Lnet/minecraft/block/BlockState;Lnet/minecraft/server/world/ServerWorld;" +
"Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/random/AbstractRandom;)V",
method = "scheduledTick",
at = @At("HEAD"),
cancellable = true
)
public void onScheduledTick(BlockState state, ServerWorld world, BlockPos pos, AbstractRandom rand, CallbackInfo ci) {
public void onScheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random rand, CallbackInfo ci) {
if (CarpetExtraSettings.fallingBlockDispensers) {
Direction direction = state.get(DispenserBlock.FACING);
BlockPos facingPos = pos.offset(direction);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/carpetextra/mixins/FallingBlockMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import net.minecraft.entity.FallingBlockEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.random.AbstractRandom;
import net.minecraft.util.math.random.Random;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -34,7 +34,7 @@ public FallingBlockMixin(Settings block$Settings_1)

@SuppressWarnings("ConstantConditions")
@Inject(method = "scheduledTick", at = @At("HEAD"), cancellable = true)
private void onTryStartFalling(BlockState blockState_1, ServerWorld serverWorld_1, BlockPos blockPos_1, AbstractRandom random_1, CallbackInfo ci)
private void onTryStartFalling(BlockState state, ServerWorld serverWorld_1, BlockPos blockPos_1, Random random, CallbackInfo ci)
{
if (CarpetExtraSettings.dragonEggBedrockBreaking && (FallingBlock)(Object)this instanceof DragonEggBlock)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import net.minecraft.block.LilyPadBlock;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.util.math.random.AbstractRandom;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

Expand All @@ -23,13 +23,13 @@ public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, b
}

@Override
public boolean canGrow(World world, AbstractRandom random, BlockPos pos, BlockState state)
public boolean canGrow(World world, Random random, BlockPos pos, BlockState state)
{
return true;
}

@Override
public void grow(ServerWorld world, AbstractRandom random, BlockPos pos, BlockState state)
public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state)
{
if(!CarpetExtraSettings.betterBonemeal) return;
BlockState blockState = Blocks.LILY_PAD.getDefaultState();
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/carpetextra/mixins/StrayEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
import net.minecraft.entity.mob.StrayEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.ServerWorldAccess;
import net.minecraft.world.gen.structure.StructureTypes;
import net.minecraft.world.gen.structure.Structure;
import net.minecraft.world.gen.structure.StructureKeys;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -17,7 +19,11 @@ public abstract class StrayEntityMixin
@Redirect(method = "canSpawn", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/ServerWorldAccess;isSkyVisible(Lnet/minecraft/util/math/BlockPos;)Z"))
private static boolean isSkylightOrIglooVisible(ServerWorldAccess serverWorldAccess, BlockPos pos)
{
if (!CarpetExtraSettings.straySpawningInIgloos) {
return serverWorldAccess.isSkyVisible(pos);
}
Structure structure = serverWorldAccess.getRegistryManager().get(Registry.STRUCTURE_KEY).get(StructureKeys.IGLOO);
return serverWorldAccess.isSkyVisible(pos) ||
(CarpetExtraSettings.straySpawningInIgloos && (((ServerWorld)serverWorldAccess).getStructureAccessor().getStructureAt(pos, StructureTypes.IGLOO.value()).hasChildren()));
((ServerWorld)serverWorldAccess).getStructureAccessor().getStructureAt(pos,structure).hasChildren();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import net.minecraft.block.*;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.util.math.random.AbstractRandom;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(SugarCaneBlock.class)
Expand All @@ -21,13 +21,13 @@ public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, b
}

@Override
public boolean canGrow(World world, AbstractRandom random, BlockPos pos, BlockState state)
public boolean canGrow(World world, Random random, BlockPos pos, BlockState state)
{
return true;
}

@Override
public void grow(ServerWorld world, AbstractRandom random, BlockPos pos, BlockState state)
public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state)
{
int i = this.countSugarCaneAbove(world, pos);
world.setBlockState(pos.up(i + 1), Blocks.SUGAR_CANE.getDefaultState());
Expand Down

0 comments on commit 922a26d

Please sign in to comment.