Skip to content

Commit

Permalink
biomes + mixin fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MBatt1 committed Aug 12, 2024
1 parent fca4845 commit 767102b
Show file tree
Hide file tree
Showing 40 changed files with 1,752 additions and 934 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ customportalapiVersion=0.0.1-beta63.5-1.19.X
cardinalComponentsVersion=5.0.1
trinketsVersion=3.4.0
crowdinTranslateVersion=1.19.4
entityAttributesVersion=2.3.0
entityAttributesVersion=2.3.2
modmenuVersion=4.0.6
reiVersion=9.1.530
moreTagsVersion=3.0.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.id.paradiselost.world.feature.placed_features.ParadiseLostVegetationPlacedFeatures;
import net.minecraft.block.BlockState;
import net.minecraft.block.Fertilizable;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
Expand Down Expand Up @@ -36,6 +37,7 @@ public boolean canGrow(World world, Random random, BlockPos pos, BlockState stat
public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) {
BlockPos blockPos = pos.up();
BlockState blockState = ParadiseLostBlocks.GRASS.getDefaultState();

block0: for (int i = 0; i < 128; ++i) {
RegistryEntry<PlacedFeature> placedFeature;
BlockPos blockPos2 = blockPos;
Expand Down Expand Up @@ -63,11 +65,11 @@ public void grow(ServerWorld world, Random random, BlockPos pos, BlockState stat
if (list.isEmpty()) {
continue;
}
placedFeature = ((RandomPatchFeatureConfig) list.get(0).config()).feature();
placedFeature = ((RandomPatchFeatureConfig)((ConfiguredFeature)list.get(0)).config()).feature();
} else {
placedFeature = ParadiseLostVegetationPlacedFeatures.GRASS;
placedFeature = world.getRegistryManager().get(RegistryKeys.PLACED_FEATURE).getEntry(ParadiseLostVegetationPlacedFeatures.GRASS).get();
}
placedFeature.value().generateUnregistered(world, world.getChunkManager().getChunkGenerator(), random, blockPos2);
(placedFeature.value()).generateUnregistered(world, world.getChunkManager().getChunkGenerator(), random, blockPos2);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,28 @@
import net.id.paradiselost.blocks.ParadiseLostBlocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.FarmlandBlock;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.event.GameEvent;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import static net.minecraft.block.Block.pushEntitiesUpBeforeBlockChange;

@Mixin(FarmlandBlock.class)
public class FarmlandBlockMixin {
@Inject(method = "setToDirt", at = @At("HEAD"), cancellable = true)
private static void onSetToDirt(BlockState state, World world, BlockPos pos, CallbackInfo ci) {
private static void onSetToDirt(@Nullable Entity entity, BlockState state, World world, BlockPos pos, CallbackInfo ci) {
if (state.isOf(ParadiseLostBlocks.FARMLAND)) {
world.setBlockState(pos, Block.pushEntitiesUpBeforeBlockChange(state, ParadiseLostBlocks.DIRT.getDefaultState(), world, pos));
BlockState blockState = pushEntitiesUpBeforeBlockChange(state, Blocks.DIRT.getDefaultState(), world, pos);
world.setBlockState(pos, blockState);
world.emitGameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Emitter.of(entity, blockState));
ci.cancel();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
@Mixin(BoatEntity.class)
public abstract class BoatEntityMixin {
@Shadow
public abstract BoatEntity.Type getBoatType();
public abstract BoatEntity.Type getVariant();

@Inject(method = "asItem", at = @At(value = "FIELD", target = "Lnet/minecraft/item/Items;OAK_BOAT:Lnet/minecraft/item/Item;", opcode = Opcodes.GETSTATIC), cancellable = true)
private void checkCustomBoats(CallbackInfoReturnable<Item> cir) {
BoatEntity.Type type = this.getBoatType();
BoatEntity.Type type = this.getVariant();
if (type != BoatEntity.Type.OAK) {
for (var entry : ParadiseLostItems.BOAT_SETS) {
if (type == entry.type()) {
Expand Down

This file was deleted.

Loading

0 comments on commit 767102b

Please sign in to comment.