First Working Worldgen of Meteorites
This commit is contained in:
@@ -21,6 +21,12 @@ package appeng.worldgen.meteorite;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import alexiil.mc.lib.attributes.AttributeList;
|
||||
import alexiil.mc.lib.attributes.AttributeProvider;
|
||||
import alexiil.mc.lib.attributes.AttributeUtil;
|
||||
import alexiil.mc.lib.attributes.item.ItemAttributes;
|
||||
import appeng.tile.storage.SkyChestBlockEntity;
|
||||
import appeng.util.inv.AdaptorFixedInv;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
@@ -203,8 +209,12 @@ public final class MeteoritePlacer {
|
||||
if (AEConfig.instance().isFeatureEnabled(AEFeature.SPAWN_PRESSES_IN_METEORITES)) {
|
||||
this.putter.put(world, pos, this.skyChestDefinition.block().getDefaultState());
|
||||
|
||||
final BlockEntity te = world.getBlockEntity(pos); // FIXME: this is also probably a band-aid for another issue
|
||||
final InventoryAdaptor ap = InventoryAdaptor.getAdaptor(te, Direction.UP);
|
||||
final SkyChestBlockEntity te = (SkyChestBlockEntity) world.getBlockEntity(pos);
|
||||
InventoryAdaptor ap = null;
|
||||
if (te != null) {
|
||||
ap = new AdaptorFixedInv(te.getInternalInventory());
|
||||
}
|
||||
|
||||
if (ap != null && !ap.containsItems()) // FIXME: band-aid for meteorites being generated multiple times
|
||||
{
|
||||
// TODO: loot tables would be better
|
||||
|
||||
@@ -23,18 +23,9 @@ public class MeteoriteStructure extends StructureFeature<DefaultFeatureConfig> {
|
||||
|
||||
@Override
|
||||
public boolean shouldStartAt(ChunkGenerator generator, BiomeSource biomeSource, long seed, ChunkRandom randIn, int chunkX, int chunkZ, Biome biome, ChunkPos chunkPos2, DefaultFeatureConfig featureConfig) {
|
||||
int i = chunkX >> 4;
|
||||
int j = chunkZ >> 4;
|
||||
randIn.setSeed((long) (i ^ j << 4) ^ seed);
|
||||
randIn.nextInt();
|
||||
return randIn.nextBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return ID.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public StructureStartFactory<DefaultFeatureConfig> getStructureStartFactory() {
|
||||
return MeteoriteStructureStart::new;
|
||||
|
||||
@@ -71,7 +71,7 @@ public final class PlacedMeteoriteSettings {
|
||||
}
|
||||
|
||||
public CompoundTag write(CompoundTag tag) {
|
||||
tag.putLong(Constants.TAG_POS, pos.toLong());
|
||||
tag.putLong(Constants.TAG_POS, pos.asLong());
|
||||
|
||||
tag.putFloat(Constants.TAG_RADIUS, meteoriteRadius);
|
||||
tag.putByte(Constants.TAG_CRATER, (byte) craterType.ordinal());
|
||||
|
||||
Reference in New Issue
Block a user