Portal fixes
This commit is contained in:
parent
c2e3ef05fa
commit
6d809df962
6 changed files with 149 additions and 25 deletions
|
@ -0,0 +1,31 @@
|
|||
package ru.betterend.world.processors;
|
||||
|
||||
import net.minecraft.structure.Structure.StructureBlockInfo;
|
||||
import net.minecraft.structure.StructurePlacementData;
|
||||
import net.minecraft.structure.processor.StructureProcessor;
|
||||
import net.minecraft.structure.processor.StructureProcessorType;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.WorldView;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.util.MHelper;
|
||||
|
||||
public class DestructionStructureProcessor extends StructureProcessor {
|
||||
private int chance = 4;
|
||||
|
||||
public void setChance(int chance) {
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StructureBlockInfo process(WorldView worldView, BlockPos pos, BlockPos blockPos, StructureBlockInfo structureBlockInfo, StructureBlockInfo structureBlockInfo2, StructurePlacementData structurePlacementData) {
|
||||
if (!structureBlockInfo2.state.isOf(EndBlocks.ETERNAL_PEDESTAL) && !structureBlockInfo2.state.isOf(EndBlocks.FLAVOLITE_RUNED_ETERNAL) && MHelper.RANDOM.nextInt(chance) == 0) {
|
||||
return null;
|
||||
}
|
||||
return structureBlockInfo2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected StructureProcessorType<?> getType() {
|
||||
return StructureProcessorType.RULE;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package ru.betterend.world.processors;
|
||||
|
||||
import net.minecraft.structure.Structure.StructureBlockInfo;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.structure.StructurePlacementData;
|
||||
import net.minecraft.structure.processor.StructureProcessor;
|
||||
import net.minecraft.structure.processor.StructureProcessorType;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.WorldView;
|
||||
|
||||
public class TerrainStructureProcessor extends StructureProcessor {
|
||||
@Override
|
||||
public StructureBlockInfo process(WorldView worldView, BlockPos pos, BlockPos blockPos, StructureBlockInfo structureBlockInfo, StructureBlockInfo structureBlockInfo2, StructurePlacementData structurePlacementData) {
|
||||
BlockPos bpos = structureBlockInfo2.pos;
|
||||
if (structureBlockInfo2.state.isOf(Blocks.END_STONE) && worldView.isAir(bpos.up())) {
|
||||
BlockState top = worldView.getBiome(structureBlockInfo2.pos).getGenerationSettings().getSurfaceConfig().getTopMaterial();
|
||||
System.out.println(top);
|
||||
return new StructureBlockInfo(bpos, top, structureBlockInfo2.tag);
|
||||
}
|
||||
return structureBlockInfo2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected StructureProcessorType<?> getType() {
|
||||
return StructureProcessorType.RULE;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue