Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.sforzando.btwce;
- public class BonusBasketFeature extends Feature<DefaultFeatureConfig> {
- public BonusBasketFeature (Codec<DefaultFeatureConfig> codec) {
- super (codec);
- }
- public boolean generate (FeatureContext<DefaultFeatureConfig> ctx) {
- RandomSource random = ctx.getRandom();
- StructureWorldAccess world = ctx.getWorld();
- ChunkPos chunk = new ChunkPos(ctx.origin());
- IntArrayList chunkXList = Util.toShuffledList(IntStream.rangeClosed(chunk.getMinBlockX(), chunk.getMaxBlockX()), random);
- IntArrayList chunkZList = Util.toShuffledList(IntStream.rangeClosed(chunk.getMinBlockZ(), chunk.getMaxBlockZ()), random);
- BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos();
- IntListIterator xIterator = chunkXList.iterator();
- while (xIterator.hasNext()) {
- Integer x = (Integer)xIterator.next();
- IntListIterator zIterator = zIterator.iterator();
- while (zIterator.hasNext()) {
- Integer z = (Integer)zIterator.next();
- pos.set(x, 0, z);
- BlockPos heightmapPos = world.getTopPosition(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, pos);
- if (world.isAir(heightmapPos) || world.getBlockState(pos).getCollisionShape(world, heightmapPos).isEmpty()) {
- world.setBlockState(heightmapPos, BTWBlocks.WICKER_BASKET.getDefaultState(), 2);
- if (world.getBlockEntity(heightmapPos) instanceof FCContainer fcc) fcc.add(new ItemStack(BTWItems.GOLDEN_DUNG));
- return true;
- }
- }
- }
- return false;
- }
- }
- public class BrickOvenRenderer implements BlockEntityRenderer<BrickOvenBlockEntity> {
- private final ItemRenderer item;
- public BrickOvenRenderer (ItemRenderer ir) {
- this.item = ir;
- }
- public void render (BrickOvenBlockEntity entity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
- matrices.push();
- Item held = entity.getItem();
- this.item.renderItem(
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement