glyphid hives

This commit is contained in:
Bob 2023-06-17 22:55:05 +02:00
parent 5411e3fa3f
commit febeafe459
14 changed files with 313 additions and 2 deletions

View File

@ -495,11 +495,13 @@ public class ModBlocks {
public static Block glass_ash;
public static Block glass_quartz;
public static Block mush;
public static Block mush_block;
public static Block mush_block_stem;
public static Block glyphid_base;
public static Block glyphid_spawner;
public static Block plant_flower;
public static Block plant_tall;
public static Block plant_dead;
@ -1695,6 +1697,8 @@ public class ModBlocks {
mush = new BlockMush(Material.plants).setBlockName("mush").setCreativeTab(MainRegistry.blockTab).setLightLevel(0.5F).setStepSound(Block.soundTypeGrass).setBlockTextureName(RefStrings.MODID + ":mush");
mush_block = new BlockMushHuge(Material.plants).setBlockName("mush_block").setLightLevel(1.0F).setStepSound(Block.soundTypeGrass).setHardness(0.2F).setBlockTextureName(RefStrings.MODID + ":mush_block_skin");
mush_block_stem = new BlockMushHuge(Material.plants).setBlockName("mush_block_stem").setLightLevel(1.0F).setStepSound(Block.soundTypeGrass).setHardness(0.2F).setBlockTextureName(RefStrings.MODID + ":mush_block_stem");
glyphid_base = new BlockBase(Material.coral).setBlockName("glyphid_base").setStepSound(Block.soundTypeCloth).setHardness(0.5F);
glyphid_spawner = new BlockGlyphidSpawner(Material.coral).setBlockName("glyphid_spawner").setStepSound(Block.soundTypeCloth).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":glyphid_base");
plant_flower = new BlockNTMFlower().setBlockName("plant_flower").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeGrass).setHardness(0.0F);
plant_tall = new BlockTallPlant().setBlockName("plant_tall").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeGrass).setHardness(0.0F);
@ -2836,6 +2840,8 @@ public class ModBlocks {
GameRegistry.registerBlock(mush, mush.getUnlocalizedName());
GameRegistry.registerBlock(mush_block, mush_block.getUnlocalizedName());
GameRegistry.registerBlock(mush_block_stem, mush_block_stem.getUnlocalizedName());
GameRegistry.registerBlock(glyphid_base, glyphid_base.getUnlocalizedName());
GameRegistry.registerBlock(glyphid_spawner, glyphid_spawner.getUnlocalizedName());
GameRegistry.registerBlock(moon_turf, moon_turf.getUnlocalizedName());
//Waste

View File

@ -0,0 +1,49 @@
package com.hbm.blocks.generic;
import java.util.List;
import com.hbm.entity.mob.EntityGlyphid;
import com.hbm.entity.mob.EntityGlyphidScout;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World;
public class BlockGlyphidSpawner extends BlockContainer {
public BlockGlyphidSpawner(Material p_i45386_1_) {
super(p_i45386_1_);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityGlpyhidSpawner();
}
public static class TileEntityGlpyhidSpawner extends TileEntity {
@Override
public void updateEntity() {
if(!worldObj.isRemote && worldObj.getTotalWorldTime() % 60 == 0 && this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL) {
List<EntityGlyphid> list = worldObj.getEntitiesWithinAABB(EntityGlyphid.class, AxisAlignedBB.getBoundingBox(xCoord - 4, yCoord + 1, zCoord - 4, xCoord + 5, yCoord + 4, zCoord + 5));
if(list.size() < 3) {
EntityGlyphid glyphid = new EntityGlyphid(worldObj);
glyphid.setLocationAndAngles(xCoord + 0.5, yCoord + 1, zCoord + 0.5, worldObj.rand.nextFloat() * 360.0F, 0.0F);
this.worldObj.spawnEntityInWorld(glyphid);
}
if(worldObj.rand.nextInt(20) == 0) {
EntityGlyphidScout scout = new EntityGlyphidScout(worldObj);
scout.setLocationAndAngles(xCoord + 0.5, yCoord + 1, zCoord + 0.5, worldObj.rand.nextFloat() * 360.0F, 0.0F);
this.worldObj.spawnEntityInWorld(scout);
}
}
}
}
}

View File

@ -245,6 +245,7 @@ public class EntityMappings {
addMob(EntityGlyphidBrenda.class, "entity_glyphid_brenda", 0x4FC0C0, 0xA0A0A0);
addMob(EntityGlyphidBombardier.class, "entity_glyphid_bombardier", 0xDDD919, 0xDBB79D);
addMob(EntityGlyphidBlaster.class, "entity_glyphid_blaster", 0xD83737, 0xDBB79D);
addMob(EntityGlyphidScout.class, "entity_glyphid_scout", 0x273038, 0xB9E36B);
addSpawn(EntityCreeperPhosgene.class, 5, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray());
addSpawn(EntityCreeperVolatile.class, 10, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray());

View File

@ -19,6 +19,7 @@ import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.DamageSource;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
@ -197,4 +198,16 @@ public class EntityGlyphid extends EntityMob {
public EnumCreatureAttribute getCreatureAttribute() {
return EnumCreatureAttribute.ARTHROPOD;
}
@Override
public void writeEntityToNBT(NBTTagCompound nbt) {
super.writeEntityToNBT(nbt);
nbt.setByte("armor", this.dataWatcher.getWatchableObjectByte(17));
}
@Override
public void readEntityFromNBT(NBTTagCompound nbt) {
super.readEntityFromNBT(nbt);
this.dataWatcher.updateObject(17, nbt.getByte("armor"));
}
}

View File

@ -12,7 +12,7 @@ public class EntityGlyphidBrenda extends EntityGlyphid {
public EntityGlyphidBrenda(World world) {
super(world);
this.setSize(2.5F, 2F);
this.setSize(2.5F, 1.75F);
this.isImmuneToFire = true;
}

View File

@ -0,0 +1,102 @@
package com.hbm.entity.mob;
import com.hbm.blocks.ModBlocks;
import com.hbm.main.ResourceManager;
import com.hbm.world.feature.GlyphidHive;
import net.minecraft.block.Block;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public class EntityGlyphidScout extends EntityGlyphid {
public boolean hasHome = false;
public double homeX;
public double homeY;
public double homeZ;
public EntityGlyphidScout(World world) {
super(world);
this.setSize(1.25F, 0.75F);
}
@Override
public float getDamageThreshold() {
return 0.0F;
}
@Override
public ResourceLocation getSkin() {
return ResourceManager.glyphid_scout_tex;
}
@Override
public double getScale() {
return 0.75D;
}
@Override
public int getArmorBreakChance(float amount) {
return 1;
}
@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(16D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.5D);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2D);
}
@Override
protected boolean canDespawn() {
return true;
}
@Override
public void onUpdate() {
super.onUpdate();
if(!worldObj.isRemote) {
if(!this.hasHome) {
this.homeX = posX;
this.homeY = posY;
this.homeZ = posZ;
this.hasHome = true;
}
if(this.ticksExisted > 0 && this.ticksExisted % 1200 == 0 && Vec3.createVectorHelper(posX - homeX, posY - homeY, posZ - homeZ).lengthVector() > 16) {
Block b = worldObj.getBlock((int) Math.floor(posX), (int) Math.floor(posY - 1), (int) Math.floor(posZ));
if(b.isNormalCube() && b != ModBlocks.glyphid_base) {
this.setDead();
worldObj.newExplosion(this, posX, posY, posZ, 5F, false, false);
GlyphidHive.generate(worldObj, (int) Math.floor(posX), (int) Math.floor(posY), (int) Math.floor(posZ), rand);
}
}
}
}
@Override
public void writeEntityToNBT(NBTTagCompound nbt) {
super.writeEntityToNBT(nbt);
nbt.setBoolean("hasHome", hasHome);
nbt.setDouble("homeX", homeX);
nbt.setDouble("homeY", homeY);
nbt.setDouble("homeZ", homeZ);
}
@Override
public void readEntityFromNBT(NBTTagCompound nbt) {
super.readEntityFromNBT(nbt);
this.hasHome = nbt.getBoolean("hasHome");
this.homeX = nbt.getDouble("homeX");
this.homeY = nbt.getDouble("homeY");
this.homeZ = nbt.getDouble("homeZ");
}
}

View File

@ -34,6 +34,7 @@ import com.hbm.world.feature.DepthDeposit;
import com.hbm.world.feature.Dud;
import com.hbm.world.feature.Geyser;
import com.hbm.world.feature.GeyserLarge;
import com.hbm.world.feature.GlyphidHive;
import com.hbm.world.feature.Meteorite;
import com.hbm.world.feature.OilBubble;
import com.hbm.world.feature.OilSandBubble;
@ -216,6 +217,13 @@ public class HbmWorldGen implements IWorldGenerator {
}
if(GeneralConfig.enableDungeons && world.provider.isSurfaceWorld()) {
if(rand.nextInt(1000) == 0) {
int x = i + rand.nextInt(16) + 8;
int z = j + rand.nextInt(16) + 8;
int y = world.getHeightValue(x, z);
GlyphidHive.generate(world, x, y, z, rand);
}
if(biome == BiomeGenBase.plains || biome == BiomeGenBase.desert) {
if(WorldConfig.radioStructure > 0 && rand.nextInt(WorldConfig.radioStructure) == 0) {

View File

@ -729,6 +729,7 @@ public class ClientProxy extends ServerProxy {
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBrenda.class, new RenderGlyphid());
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBombardier.class, new RenderGlyphid());
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBlaster.class, new RenderGlyphid());
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidScout.class, new RenderGlyphid());
//"particles"
RenderingRegistry.registerEntityRenderingHandler(EntitySmokeFX.class, new MultiCloudRenderer(new Item[] { ModItems.smoke1, ModItems.smoke2, ModItems.smoke3, ModItems.smoke4, ModItems.smoke5, ModItems.smoke6, ModItems.smoke7, ModItems.smoke8 }));
RenderingRegistry.registerEntityRenderingHandler(EntityBSmokeFX.class, new MultiCloudRenderer(new Item[] { ModItems.b_smoke1, ModItems.b_smoke2, ModItems.b_smoke3, ModItems.b_smoke4, ModItems.b_smoke5, ModItems.b_smoke6, ModItems.b_smoke7, ModItems.b_smoke8 }));

View File

@ -665,6 +665,7 @@ public class ResourceManager {
public static final ResourceLocation glyphid_brenda_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_brenda.png");
public static final ResourceLocation glyphid_bombardier_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_bombardier.png");
public static final ResourceLocation glyphid_blaster_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_blaster.png");
public static final ResourceLocation glyphid_scout_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_scout.png");
//ZIRNOX
public static final ResourceLocation zirnox_tex = new ResourceLocation(RefStrings.MODID, "textures/models/zirnox.png");

View File

@ -9,6 +9,7 @@ import com.hbm.blocks.generic.BlockBedrockOreTE.TileEntityBedrockOre;
import com.hbm.blocks.generic.BlockBobble.TileEntityBobble;
import com.hbm.blocks.generic.BlockDynamicSlag.TileEntitySlag;
import com.hbm.blocks.generic.BlockEmitter.TileEntityEmitter;
import com.hbm.blocks.generic.BlockGlyphidSpawner.TileEntityGlpyhidSpawner;
import com.hbm.blocks.generic.BlockLoot.TileEntityLoot;
import com.hbm.blocks.generic.BlockMotherOfAllOres.TileEntityRandomOre;
import com.hbm.blocks.generic.BlockSnowglobe.TileEntitySnowglobe;
@ -193,6 +194,7 @@ public class TileMappings {
put(TileEntityPipeGauge.class, "tileentity_pipe_gauge");
put(TileEntityMachineBAT9000.class, "tileentity_bat9000");
put(TileEntityMachineOrbus.class, "tileentity_orbus");
put(TileEntityGlpyhidSpawner.class, "tileentity_glyphid_spawner");
put(TileEntityLoot.class, "tileentity_ntm_loot");
put(TileEntityBobble.class, "tileentity_ntm_bobblehead");

View File

@ -0,0 +1,128 @@
package com.hbm.world.feature;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
public class GlyphidHive {
public static final int[][][] schematic = new int[][][] {
{
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,1,1,1,0,0,0,0},
{0,0,0,1,1,1,1,1,0,0,0},
{0,0,0,1,1,1,1,1,0,0,0},
{0,0,0,1,1,1,1,1,0,0,0},
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{3,3,9,9,9,9,9,9,9,5,5},
{3,3,3,9,9,9,9,9,5,5,5},
{0,1,1,1,9,9,9,1,1,1,0},
{0,0,1,1,2,9,2,1,1,0,0},
{0,0,0,1,2,2,2,1,0,0,0},
{0,0,0,0,2,2,2,0,0,0,0},
},
{
{0,0,0,0,1,1,1,0,0,0,0},
{0,0,0,1,1,1,1,1,0,0,0},
{0,0,1,1,1,1,1,1,1,0,0},
{0,1,1,1,1,1,1,1,1,1,0},
{1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1},
{0,1,1,1,1,1,1,1,1,1,0},
{0,0,1,1,1,1,1,1,1,0,0},
{0,0,0,1,1,1,1,1,0,0,0},
{0,0,0,0,1,1,1,0,0,0,0},
},
{
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,1,1,1,0,0,0,0},
{0,0,0,1,1,1,1,1,0,0,0},
{0,0,1,1,1,1,1,1,1,0,0},
{0,1,1,1,1,1,1,1,1,1,0},
{0,1,1,1,1,1,1,1,1,1,0},
{0,1,1,1,1,1,1,1,1,1,0},
{0,0,1,1,1,1,1,1,1,0,0},
{0,0,0,1,1,1,1,1,0,0,0},
{0,0,0,0,1,1,1,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
}
};
public static void generate(World world, int x, int y, int z, Random rand) {
int orientation = rand.nextInt(4) + 2;
for(int i = 0; i < 11; i++) {
for(int j = 0; j < 7; j++) {
for(int k = 0; k < 11; k++) {
int block = schematic[6 - j][i][k];
if(block == 1 || (block != orientation && block > 1 && block < 6)) {
world.setBlock(x + i - 5, y + j - 2, z + k - 5, ModBlocks.glyphid_base);
}
if(block == 9) {
world.setBlock(x + i - 5, y + j - 2, z + k - 5, Blocks.air);
}
}
}
}
world.setBlock(x, y - 1, z, ModBlocks.glyphid_spawner);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB