mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
moldy glyphids
This commit is contained in:
parent
debfa0f3ee
commit
95520daebc
@ -11,8 +11,9 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class BlockGlyphid extends Block {
|
||||
|
||||
public IIcon[] icons = new IIcon[2];
|
||||
|
||||
public IIcon[] iconsStandard = new IIcon[2];
|
||||
public IIcon[] iconsInfested = new IIcon[2];
|
||||
|
||||
public BlockGlyphid(Material mat) {
|
||||
super(mat);
|
||||
@ -24,20 +25,28 @@ public class BlockGlyphid extends Block {
|
||||
long l = (long) (x * 3129871) ^ (long)y * 116129781L ^ (long)z;
|
||||
l = l * l * 42317861L + l * 11L;
|
||||
int i = (int)(l >> 16 & 3L);
|
||||
return icons[(int)(Math.abs(i) % this.icons.length)];
|
||||
IIcon[] icons = this.getIconArray(world.getBlockMetadata(x, y, z));
|
||||
return icons[(int)(Math.abs(i) % icons.length)];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return icons[meta % this.icons.length];
|
||||
IIcon[] icons = this.getIconArray(meta);
|
||||
return icons[meta % icons.length];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
icons[0] = reg.registerIcon(RefStrings.MODID + ":glyphid_base");
|
||||
icons[1] = reg.registerIcon(RefStrings.MODID + ":glyphid_base_alt");
|
||||
iconsStandard[0] = reg.registerIcon(RefStrings.MODID + ":glyphid_base");
|
||||
iconsStandard[1] = reg.registerIcon(RefStrings.MODID + ":glyphid_base_alt");
|
||||
iconsInfested[0] = reg.registerIcon(RefStrings.MODID + ":glyphid_base_infested");
|
||||
iconsInfested[1] = reg.registerIcon(RefStrings.MODID + ":glyphid_base_infested_alt");
|
||||
}
|
||||
|
||||
protected IIcon[] getIconArray(int meta) {
|
||||
if(meta == 1) return this.iconsInfested;
|
||||
return this.iconsStandard;
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,18 +8,25 @@ import com.hbm.entity.mob.*;
|
||||
import com.hbm.handler.pollution.PollutionHandler;
|
||||
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
||||
import com.hbm.items.ModItems;
|
||||
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.util.Tuple.Pair;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.EnumDifficulty;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockGlyphidSpawner extends BlockContainer {
|
||||
|
||||
public IIcon[] icons = new IIcon[2];
|
||||
|
||||
public BlockGlyphidSpawner(Material mat) {
|
||||
super(mat);
|
||||
@ -30,6 +37,19 @@ public class BlockGlyphidSpawner extends BlockContainer {
|
||||
return ModItems.egg_glyphid;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return icons[meta % icons.length];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
icons[0] = reg.registerIcon(RefStrings.MODID + ":glyphid_eggs_alt");
|
||||
icons[1] = reg.registerIcon(RefStrings.MODID + ":glyphid_eggs_infested");
|
||||
}
|
||||
|
||||
private static final ArrayList<Pair<Function<World, EntityGlyphid>, int[]>> spawnMap = new ArrayList<>();
|
||||
|
||||
static {
|
||||
@ -80,7 +100,7 @@ public class BlockGlyphidSpawner extends BlockContainer {
|
||||
|
||||
if(list.size() <= 3) {
|
||||
|
||||
ArrayList<EntityGlyphid> currentSwarm = createSwarm(soot);
|
||||
ArrayList<EntityGlyphid> currentSwarm = createSwarm(soot, this.getBlockMetadata());
|
||||
|
||||
for(EntityGlyphid glyphid : currentSwarm) {
|
||||
trySpawnEntity(glyphid);
|
||||
@ -109,7 +129,7 @@ public class BlockGlyphidSpawner extends BlockContainer {
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<EntityGlyphid> createSwarm(float soot) {
|
||||
public ArrayList<EntityGlyphid> createSwarm(float soot, int meta) {
|
||||
|
||||
Random rand = new Random();
|
||||
ArrayList<EntityGlyphid> currentSpawns = new ArrayList<>();
|
||||
@ -121,7 +141,9 @@ public class BlockGlyphidSpawner extends BlockContainer {
|
||||
int[] chance = glyphid.getValue();
|
||||
int adjustedChance = (int) (chance[0] + (chance[1] - chance[1] / Math.max(((soot + 1) / 3), 1)));
|
||||
if(rand.nextInt(100) <= adjustedChance) {
|
||||
currentSpawns.add(glyphid.getKey().apply(worldObj));
|
||||
EntityGlyphid entity = glyphid.getKey().apply(worldObj);
|
||||
if(meta == 1) entity.getDataWatcher().updateObject(EntityGlyphid.DW_SUBTYPE, (byte) EntityGlyphid.TYPE_INFECTED);
|
||||
currentSpawns.add(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,8 +80,14 @@ public class EntityGlyphid extends EntityMob {
|
||||
/** Yeah, fuck, whatever, anything goes now */
|
||||
protected EntityWaypoint taskWaypoint = null;
|
||||
|
||||
//subtypes
|
||||
public static final int TYPE_NORMAL = 0;
|
||||
public static final int TYPE_INFECTED = 1;
|
||||
|
||||
//data watcher keys
|
||||
public static final int DW_WALL = 16;
|
||||
public static final int DW_ARMOR = 17;
|
||||
public static final int DW_SUBTYPE = 18;
|
||||
|
||||
public EntityGlyphid(World world) {
|
||||
super(world);
|
||||
@ -99,9 +105,9 @@ public class EntityGlyphid extends EntityMob {
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
super.entityInit();
|
||||
this.dataWatcher.addObject(16, new Byte((byte) 0)); //wall climbing
|
||||
this.dataWatcher.addObject(17, new Byte((byte) 0b11111)); //armor
|
||||
this.dataWatcher.addObject(18, new Byte((byte) 0)); //subtype (i.e. normal, infected, etc)
|
||||
this.dataWatcher.addObject(DW_WALL, new Byte((byte) 0)); //wall climbing
|
||||
this.dataWatcher.addObject(DW_ARMOR, new Byte((byte) 0b11111)); //armor
|
||||
this.dataWatcher.addObject(DW_SUBTYPE, new Byte((byte) 0)); //subtype (i.e. normal, infected, etc)
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -282,7 +288,7 @@ public class EntityGlyphid extends EntityMob {
|
||||
public boolean attackEntityFrom(DamageSource source, float amount) {
|
||||
|
||||
if(!source.isDamageAbsolute() && !source.isUnblockable() && !worldObj.isRemote && !source.isFireDamage() && !source.getDamageType().equals(ModDamageSource.s_cryolator)) {
|
||||
byte armor = this.dataWatcher.getWatchableObjectByte(17);
|
||||
byte armor = this.dataWatcher.getWatchableObjectByte(DW_ARMOR);
|
||||
|
||||
if(armor != 0) { //if at least one bit of armor is present
|
||||
|
||||
@ -322,7 +328,7 @@ public class EntityGlyphid extends EntityMob {
|
||||
|
||||
public float calculateDamage(float amount) {
|
||||
|
||||
byte armor = this.dataWatcher.getWatchableObjectByte(17);
|
||||
byte armor = this.dataWatcher.getWatchableObjectByte(DW_ARMOR);
|
||||
int divisor = 1;
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
@ -341,7 +347,7 @@ public class EntityGlyphid extends EntityMob {
|
||||
}
|
||||
|
||||
public void breakOffArmor() {
|
||||
byte armor = this.dataWatcher.getWatchableObjectByte(17);
|
||||
byte armor = this.dataWatcher.getWatchableObjectByte(DW_ARMOR);
|
||||
List<Integer> indices = Arrays.asList(0, 1, 2, 3, 4);
|
||||
Collections.shuffle(indices);
|
||||
|
||||
@ -350,7 +356,7 @@ public class EntityGlyphid extends EntityMob {
|
||||
if((armor & bit) > 0) {
|
||||
armor &= ~bit;
|
||||
armor = (byte) (armor & 0b11111);
|
||||
this.dataWatcher.updateObject(17, armor);
|
||||
this.dataWatcher.updateObject(DW_ARMOR, armor);
|
||||
worldObj.playSoundAtEntity(this, "mob.zombie.woodbreak", 1.0F, 1.25F);
|
||||
break;
|
||||
}
|
||||
@ -388,11 +394,11 @@ public class EntityGlyphid extends EntityMob {
|
||||
}
|
||||
|
||||
public boolean isBesideClimbableBlock() {
|
||||
return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0;
|
||||
return (this.dataWatcher.getWatchableObjectByte(DW_WALL) & 1) != 0;
|
||||
}
|
||||
|
||||
public void setBesideClimbableBlock(boolean climbable) {
|
||||
byte watchable = this.dataWatcher.getWatchableObjectByte(16);
|
||||
byte watchable = this.dataWatcher.getWatchableObjectByte(DW_WALL);
|
||||
|
||||
if(climbable) {
|
||||
watchable = (byte) (watchable | 1);
|
||||
@ -400,7 +406,7 @@ public class EntityGlyphid extends EntityMob {
|
||||
watchable &= -2;
|
||||
}
|
||||
|
||||
this.dataWatcher.updateObject(16, Byte.valueOf(watchable));
|
||||
this.dataWatcher.updateObject(DW_WALL, Byte.valueOf(watchable));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -569,7 +575,8 @@ public class EntityGlyphid extends EntityMob {
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound nbt) {
|
||||
super.writeEntityToNBT(nbt);
|
||||
nbt.setByte("armor", this.dataWatcher.getWatchableObjectByte(17));
|
||||
nbt.setByte("armor", this.dataWatcher.getWatchableObjectByte(DW_ARMOR));
|
||||
nbt.setByte("subtype", this.dataWatcher.getWatchableObjectByte(DW_SUBTYPE));
|
||||
|
||||
nbt.setBoolean("hasHome", hasHome);
|
||||
nbt.setInteger("homeX", homeX);
|
||||
@ -587,7 +594,8 @@ public class EntityGlyphid extends EntityMob {
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
super.readEntityFromNBT(nbt);
|
||||
this.dataWatcher.updateObject(17, nbt.getByte("armor"));
|
||||
this.dataWatcher.updateObject(DW_ARMOR, nbt.getByte("armor"));
|
||||
this.dataWatcher.updateObject(DW_SUBTYPE, nbt.getByte("subtype"));
|
||||
|
||||
this.hasHome = nbt.getBoolean("hasHome");
|
||||
this.homeX = nbt.getInteger("homeX");
|
||||
|
||||
@ -3,6 +3,7 @@ package com.hbm.render.entity.mob;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.entity.mob.EntityGlyphid;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
@ -13,10 +14,13 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderGlyphid extends RenderLiving {
|
||||
|
||||
public static final ResourceLocation glyphid_infested_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_infestation.png");
|
||||
|
||||
public RenderGlyphid() {
|
||||
super(new ModelGlyphid(), 1.0F);
|
||||
this.shadowOpaque = 0.0F;
|
||||
this.setRenderPassModel(this.mainModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -24,6 +28,21 @@ public class RenderGlyphid extends RenderLiving {
|
||||
EntityGlyphid glyphid = (EntityGlyphid) entity;
|
||||
return glyphid.getSkin();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int shouldRenderPass(EntityLivingBase entity, int pass, float interp) {
|
||||
if(pass != 0) {
|
||||
return -1;
|
||||
} else {
|
||||
if(entity.getDataWatcher().getWatchableObjectByte(EntityGlyphid.DW_SUBTYPE) == EntityGlyphid.TYPE_INFECTED) {
|
||||
this.bindTexture(glyphid_infested_tex);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ModelGlyphid extends ModelBase {
|
||||
|
||||
@ -43,11 +62,20 @@ public class RenderGlyphid extends RenderLiving {
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
|
||||
this.renderModel(entity, limbSwing);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void renderModel(Entity entity, float limbSwing) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
double s = ((EntityGlyphid) entity).getScale();
|
||||
GL11.glScaled(s, s, s);
|
||||
|
||||
EntityLivingBase living = (EntityLivingBase) entity;
|
||||
byte armor = living.getDataWatcher().getWatchableObjectByte(17);
|
||||
byte armor = living.getDataWatcher().getWatchableObjectByte(EntityGlyphid.DW_ARMOR);
|
||||
|
||||
double walkCycle = limbSwing;
|
||||
|
||||
|
||||
@ -105,6 +105,7 @@ public class GlyphidHive {
|
||||
public static void generateBigGround(World world, int x, int y, int z, Random rand, boolean openDesign) {
|
||||
|
||||
int orientation = rand.nextInt(2) + 2;
|
||||
int overrideMeta = 0;
|
||||
|
||||
for(int i = 0; i < 11; i++) {
|
||||
for(int j = 0; j < 7; j++) {
|
||||
@ -115,7 +116,7 @@ public class GlyphidHive {
|
||||
boolean hasWall = !openDesign && (block != orientation && block > 1 && block < 6);
|
||||
|
||||
if(block == 1 || hasWall) {
|
||||
world.setBlock(x + i - 5, y + j - 2, z + k - 5, ModBlocks.glyphid_base);
|
||||
world.setBlock(x + i - 5, y + j - 2, z + k - 5, ModBlocks.glyphid_base, overrideMeta, 2);
|
||||
} else if (block != 0) {
|
||||
world.setBlock(x + i - 5, y + j - 2, z + k - 5, Blocks.air);
|
||||
}
|
||||
@ -123,7 +124,7 @@ public class GlyphidHive {
|
||||
}
|
||||
}
|
||||
|
||||
world.setBlock(x, y - 1, z, ModBlocks.glyphid_spawner);
|
||||
world.setBlock(x, y - 1, z, ModBlocks.glyphid_spawner, overrideMeta, 2);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -508,7 +508,7 @@ death.attack.tauBlast=%1$s lud die XVL1456 zu lange auf und wurde in Stücke ger
|
||||
death.attack.teleporter=%1$s wurde ins Nichts teleportiert.
|
||||
|
||||
desc.item.rtgHeat=Hitzelevel: %s
|
||||
desc.gui.rtgBFurnace.desc=Bönitigt mindestens 15 Hitze um zu starten$Je mehr Hitze, desto schneller der Vorgang$Hitze über dem maximalen Level hat keinen Effekt$Gold-198 kann zu Quecksilber zerfallen
|
||||
desc.gui.rtgBFurnace.desc=Benötigt mindestens 15 Hitze um zu starten$Je mehr Hitze, desto schneller der Vorgang$Hitze über dem maximalen Level hat keinen Effekt$Gold-198 kann zu Quecksilber zerfallen
|
||||
desc.gui.rtgBFurnace.heat=§eHitzelevel: %s
|
||||
desc.gui.rtgBFurnace.pellets=Akzeptierte Pellets:
|
||||
desc.gui.rtgBFurnace.pellet=%s (%s Hitze)
|
||||
@ -527,6 +527,7 @@ entity.entity_glyphid_blaster.name=Glyphid-Blaster
|
||||
entity.entity_glyphid_bombardier.name=Glyphid-Bombardierer
|
||||
entity.entity_glyphid_brawler.name=Glyphid-Schläger
|
||||
entity.entity_glyphid_brenda.name=Brenda
|
||||
entity.entity_glyphid_digger.name=Glyphid-Gräber
|
||||
entity.entity_glyphid_nuclear.name=Der dicke Johnson
|
||||
entity.entity_glyphid_scout.name=Glyphid-Späher
|
||||
entity.entity_ntm_fbi.name=FBI Agent
|
||||
|
||||
@ -1036,6 +1036,7 @@ entity.entity_glyphid_blaster.name=Glyphid Blaster
|
||||
entity.entity_glyphid_bombardier.name=Glyphid Bombardier
|
||||
entity.entity_glyphid_brawler.name=Glyphid Brawler
|
||||
entity.entity_glyphid_brenda.name=Brenda
|
||||
entity.entity_glyphid_digger.name=Glyphid Digger
|
||||
entity.entity_glyphid_nuclear.name=Big Man Johnson
|
||||
entity.entity_glyphid_scout.name=Glyphid Scout
|
||||
entity.entity_ntm_fbi.name=FBI Agent
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 560 B |
Binary file not shown.
|
After Width: | Height: | Size: 594 B |
Binary file not shown.
|
After Width: | Height: | Size: 585 B |
Binary file not shown.
|
After Width: | Height: | Size: 423 B |
Binary file not shown.
|
After Width: | Height: | Size: 747 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Loading…
x
Reference in New Issue
Block a user