Fixes, compression
This commit is contained in:
parent
d4f56b152e
commit
77457bf976
28 changed files with 108 additions and 53 deletions
|
@ -0,0 +1,23 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
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.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.ChorusFlowerBlock;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.WorldView;
|
||||
import ru.betterend.registry.BlockRegistry;
|
||||
|
||||
@Mixin(ChorusFlowerBlock.class)
|
||||
public class ChorusFlowerBlockMixin {
|
||||
@Inject(method = "canPlaceAt", at = @At("HEAD"), cancellable = true)
|
||||
private void canPlace(BlockState state, WorldView world, BlockPos pos, CallbackInfoReturnable<Boolean> info) {
|
||||
if (world.getBlockState(pos.down()).isOf(BlockRegistry.CHORUS_NYLIUM)) {
|
||||
info.setReturnValue(true);
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
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.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.ChorusPlantBlock;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.WorldView;
|
||||
import ru.betterend.registry.BlockRegistry;
|
||||
|
||||
@Mixin(ChorusPlantBlock.class)
|
||||
public class ChorusPlantBlockMixin {
|
||||
@Inject(method = "canPlaceAt", at = @At("HEAD"), cancellable = true)
|
||||
private void canPlace(BlockState state, WorldView world, BlockPos pos, CallbackInfoReturnable<Boolean> info) {
|
||||
if (world.getBlockState(pos.down()).isOf(BlockRegistry.CHORUS_NYLIUM)) {
|
||||
info.setReturnValue(true);
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
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.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.block.ChorusFlowerBlock;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.ChorusPlantFeature;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import ru.betterend.registry.BlockRegistry;
|
||||
import ru.betterend.util.MHelper;
|
||||
|
||||
@Mixin(ChorusPlantFeature.class)
|
||||
public class ChorusPlantFeatureMixin {
|
||||
@Inject(method = "generate", at = @At("HEAD"), cancellable = true)
|
||||
private void onGenerate(StructureWorldAccess structureWorldAccess, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, DefaultFeatureConfig defaultFeatureConfig, CallbackInfoReturnable<Boolean> info) {
|
||||
if (structureWorldAccess.isAir(blockPos) && structureWorldAccess.getBlockState(blockPos.down()).isOf(BlockRegistry.CHORUS_NYLIUM)) {
|
||||
ChorusFlowerBlock.generate(structureWorldAccess, blockPos, random, MHelper.randRange(8, 16, random));
|
||||
info.setReturnValue(true);
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
|
||||
@Mixin(ChunkGenerator.class)
|
||||
public class ChunkGeneratorMixin {
|
||||
/*@Inject(method = "generateFeatures", at = @At("HEAD"))
|
||||
private void fixerPass(ChunkRegion region, StructureAccessor accessor, CallbackInfo info) {
|
||||
int chunkX = region.getCenterChunkX();
|
||||
int chunkZ = region.getCenterChunkZ();
|
||||
BlockPos start = new BlockPos(chunkX << 4, 16, chunkZ << 4);
|
||||
DefaultBiomeFeatures.MOUNTAINS.getFeature()
|
||||
}*/
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue