This commit is contained in:
Lazzzycatwastaken 2025-06-30 17:38:36 +02:00
parent 14377708be
commit 43f38d8679
4 changed files with 30 additions and 17 deletions

View File

@ -1,6 +1,7 @@
package com.hbm.blocks.machine;
import com.hbm.tileentity.machine.TileEntityCharger;
import com.hbm.world.gen.INBTTransformable;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@ -12,8 +13,8 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class Charger extends BlockContainer {
public class Charger extends BlockContainer implements INBTTransformable {
public Charger(Material mat) {
super(mat);
}
@ -22,17 +23,17 @@ public class Charger extends BlockContainer {
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityCharger();
}
@Override
public int getRenderType(){
return -1;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
@ -40,9 +41,9 @@ public class Charger extends BlockContainer {
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
if(i == 0) {
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
}
@ -60,13 +61,13 @@ public class Charger extends BlockContainer {
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
float f = 0.0625F;
switch(world.getBlockMetadata(x, y, z)) {
case 2: this.setBlockBounds(5 * f, 0.25F, 12 * f, 11 * f, 0.75F, 1F); break;
case 3: this.setBlockBounds(5 * f, 0.25F, 0F, 11 * f, 0.75F, 4 * f); break;
case 4: this.setBlockBounds(12 * f, 0.25F, 5 * f, 1F, 0.75F, 11 * f); break;
case 5: this.setBlockBounds(0F, 0.25F, 5 * f, 4 * f, 0.75F, 11 * f); break;
default: this.setBlockBounds(5 * f, 0.25F, 5 * f, 11 * f, 0.75F, 11 * f); break;
case 2: this.setBlockBounds(5 * f, 0.25F, 12 * f, 11 * f, 0.75F, 1F); break;
case 3: this.setBlockBounds(5 * f, 0.25F, 0F, 11 * f, 0.75F, 4 * f); break;
case 4: this.setBlockBounds(12 * f, 0.25F, 5 * f, 1F, 0.75F, 11 * f); break;
case 5: this.setBlockBounds(0F, 0.25F, 5 * f, 4 * f, 0.75F, 11 * f); break;
default: this.setBlockBounds(5 * f, 0.25F, 5 * f, 11 * f, 0.75F, 11 * f); break;
}
}
@ -75,4 +76,9 @@ public class Charger extends BlockContainer {
this.setBlockBoundsBasedOnState(world, x, y, z);
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
}
@Override
public int transformMeta(int meta, int coordBaseMode) {
return INBTTransformable.transformMetaDeco(meta, coordBaseMode);
}
}

View File

@ -61,6 +61,7 @@ public class StructureManager {
public static final NBTStructure beached_patrol = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/beached_patrol.nbt"));
public static final NBTStructure lighthouse = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/lighthouse.nbt"));
public static final NBTStructure dish = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/dish.nbt"));
public static final NBTStructure laboratory = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/laboratory.nbt"));
public static final NBTStructure spire = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/spire.nbt"));

View File

@ -46,7 +46,7 @@ public class NTMWorldGenerator implements IWorldGenerator {
structure = new JigsawPiece("spire", StructureManager.spire, -1);
spawnWeight = 2;
}});
NBTStructure.registerStructure(0, new SpawnCondition() {{
canSpawn = biome -> !invalidBiomes.contains(biome);
start = d -> new MapGenNTMFeatures.Start(d.getW(), d.getX(), d.getY(), d.getZ());
@ -102,8 +102,6 @@ public class NTMWorldGenerator implements IWorldGenerator {
spawnWeight = 8;
}});
NBTStructure.registerNullWeight(0, 2, oceanBiomes::contains); //why the fuck did this change
NBTStructure.registerStructure(0, new SpawnCondition() {{
canSpawn = biome -> biome == BiomeGenBase.plains;
structure = new JigsawPiece("dish", StructureManager.dish, -10);
@ -112,8 +110,16 @@ public class NTMWorldGenerator implements IWorldGenerator {
spawnWeight = 1;
}});
NBTStructure.registerStructure(0, new SpawnCondition() {{
canSpawn = biome -> biome == BiomeGenBase.plains;
structure = new JigsawPiece("laboratory", StructureManager.laboratory, -10);
minHeight = 53;
maxHeight = 65;
spawnWeight = 8;
}});
NBTStructure.registerNullWeight(0, 2, biome -> biome == BiomeGenBase.plains);
NBTStructure.registerNullWeight(0, 2, oceanBiomes::contains);
NBTStructure.registerNullWeight(0, 4, oceanBiomes::contains);
Map<Block, BlockSelector> bricks = new HashMap<Block, BlockSelector>() {{
put(ModBlocks.meteor_brick, new MeteorBricks());