brick by brick, suck my

This commit is contained in:
Bob 2022-07-03 22:37:20 +02:00
parent fca57450ac
commit 4293bddf12
40 changed files with 4105 additions and 283 deletions

View File

@ -139,6 +139,7 @@ public class ModBlocks {
public static Block stone_resource;
public static Block stalagmite;
public static Block stalactite;
public static Block stone_deep_cobble;
public static Block depth_brick;
public static Block depth_tiles;
@ -1383,6 +1384,7 @@ public class ModBlocks {
stone_resource = new BlockResourceStone().setBlockName("stone_resource").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F);
stalagmite = new BlockStalagmite().setBlockName("stalagmite").setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(2.0F);
stalactite = new BlockStalagmite().setBlockName("stalactite").setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(2.0F);
stone_deep_cobble = new BlockDeepCobble().setBlockName("stone_deep_cobble").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(30.0F);
basalt = new BlockGeneric(Material.rock).setBlockName("basalt").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":basalt");
basalt_sulfur = new BlockOre(Material.rock).setBlockName("basalt_sulfur").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":basalt_sulfur");
@ -2488,6 +2490,7 @@ public class ModBlocks {
GameRegistry.registerBlock(basalt_brick, basalt_brick.getUnlocalizedName());
GameRegistry.registerBlock(basalt_polished, basalt_polished.getUnlocalizedName());
GameRegistry.registerBlock(basalt_tiles, basalt_tiles.getUnlocalizedName());
//GameRegistry.registerBlock(stone_deep_cobble, ItemBlockBase.class, stone_deep_cobble.getUnlocalizedName());
//Blocks
GameRegistry.registerBlock(block_uranium, block_uranium.getUnlocalizedName());

View File

@ -2,8 +2,6 @@ package com.hbm.blocks.generic;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;

View File

@ -0,0 +1,43 @@
package com.hbm.blocks.generic;
import java.util.Random;
import com.hbm.blocks.BlockEnumMulti;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.world.World;
public class BlockDeepCobble extends BlockEnumMulti {
public static enum EnumDeepCobbleTypes {
NORMAL,
BURNING,
STEAMING
}
public BlockDeepCobble() {
super(Material.rock, EnumDeepCobbleTypes.class, true, true);
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
super.randomDisplayTick(world, x, y, z, rand);
int meta = world.getBlockMetadata(x, y, z);
Block b = world.getBlock(x, y + 1, z);
if(!b.isNormalCube()) {
if(meta == EnumDeepCobbleTypes.BURNING.ordinal()) {
world.spawnParticle("flame", x + rand.nextDouble(), y + 1.0625, z + rand.nextDouble(), 0.0, 0.0, 0.0);
}
if(meta == EnumDeepCobbleTypes.STEAMING.ordinal()) {
world.spawnParticle("cloud", x + 0.25 + rand.nextDouble() * 0.5, y + 1.0625, z + 0.25 + rand.nextDouble() * 0.5, 0.0, 0.05, 0.0);
}
}
}
}

View File

@ -32,6 +32,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
@ -134,7 +136,12 @@ public class BlockStorageCrate extends BlockContainer {
try {
byte[] abyte = CompressedStreamTools.compress(nbt);
//System.out.println("size: " + abyte.length); //TODO: test capacity, make sure size is <20% of maximum allowed payload
if(abyte.length > 6000) {
player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + "Warning: Container NBT exceeds 6kB, contents will be ejected!"));
return world.setBlockToAir(x, y, z);
}
} catch(IOException e) { }
}

View File

@ -73,9 +73,18 @@ public class BlockMassStorage extends BlockContainer implements IBlockMulti, ILo
return side == 1 ? this.iconTop[meta] : (side == 0 ? this.iconTop[meta] : this.iconSide[meta]);
}
@Override
public int damageDropped(int meta) {
return meta;
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityMassStorage(meta == 0 ? 10_000 : meta == 1 ? 100_000 : 1_000_000);
return new TileEntityMassStorage(getCapacity(meta));
}
public int getCapacity(int meta) {
return meta == 0 ? 10_000 : meta == 1 ? 100_000 : meta == 2 ? 1_000_000 : 0;
}
@Override
@ -131,7 +140,7 @@ public class BlockMassStorage extends BlockContainer implements IBlockMulti, ILo
}
}
if(inv instanceof TileEntityMassStorage) {
if(inv instanceof TileEntityMassStorage && nbt.func_150296_c().size() > 0) {
TileEntityMassStorage storage = (TileEntityMassStorage) inv;
nbt.setInteger("stack", storage.getStockpile());
}
@ -274,7 +283,7 @@ public class BlockMassStorage extends BlockContainer implements IBlockMulti, ILo
if(type != null) {
list.add(EnumChatFormatting.GOLD + type.getDisplayName());
list.add("x" + String.format("%,d", stack.stackTagCompound.getInteger("stack")));
list.add(String.format("%,d", stack.stackTagCompound.getInteger("stack")) + " / " + String.format("%,d", getCapacity(stack.getItemDamage())));
}
}
}

View File

@ -5,7 +5,6 @@ import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
@ -18,6 +17,7 @@ import com.google.gson.stream.JsonWriter;
import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.RecipesCommon.MetaBlock;
import com.hbm.main.MainRegistry;
import com.hbm.util.Compat;
import com.hbm.util.Tuple.Triplet;
import net.minecraft.block.Block;
@ -53,29 +53,34 @@ public class FalloutConfigJSON {
}
private static void initDefault() {
entries.add(new FalloutEntry()
.mB(Blocks.leaves)
.prim(new Triplet(Blocks.air, 0, 1)));
entries.add(new FalloutEntry()
.mB(Blocks.leaves2)
.prim(new Triplet(Blocks.air, 0, 1)));
entries.add(new FalloutEntry()
.mB(Blocks.stone)
.prim(new Triplet(ModBlocks.sellafield_1, 0, 1))
.max(5)
.sol(true));
entries.add(new FalloutEntry()
.mB(Blocks.stone)
.prim(new Triplet(ModBlocks.sellafield_0, 0, 1))
.min(5)
.max(15)
.sol(true));
entries.add(new FalloutEntry()
.mB(Blocks.stone)
.prim(new Triplet(ModBlocks.sellafield_slaked, 0, 1))
.min(15)
.max(75)
.sol(true));
double woodEffectRange = 65D;
/* destroy all leaves within the radios, kill all leaves outside of it */
entries.add(new FalloutEntry() .mB(Blocks.leaves) .prim(new Triplet(Blocks.air, 0, 1)) .max(woodEffectRange));
entries.add(new FalloutEntry() .mB(Blocks.leaves2) .prim(new Triplet(Blocks.air, 0, 1)) .max(woodEffectRange));
entries.add(new FalloutEntry() .mB(ModBlocks.waste_leaves) .prim(new Triplet(Blocks.air, 0, 1)) .max(woodEffectRange));
entries.add(new FalloutEntry() .mB(Blocks.leaves) .prim(new Triplet(ModBlocks.waste_leaves, 0, 1)) .min(woodEffectRange));
entries.add(new FalloutEntry( ).mB(Blocks.leaves2) .prim(new Triplet(ModBlocks.waste_leaves, 0, 1)) .min(woodEffectRange));
entries.add(new FalloutEntry() .mB(Blocks.log) .prim(new Triplet(ModBlocks.waste_log, 0, 1)) .max(woodEffectRange));
entries.add(new FalloutEntry() .mB(Blocks.log2) .prim(new Triplet(ModBlocks.waste_log, 0, 1)) .max(woodEffectRange));
entries.add(new FalloutEntry() .mB(Blocks.red_mushroom_block).mM(10) .prim(new Triplet(ModBlocks.waste_log, 0, 1)) .max(woodEffectRange));
entries.add(new FalloutEntry() .mB(Blocks.brown_mushroom_block).mM(10) .prim(new Triplet(ModBlocks.waste_log, 0, 1)) .max(woodEffectRange));
entries.add(new FalloutEntry() .mB(Blocks.red_mushroom_block) .prim(new Triplet(Blocks.air, 0, 1)) .max(woodEffectRange));
entries.add(new FalloutEntry() .mB(Blocks.brown_mushroom_block) .prim(new Triplet(Blocks.air, 0, 1)) .max(woodEffectRange));
entries.add(new FalloutEntry() .mB(Blocks.planks) .prim(new Triplet(ModBlocks.waste_planks, 0, 1)) .max(woodEffectRange));
FalloutEntry stoneCore = new FalloutEntry().prim(new Triplet(ModBlocks.sellafield_1, 0, 1)).max(5).sol(true);
FalloutEntry stoneInner = new FalloutEntry().prim(new Triplet(ModBlocks.sellafield_0, 0, 1)).min(5).max(15).sol(true);
FalloutEntry stoneOuter = new FalloutEntry().prim(new Triplet(ModBlocks.sellafield_slaked, 0, 1)).min(15).max(50).sol(true);
entries.add(stoneCore.clone().mB(Blocks.stone));
entries.add(stoneInner.clone().mB(Blocks.stone));
entries.add(stoneOuter.clone().mB(Blocks.stone));
entries.add(stoneCore.clone().mB(Blocks.gravel));
entries.add(stoneInner.clone().mB(Blocks.gravel));
entries.add(stoneOuter.clone().mB(Blocks.gravel));
entries.add(new FalloutEntry()
.mB(Blocks.grass)
.prim(new Triplet(ModBlocks.waste_earth, 0, 1)));
@ -100,24 +105,13 @@ public class FalloutConfigJSON {
.mB(Blocks.coal_ore)
.prim(new Triplet(Blocks.diamond_ore, 0, 3), new Triplet(Blocks.emerald_ore, 0, 2))
.c(0.2));
entries.add(new FalloutEntry()
.mB(Blocks.log)
.prim(new Triplet(ModBlocks.waste_log, 0, 1)));
entries.add(new FalloutEntry()
.mB(Blocks.log2)
.prim(new Triplet(ModBlocks.waste_log, 0, 1)));
entries.add(new FalloutEntry()
.mB(Blocks.red_mushroom_block).mM(10)
.prim(new Triplet(ModBlocks.waste_log, 0, 1)));
entries.add(new FalloutEntry()
.mB(Blocks.brown_mushroom_block).mM(10)
.prim(new Triplet(ModBlocks.waste_log, 0, 1)));
entries.add(new FalloutEntry()
.mB(Blocks.planks)
.prim(new Triplet(ModBlocks.waste_planks, 0, 1)));
entries.add(new FalloutEntry()
.mB(Blocks.coal_ore)
.prim(new Triplet(Blocks.diamond_ore, 0, 3), new Triplet(Blocks.emerald_ore, 0, 2))
.c(0.5));
entries.add(new FalloutEntry()
.mB(ModBlocks.ore_lignite)
.prim(new Triplet(Blocks.diamond_ore, 0, 1))
.c(0.2));
entries.add(new FalloutEntry()
.mB(ModBlocks.ore_uranium)
@ -128,6 +122,20 @@ public class FalloutConfigJSON {
entries.add(new FalloutEntry()
.mB(ModBlocks.ore_gneiss_uranium)
.prim(new Triplet(ModBlocks.ore_gneiss_schrabidium, 0, 1), new Triplet(ModBlocks.ore_gneiss_uranium_scorched, 0, 99)));
/// COMPAT ///
Block deepslate = Compat.tryLoadBlock(Compat.MOD_EF, "deepslate");
if(deepslate != null) { //identical to stone
entries.add(stoneCore.clone().mB(deepslate));
entries.add(stoneInner.clone().mB(deepslate));
entries.add(stoneOuter.clone().mB(deepslate));
}
Block stone = Compat.tryLoadBlock(Compat.MOD_EF, "stone");
if(stone != null) { //identical to stone
entries.add(stoneCore.clone().mB(stone));
entries.add(stoneInner.clone().mB(stone));
entries.add(stoneOuter.clone().mB(stone));
}
}
private static void writeDefault(File file) {
@ -185,6 +193,21 @@ public class FalloutConfigJSON {
private double maxDist = 100.0D;
private boolean isSolid = false;
public FalloutEntry clone() {
FalloutEntry entry = new FalloutEntry();
entry.mB(matchesBlock);
entry.mM(matchesMeta);
entry.mMa(matchesMaterial);
entry.mO(matchesOpaque);
entry.prim(primaryBlocks);
entry.sec(secondaryBlocks);
entry.min(minDist);
entry.max(maxDist);
entry.sol(isSolid);
return entry;
}
public FalloutEntry mB(Block block) { this.matchesBlock = block; return this; }
public FalloutEntry mM(int meta) { this.matchesMeta = meta; return this; }
@ -211,7 +234,7 @@ public class FalloutConfigJSON {
if(primaryBlocks == null) return false;
MetaBlock block = chooseRandomOutcome(primaryBlocks);
world.setBlock(x, y, z, block.block, block.meta, 2);
world.setBlock(x, y, z, block.block, block.meta, 3);
return true;
} else {
@ -219,7 +242,7 @@ public class FalloutConfigJSON {
if(secondaryBlocks == null) return false;
MetaBlock block = chooseRandomOutcome(secondaryBlocks);
world.setBlock(x, y, z, block.block, block.meta, 2);
world.setBlock(x, y, z, block.block, block.meta, 3);
return true;
}
}

View File

@ -1,5 +1,7 @@
package com.hbm.entity.cart;
import java.io.IOException;
import com.hbm.blocks.ModBlocks;
import com.hbm.items.ModItems;
import com.hbm.items.tool.ItemModMinecart;
@ -11,8 +13,11 @@ import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
public class EntityMinecartCrate extends EntityMinecartContainerBase {
@ -76,6 +81,16 @@ public class EntityMinecartCrate extends EntityMinecartContainerBase {
if(this.func_95999_t() != null) {
itemstack.setStackDisplayName(this.func_95999_t());
}
try {
byte[] abyte = CompressedStreamTools.compress(nbt);
if(abyte.length > 6000) {
worldObj.newExplosion(this, posX, posY, posZ, 2F, true, true);
this.entityDropItem(ItemModMinecart.createCartItem(EnumCartBase.VANILLA, EnumMinecart.CRATE), 0.0F);
}
} catch(IOException e) { }
this.entityDropItem(itemstack, 0.0F);
}

View File

@ -9,6 +9,7 @@ import com.hbm.saveddata.AuxSavedData;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityFallingBlock;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Vec3;
@ -72,6 +73,7 @@ public class EntityFalloutRain extends Entity {
}
}
}
} else {
setDead();
}
@ -120,7 +122,9 @@ public class EntityFalloutRain extends Entity {
Collections.reverse(chunksToProcess); // So it starts nicely from the middle
Collections.reverse(outerChunksToProcess);
}
//private List<int[]> changedPositions = new ArrayList();
// TODO cache chunks?
private void stomp(int x, int z, double dist) {
@ -145,12 +149,12 @@ public class EntityFalloutRain extends Entity {
double chance = 0.05 - Math.pow((d - 0.6) * 0.5, 2);
if(chance >= rand.nextDouble() && ModBlocks.fallout.canPlaceBlockAt(worldObj, x, y + 1, z))
worldObj.setBlock(x, y + 1, z, ModBlocks.fallout);
setBlock(x, y + 1, z, ModBlocks.fallout);
}
if(b.isFlammable(worldObj, x, y, z, ForgeDirection.UP)) {
if(rand.nextInt(5) == 0)
worldObj.setBlock(x, y + 1, z, Blocks.fire);
setBlock(x, y + 1, z, Blocks.fire);
}
boolean eval = false;
@ -161,107 +165,32 @@ public class EntityFalloutRain extends Entity {
if(entry.isSolid()) {
depth++;
}
eval = true;
break;
}
}
if(dist < 65 && b.getBlockHardness(worldObj, x, y, z) <= Blocks.stonebrick.getExplosionResistance(null)) {
Block bl = worldObj.getBlock(x, y - 1, z);
if(bl == Blocks.air) {
EntityFallingBlock entityfallingblock = new EntityFallingBlock(worldObj, x + 0.5D, y + 0.5D, z + 0.5D, worldObj.getBlock(x, y, z), worldObj.getBlockMetadata(x, y, z));
worldObj.spawnEntityInWorld(entityfallingblock);
}
}
if(!eval && b.isNormalCube()) {
depth++;
}
/*if (b == Blocks.leaves || b == Blocks.leaves2) {
worldObj.setBlock(x, y, z, Blocks.air);
} else if(b == Blocks.stone) {
depth++;
if(dist < 5)
worldObj.setBlock(x, y, z, ModBlocks.sellafield_1);
else if(dist < 15)
worldObj.setBlock(x, y, z, ModBlocks.sellafield_0);
else if(dist < 75)
worldObj.setBlock(x, y, z, ModBlocks.sellafield_slaked);
else
return;
if(depth > 2)
return;
} else if(b == Blocks.grass) {
worldObj.setBlock(x, y, z, ModBlocks.waste_earth);
return;
} else if(b == Blocks.mycelium) {
worldObj.setBlock(x, y, z, ModBlocks.waste_mycelium);
return;
} else if(b == Blocks.sand) {
if(rand.nextInt(20) == 0)
worldObj.setBlock(x, y, z, meta == 0 ? ModBlocks.waste_trinitite : ModBlocks.waste_trinitite_red);
return;
} else if (b == Blocks.clay) {
worldObj.setBlock(x, y, z, Blocks.hardened_clay);
return;
} else if (b == Blocks.mossy_cobblestone) {
worldObj.setBlock(x, y, z, Blocks.coal_ore);
return;
} else if (b == Blocks.coal_ore) {
int ra = rand.nextInt(150);
if (ra < 20) {
worldObj.setBlock(x, y, z, Blocks.diamond_ore);
} else if (ra < 30) {
worldObj.setBlock(x, y, z, Blocks.emerald_ore);
}
return;
} else if (b == Blocks.log || b == Blocks.log2) {
worldObj.setBlock(x, y, z, ModBlocks.waste_log);
} else if (b == Blocks.brown_mushroom_block || b == Blocks.red_mushroom_block) {
if (meta == 10) {
worldObj.setBlock(x, y, z, ModBlocks.waste_log);
} else {
worldObj.setBlock(x, y, z, Blocks.air,0,2);
}
} else if (b.getMaterial() == Material.wood && b.isOpaqueCube() && b != ModBlocks.waste_log) {
worldObj.setBlock(x, y, z, ModBlocks.waste_planks);
}
else if (b == ModBlocks.ore_uranium) {
if (rand.nextInt(VersatileConfig.getSchrabOreChance()) == 0)
worldObj.setBlock(x, y, z, ModBlocks.ore_schrabidium);
else
worldObj.setBlock(x, y, z, ModBlocks.ore_uranium_scorched);
return;
} else if (b == ModBlocks.ore_nether_uranium) {
if (rand.nextInt(VersatileConfig.getSchrabOreChance()) == 0)
worldObj.setBlock(x, y, z, ModBlocks.ore_nether_schrabidium);
else
worldObj.setBlock(x, y, z, ModBlocks.ore_nether_uranium_scorched);
return;
} else if(b == ModBlocks.ore_gneiss_uranium) {
if(rand.nextInt(VersatileConfig.getSchrabOreChance()) == 0)
worldObj.setBlock(x, y, z, ModBlocks.ore_gneiss_schrabidium);
else
worldObj.setBlock(x, y, z, ModBlocks.ore_gneiss_uranium_scorched);
return;
//this piece stops the "stomp" from reaching below ground
} else if(b.isNormalCube()) {
return;
}*/
}
}
public void setBlock(int x, int y, int z, Block block) {
setBlock(x, y, z, block, 0);
}
public void setBlock(int x, int y, int z, Block block, int meta) {
worldObj.setBlock(x, y, z, block, meta, 3); //this was supposed to write the position to a list for a multi block update, but forge already has that built-in. whoops.
}
@Override
protected void entityInit() {

View File

@ -102,7 +102,7 @@ public class EntityNukeExplosionMK4 extends Entity {
fallout.posX = this.posX;
fallout.posY = this.posY;
fallout.posZ = this.posZ;
fallout.setScale((int)(this.length * 1.8 + falloutAdd) * BombConfig.falloutRange / 100);
fallout.setScale((int)(this.length * 2.5 + falloutAdd) * BombConfig.falloutRange / 100);
this.worldObj.spawnEntityInWorld(fallout);

View File

@ -67,22 +67,38 @@ public class EntityArtilleryShell extends EntityThrowableNT implements IChunkLoa
public ArtilleryShell getType() {
try {
return ItemAmmoArty.types[this.dataWatcher.getWatchableObjectInt(10)];
return ItemAmmoArty.itemTypes[this.dataWatcher.getWatchableObjectInt(10)];
} catch(Exception ex) {
return ItemAmmoArty.types[0];
return ItemAmmoArty.itemTypes[0];
}
}
public void setTarget(int x, int y, int z) {
public double[] getTarget() {
return new double[] { this.targetX, this.targetY, this.targetZ };
}
public void setTarget(double x, double y, double z) {
this.targetX = x;
this.targetY = y;
this.targetZ = z;
}
public double getTargetHeight() {
return this.targetY;
}
public void setWhistle(boolean whistle) {
this.shouldWhistle = whistle;
}
public boolean getWhistle() {
return this.shouldWhistle;
}
public boolean didWhistle() {
return this.didWhistle;
}
@Override
public void onUpdate() {
@ -96,12 +112,13 @@ public class EntityArtilleryShell extends EntityThrowableNT implements IChunkLoa
double dist = Math.sqrt(deltaX * deltaX + deltaZ * deltaZ);
if(speed * 18 > dist) {
worldObj.playSoundEffect(this.targetX, this.targetY, this.targetZ, "hbm:turret.mortarWhistle", 15.0F, 1.0F);
worldObj.playSoundEffect(this.targetX, this.targetY, this.targetZ, "hbm:turret.mortarWhistle", 15.0F, 0.9F + rand.nextFloat() * 0.2F);
this.didWhistle = true;
}
}
loadNeighboringChunks((int)Math.floor(posX / 16D), (int)Math.floor(posZ / 16D));
this.getType().onUpdate(this);
} else {
if(this.turnProgress > 0) {
@ -143,15 +160,7 @@ public class EntityArtilleryShell extends EntityThrowableNT implements IChunkLoa
protected void onImpact(MovingObjectPosition mop) {
if(!worldObj.isRemote) {
/*Vec3 vec = Vec3.createVectorHelper(motionX, motionY, motionZ).normalize();
this.worldObj.newExplosion(this, mop.hitVec.xCoord - vec.xCoord, mop.hitVec.yCoord - vec.yCoord, mop.hitVec.zCoord - vec.zCoord, 15F, false, false);
this.setDead();*/
this.getType().onImpact(this, mop);
for(ChunkCoordIntPair chunk : loadedChunks) {
ForgeChunkManager.unforceChunk(loaderTicket, chunk);
}
}
}
@ -172,27 +181,30 @@ public class EntityArtilleryShell extends EntityThrowableNT implements IChunkLoa
public void loadNeighboringChunks(int newChunkX, int newChunkZ) {
if(!worldObj.isRemote && loaderTicket != null) {
for(ChunkCoordIntPair chunk : loadedChunks) {
ForgeChunkManager.unforceChunk(loaderTicket, chunk);
}
clearChunkLoader();
loadedChunks.clear();
loadedChunks.add(new ChunkCoordIntPair(newChunkX, newChunkZ));
loadedChunks.add(new ChunkCoordIntPair(newChunkX + (int) Math.ceil((this.posX + this.motionX) / 16D), newChunkZ + (int) Math.ceil((this.posZ + this.motionZ) / 16D)));
/*loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1, newChunkZ + 1));
loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1, newChunkZ - 1));
loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1, newChunkZ - 1));
loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1, newChunkZ + 1));
loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1, newChunkZ));
loadedChunks.add(new ChunkCoordIntPair(newChunkX, newChunkZ + 1));
loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1, newChunkZ));
loadedChunks.add(new ChunkCoordIntPair(newChunkX, newChunkZ - 1));*/
for(ChunkCoordIntPair chunk : loadedChunks) {
ForgeChunkManager.forceChunk(loaderTicket, chunk);
}
}
}
public void killAndClear() {
this.setDead();
this.clearChunkLoader();
}
public void clearChunkLoader() {
if(!worldObj.isRemote && loaderTicket != null) {
for(ChunkCoordIntPair chunk : loadedChunks) {
ForgeChunkManager.unforceChunk(loaderTicket, chunk);
}
}
}
@Override
public void writeEntityToNBT(NBTTagCompound nbt) {

View File

@ -15,6 +15,7 @@ public class ContainerTurretBase extends Container {
public ContainerTurretBase(InventoryPlayer invPlayer, TileEntityTurretBaseNT te) {
turret = te;
turret.openInventory();
this.addSlotToContainer(new Slot(te, 0, 98, 27));
@ -78,4 +79,10 @@ public class ContainerTurretBase extends Container {
public boolean canInteractWith(EntityPlayer player) {
return turret.isUseableByPlayer(player);
}
@Override
public void onContainerClosed(EntityPlayer p_75134_1_) {
super.onContainerClosed(p_75134_1_);
this.turret.closeInventory();
}
}

View File

@ -1632,6 +1632,7 @@ public class ModItems {
public static Item gun_revolver_silver;
public static Item gun_revolver_red;
//public static Item gun_revolver_nopip_ammo;
public static Item gun_bio_revolver;
public static Item gun_deagle;
public static Item gun_flechette;
public static Item gun_ar15;
@ -4368,6 +4369,7 @@ public class ModItems {
gun_revolver_silver = new ItemGunBase(Gun44MagnumFactory.getSilverConfig()).setUnlocalizedName("gun_revolver_silver").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_revolver_silver");
gun_revolver_red = new ItemGunBase(Gun44MagnumFactory.getRedConfig()).setUnlocalizedName("gun_revolver_red").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_revolver_red");
gun_deagle = new ItemGunBase(Gun50AEFactory.getDeagleConfig()).setUnlocalizedName("gun_deagle").setFull3D().setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_deagle");
gun_bio_revolver = new ItemGunBio(Gun50AEFactory.getDeagleConfig()).setUnlocalizedName("gun_bio_revolver").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_bio_revolver");
gun_flechette = new ItemGunBase(Gun556mmFactory.getSPIWConfig(), Gun556mmFactory.getGLauncherConfig()).setUnlocalizedName("gun_flechette").setFull3D().setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_flechette");
gun_ar15 = new ItemGunBase(Gun50BMGFactory.getAR15Config()).setUnlocalizedName("gun_ar15").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_ar15");
//gun_calamity_ammo = new ItemCustomLore().setUnlocalizedName("gun_calamity_ammo").setCreativeTab(null).setTextureName(RefStrings.MODID + ":gun_calamity_ammo");
@ -7167,6 +7169,7 @@ public class ModItems {
GameRegistry.registerItem(gun_revolver_blackjack, gun_revolver_blackjack.getUnlocalizedName());
GameRegistry.registerItem(gun_revolver_silver, gun_revolver_silver.getUnlocalizedName());
GameRegistry.registerItem(gun_revolver_red, gun_revolver_red.getUnlocalizedName());
GameRegistry.registerItem(gun_bio_revolver, gun_bio_revolver.getUnlocalizedName());
GameRegistry.registerItem(gun_deagle, gun_deagle.getUnlocalizedName());
GameRegistry.registerItem(gun_flechette, gun_flechette.getUnlocalizedName());
GameRegistry.registerItem(gun_ar15, gun_ar15.getUnlocalizedName());

View File

@ -15,7 +15,6 @@ import com.hbm.explosion.vanillant.standard.BlockProcessorStandard;
import com.hbm.explosion.vanillant.standard.EntityProcessorStandard;
import com.hbm.explosion.vanillant.standard.ExplosionEffectStandard;
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
import com.hbm.lib.Library;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.packet.AuxParticlePacketNT;
@ -42,13 +41,18 @@ import net.minecraft.util.Vec3;
public class ItemAmmoArty extends Item {
public static ArtilleryShell[] types = new ArtilleryShell[ /* >>> */ 6 /* <<< */ ];
public static ArtilleryShell[] itemTypes = new ArtilleryShell[ /* >>> */ 8 /* <<< */ ];
public static ArtilleryShell[] shellTypes = new ArtilleryShell[ /* >>> */ 8 /* <<< */ ];
/* item types */
public final int NORMAL = 0;
public final int CLASSIC = 1;
public final int EXPLOSIVE = 2;
public final int MINI_NUKE = 3;
public final int NUKE = 4;
public final int PHOSPHORUS = 5;
public final int MINI_NUKE_MULTI = 6;
public final int PHOSPHORUS_MULTI = 7;
/* non-item shell types */
public ItemAmmoArty() {
this.setHasSubtypes(true);
@ -63,7 +67,9 @@ public class ItemAmmoArty extends Item {
list.add(new ItemStack(item, 1, CLASSIC));
list.add(new ItemStack(item, 1, EXPLOSIVE));
list.add(new ItemStack(item, 1, PHOSPHORUS));
list.add(new ItemStack(item, 1, PHOSPHORUS_MULTI));
list.add(new ItemStack(item, 1, MINI_NUKE));
list.add(new ItemStack(item, 1, MINI_NUKE_MULTI));
list.add(new ItemStack(item, 1, NUKE));
}
@ -108,15 +114,15 @@ public class ItemAmmoArty extends Item {
}
}
private IIcon[] icons = new IIcon[types.length];
private IIcon[] icons = new IIcon[itemTypes.length];
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister reg) {
this.icons = new IIcon[types.length];
this.icons = new IIcon[itemTypes.length];
for(int i = 0; i < icons.length; i++) {
this.icons[i] = reg.registerIcon(RefStrings.MODID + ":" + types[i].name);
this.icons[i] = reg.registerIcon(RefStrings.MODID + ":" + itemTypes[i].name);
}
}
@ -128,71 +134,85 @@ public class ItemAmmoArty extends Item {
@Override
public String getUnlocalizedName(ItemStack stack) {
return "item." + types[Math.abs(stack.getItemDamage()) % types.length].name;
return "item." + itemTypes[Math.abs(stack.getItemDamage()) % itemTypes.length].name;
}
public static abstract class ArtilleryShell {
public abstract class ArtilleryShell {
String name;
public ArtilleryShell() { }
public ArtilleryShell(String name) {
this.name = name;
}
public abstract void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop);
public void onUpdate(EntityArtilleryShell shell) { }
}
public static void standardExplosion(EntityArtilleryShell shell, MovingObjectPosition mop, float size, float rangeMod, boolean breaksBlocks) {
shell.worldObj.playSoundEffect(shell.posX, shell.posY, shell.posZ, "hbm:weapon.explosionMedium", 20.0F, 0.9F + shell.worldObj.rand.nextFloat() * 0.2F);
Vec3 vec = Vec3.createVectorHelper(shell.motionX, shell.motionY, shell.motionZ).normalize();
ExplosionVNT xnt = new ExplosionVNT(shell.worldObj, mop.hitVec.xCoord - vec.xCoord, mop.hitVec.yCoord - vec.yCoord, mop.hitVec.zCoord - vec.zCoord, size);
if(breaksBlocks) {
xnt.setBlockAllocator(new BlockAllocatorStandard(48));
xnt.setBlockProcessor(new BlockProcessorStandard().setNoDrop());
}
xnt.setEntityProcessor(new EntityProcessorStandard().withRangeMod(rangeMod));
xnt.setPlayerProcessor(new PlayerProcessorStandard());
xnt.setSFX(new ExplosionEffectStandard());
xnt.explode();
shell.killAndClear();
}
public static void standardCluster(EntityArtilleryShell shell, int clusterType, int amount, double splitHeight, double deviation) {
if(!shell.getWhistle() || shell.motionY > 0) return;
if(shell.getTargetHeight() + splitHeight < shell.posY) return;
shell.killAndClear();
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "plasmablast");
data.setFloat("r", 1.0F);
data.setFloat("g", 1.0F);
data.setFloat("b", 1.0F);
data.setFloat("scale", 50F);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, shell.posX, shell.posY, shell.posZ),
new TargetPoint(shell.dimension, shell.posX, shell.posY, shell.posZ, 500));
for(int i = 0; i < amount; i++) {
EntityArtilleryShell cluster = new EntityArtilleryShell(shell.worldObj);
cluster.setType(clusterType);
cluster.setPositionAndRotation(shell.posX, shell.posY, shell.posZ, shell.rotationYaw, shell.rotationPitch);
cluster.motionX = i == 0 ? shell.motionX : (shell.motionX + shell.worldObj.rand.nextGaussian() * deviation);
cluster.motionY = shell.motionY;
cluster.motionZ = i == 0 ? shell.motionZ : (shell.motionZ + shell.worldObj.rand.nextGaussian() * deviation);
double[] target = shell.getTarget();
cluster.setTarget(target[0], target[1], target[2]);
cluster.setWhistle(shell.getWhistle() && !shell.didWhistle());
shell.worldObj.spawnEntityInWorld(cluster);
}
}
private void init() {
this.types[NORMAL] = new ArtilleryShell("ammo_arty") {
@Override public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
Vec3 vec = Vec3.createVectorHelper(shell.motionX, shell.motionY, shell.motionZ).normalize();
ExplosionVNT xnt = new ExplosionVNT(shell.worldObj, mop.hitVec.xCoord - vec.xCoord, mop.hitVec.yCoord - vec.yCoord, mop.hitVec.zCoord - vec.zCoord, 10F);
xnt.setEntityProcessor(new EntityProcessorStandard().withRangeMod(3F));
xnt.setPlayerProcessor(new PlayerProcessorStandard());
xnt.setSFX(new ExplosionEffectStandard());
xnt.explode();
shell.setDead();
}
};
this.types[CLASSIC] = new ArtilleryShell("ammo_arty_classic") {
@Override public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
Vec3 vec = Vec3.createVectorHelper(shell.motionX, shell.motionY, shell.motionZ).normalize();
ExplosionVNT xnt = new ExplosionVNT(shell.worldObj, mop.hitVec.xCoord - vec.xCoord, mop.hitVec.yCoord - vec.yCoord, mop.hitVec.zCoord - vec.zCoord, 15F);
xnt.setEntityProcessor(new EntityProcessorStandard().withRangeMod(5F));
xnt.setPlayerProcessor(new PlayerProcessorStandard());
xnt.setSFX(new ExplosionEffectStandard());
xnt.explode();
shell.setDead();
}
};
this.types[EXPLOSIVE] = new ArtilleryShell("ammo_arty_he") {
@Override public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
Vec3 vec = Vec3.createVectorHelper(shell.motionX, shell.motionY, shell.motionZ).normalize();
ExplosionVNT xnt = new ExplosionVNT(shell.worldObj, mop.hitVec.xCoord - vec.xCoord, mop.hitVec.yCoord - vec.yCoord, mop.hitVec.zCoord - vec.zCoord, 20F);
xnt.setBlockAllocator(new BlockAllocatorStandard(48));
xnt.setBlockProcessor(new BlockProcessorStandard().setNoDrop());
xnt.setEntityProcessor(new EntityProcessorStandard().withRangeMod(3F));
xnt.setPlayerProcessor(new PlayerProcessorStandard());
xnt.setSFX(new ExplosionEffectStandard());
xnt.explode();
shell.setDead();
}
};
this.types[MINI_NUKE] = new ArtilleryShell("ammo_arty_mini_nuke") {
@Override public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
/* STANDARD SHELLS */
this.shellTypes[NORMAL] = this.itemTypes[NORMAL] = new ArtilleryShell("ammo_arty") { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { standardExplosion(shell, mop, 10F, 3F, false); }};
this.shellTypes[CLASSIC] = this.itemTypes[CLASSIC] = new ArtilleryShell("ammo_arty_classic") { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { standardExplosion(shell, mop, 15F, 5F, false); }};
this.shellTypes[EXPLOSIVE] = this.itemTypes[EXPLOSIVE] = new ArtilleryShell("ammo_arty_he") { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { standardExplosion(shell, mop, 15F, 3F, true); }};
/* MINI NUKE */
this.shellTypes[MINI_NUKE] = this.itemTypes[MINI_NUKE] = new ArtilleryShell("ammo_arty_mini_nuke") {
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
shell.killAndClear();
Vec3 vec = Vec3.createVectorHelper(shell.motionX, shell.motionY, shell.motionZ).normalize();
ExplosionNukeSmall.explode(shell.worldObj, mop.hitVec.xCoord - vec.xCoord, mop.hitVec.yCoord - vec.yCoord, mop.hitVec.zCoord - vec.zCoord, ExplosionNukeSmall.medium);
shell.setDead();
}
};
this.types[NUKE] = new ArtilleryShell("ammo_arty_nuke") {
@Override public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
/* FULL NUKE */
this.shellTypes[NUKE] = this.itemTypes[NUKE] = new ArtilleryShell("ammo_arty_nuke") {
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
shell.worldObj.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(shell.worldObj, BombConfig.missileRadius, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord));
EntityNukeCloudSmall entity2 = new EntityNukeCloudSmall(shell.worldObj, 1000, BombConfig.missileRadius * 0.005F);
entity2.posX = mop.hitVec.xCoord;
@ -202,53 +222,44 @@ public class ItemAmmoArty extends Item {
shell.setDead();
}
};
this.types[PHOSPHORUS] = new ArtilleryShell("ammo_arty_phosphorus") {
@Override public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
Vec3 vec = Vec3.createVectorHelper(shell.motionX, shell.motionY, shell.motionZ).normalize();
double x = mop.hitVec.xCoord - vec.xCoord;
double y = mop.hitVec.yCoord - vec.yCoord;
double z = mop.hitVec.zCoord - vec.zCoord;
ExplosionVNT xnt = new ExplosionVNT(shell.worldObj, x, y, z, 10F);
xnt.setEntityProcessor(new EntityProcessorStandard().withRangeMod(3F));
xnt.setPlayerProcessor(new PlayerProcessorStandard());
xnt.setSFX(new ExplosionEffectStandard());
xnt.explode();
ExplosionLarge.spawnShrapnels(shell.worldObj, x, y, z, 15);
ExplosionChaos.burn(shell.worldObj, (int)x, (int)y, (int)z, 12);
/* PHOSPHORUS */
this.shellTypes[PHOSPHORUS] = this.itemTypes[PHOSPHORUS] = new ArtilleryShell("ammo_arty_phosphorus") {
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
standardExplosion(shell, mop, 10F, 3F, false);
shell.worldObj.playSoundEffect(shell.posX, shell.posY, shell.posZ, "hbm:weapon.explosionMedium", 20.0F, 0.9F + shell.worldObj.rand.nextFloat() * 0.2F);
ExplosionLarge.spawnShrapnels(shell.worldObj, (int) mop.hitVec.xCoord, (int) mop.hitVec.yCoord, (int) mop.hitVec.zCoord, 15);
ExplosionChaos.burn(shell.worldObj, (int) mop.hitVec.xCoord, (int) mop.hitVec.yCoord, (int) mop.hitVec.zCoord, 12);
int radius = 15;
List<Entity> hit = shell.worldObj.getEntitiesWithinAABBExcludingEntity(shell, AxisAlignedBB.getBoundingBox(shell.posX - radius, shell.posY - radius, shell.posZ - radius, shell.posX + radius, shell.posY + radius, shell.posZ + radius));
for(Entity e : hit) {
if(!Library.isObstructed(shell.worldObj, shell.posX, shell.posY, shell.posZ, e.posX, e.posY + e.getEyeHeight(), e.posZ)) {
e.setFire(5);
if(e instanceof EntityLivingBase) {
PotionEffect eff = new PotionEffect(HbmPotion.phosphorus.id, 30 * 20, 0, true);
eff.getCurativeItems().clear();
((EntityLivingBase)e).addPotionEffect(eff);
}
e.setFire(5);
if(e instanceof EntityLivingBase) {
PotionEffect eff = new PotionEffect(HbmPotion.phosphorus.id, 30 * 20, 0, true);
eff.getCurativeItems().clear();
((EntityLivingBase)e).addPotionEffect(eff);
}
}
for(int i = 0; i < 5; i++) {
NBTTagCompound haze = new NBTTagCompound();
haze.setString("type", "haze");
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(haze, x + shell.worldObj.rand.nextGaussian() * 10, y, z + shell.worldObj.rand.nextGaussian() * 10), new TargetPoint(shell.dimension, shell.posX, shell.posY, shell.posZ, 150));
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(haze, mop.hitVec.xCoord + shell.worldObj.rand.nextGaussian() * 10, mop.hitVec.yCoord, mop.hitVec.zCoord + shell.worldObj.rand.nextGaussian() * 10), new TargetPoint(shell.dimension, shell.posX, shell.posY, shell.posZ, 150));
}
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "rbmkmush");
data.setFloat("scale", 10);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord), new TargetPoint(shell.dimension, x, y, z, 250));
shell.setDead();
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord), new TargetPoint(shell.dimension, shell.posX, shell.posY, shell.posZ, 250));
}
};
/* CLUSTER SHELLS */
this.shellTypes[PHOSPHORUS_MULTI] = this.itemTypes[PHOSPHORUS_MULTI] = new ArtilleryShell("ammo_arty_phosphorus_multi") {
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { ItemAmmoArty.this.shellTypes[PHOSPHORUS].onImpact(shell, mop); }
public void onUpdate(EntityArtilleryShell shell) { standardCluster(shell, PHOSPHORUS, 10, 300, 5); }
};
this.shellTypes[MINI_NUKE_MULTI] = this.itemTypes[MINI_NUKE_MULTI] = new ArtilleryShell("ammo_arty_mini_nuke_multi") {
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { ItemAmmoArty.this.shellTypes[MINI_NUKE].onImpact(shell, mop); }
public void onUpdate(EntityArtilleryShell shell) { standardCluster(shell, MINI_NUKE, 5, 300, 5); }
};
}
}

View File

@ -272,13 +272,13 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD {
}
}
//called on click (client side, called by update cylce)
//called on click (client side, called by mouse click event)
public void startActionClient(ItemStack stack, World world, EntityPlayer player, boolean main) { }
//called on click release (server side, called by mouse packet) for release actions like charged shots
public void endAction(ItemStack stack, World world, EntityPlayer player, boolean main) { }
//called on click release (client side, called by update cylce)
//called on click release (client side, called by update cycle)
public void endActionClient(ItemStack stack, World world, EntityPlayer player, boolean main) { }
//reload action, if existent

View File

@ -0,0 +1,61 @@
package com.hbm.items.weapon;
import java.util.ArrayList;
import java.util.List;
import com.hbm.handler.GunConfiguration;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public class ItemGunBio extends ItemGunBase {
public ItemGunBio(GunConfiguration config) {
super(config);
}
/* just a test */
public static long lastShot;
public static List<double[]> smokeNodes = new ArrayList();
@Override
public void startActionClient(ItemStack stack, World world, EntityPlayer player, boolean main) {
lastShot = System.currentTimeMillis();
}
@Override
@SideOnly(Side.CLIENT)
protected void updateClient(ItemStack stack, World world, EntityPlayer entity, int slot, boolean isCurrentItem) {
super.updateClient(stack, world, entity, slot, isCurrentItem);
boolean smoking = lastShot + 3000 > System.currentTimeMillis();
if(!smoking && !smokeNodes.isEmpty()) {
smokeNodes.clear();
}
if(smoking) {
Vec3 prev = Vec3.createVectorHelper(-entity.motionX, -entity.motionY, -entity.motionZ);
prev.rotateAroundY((float) (entity.rotationYaw * Math.PI / 180D));
double accel = 15D;
double side = (entity.rotationYaw - entity.prevRotationYawHead) * 0.1D;
double waggle = 0.025D;
for(double[] node : smokeNodes) {
node[0] += prev.xCoord * accel + world.rand.nextGaussian() * waggle + side;
node[1] += prev.yCoord + 1.5D;
node[2] += prev.zCoord * accel + world.rand.nextGaussian() * waggle;
}
double alpha = (System.currentTimeMillis() - ItemGunBio.lastShot) / 3000D;
alpha = (1 - alpha) * 0.25D;
smokeNodes.add(new double[] {0, 0, 0, alpha});
}
}
}

View File

@ -452,6 +452,7 @@ public class ClientProxy extends ServerProxy {
MinecraftForgeClient.registerItemRenderer(ModItems.gun_folly, new ItemRenderOverkill());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_brimstone, new ItemRenderObj());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_hk69, new ItemRenderWeaponObj());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_bio_revolver, new ItemRenderBioRevolver());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_deagle, new ItemRenderWeaponObj());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_supershotgun, new ItemRenderWeaponShotty());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_ks23, new ItemRenderWeaponObj());

View File

@ -77,8 +77,7 @@ import com.hbm.tileentity.bomb.TileEntityNukeCustom;
import com.hbm.tileentity.machine.*;
import com.hbm.tileentity.machine.rbmk.RBMKDials;
import com.hbm.util.ArmorUtil;
import com.hbm.world.feature.OreCave;
import com.hbm.world.feature.SchistStratum;
import com.hbm.world.feature.*;
import com.hbm.world.generator.CellularDungeonFactory;
import cpw.mods.fml.common.SidedProxy;
@ -1010,27 +1009,12 @@ public class MainRegistry {
//expand for the largest entity we have (currently Quackos who is 17.5m in diameter, that's one fat duck)
World.MAX_ENTITY_RADIUS = Math.max(World.MAX_ENTITY_RADIUS, 8.75);
MinecraftForge.EVENT_BUS.register(new SchistStratum()); //DecorateBiomeEvent.Pre
//MinecraftForge.EVENT_BUS.register(new DeepLayer()); //DecorateBiomeEvent.Pre
new OreCave(ModBlocks.stone_resource, 0).setThreshold(1.5D).setRangeMult(20).setYLevel(30).setMaxRange(20).withFluid(ModBlocks.sulfuric_acid_block); //sulfur
new OreCave(ModBlocks.stone_resource, 1).setThreshold(1.75D).setRangeMult(20).setYLevel(25).setMaxRange(20); //asbestos
//new OreLayer(Blocks.coal_ore, 0.2F).setThreshold(4).setRangeMult(3).setYLevel(70);
//imagine adding flower entries but they don't actually do shit with the world generator
//"well but at least they work with bone meal, as advertised" except they fucking don't
/*BiomeGenBase.plains.addFlower(ModBlocks.plant_flower, EnumFlowerType.FOXGLOVE.ordinal(), 10);
BiomeGenBase.roofedForest.addFlower(ModBlocks.plant_flower, EnumFlowerType.NIGHTSHADE.ordinal(), 10);
BiomeGenBase.jungle.addFlower(ModBlocks.plant_flower, EnumFlowerType.TOBACCO.ordinal(), 10);*/
/*Set<Thread> threads = Thread.getAllStackTraces().keySet();
for (Thread thread : threads) {
System.out.println("Printing thread " + thread.getName());
StackTraceElement[] stackTraceElements = thread.getStackTrace();
for (StackTraceElement stackTraceElement : stackTraceElements) {
System.out.println("\t" + stackTraceElement);
}
System.out.println("");
}*/
}
@EventHandler
@ -1044,9 +1028,6 @@ public class MainRegistry {
MinecraftForge.TERRAIN_GEN_BUS.register(commonHandler);
MinecraftForge.ORE_GEN_BUS.register(commonHandler);
SchistStratum schist = new SchistStratum();
MinecraftForge.EVENT_BUS.register(schist); //DecorateBiomeEvent.Pre
OreDictManager oreMan = new OreDictManager();
MinecraftForge.EVENT_BUS.register(oreMan); //OreRegisterEvent

View File

@ -658,6 +658,7 @@ public class ResourceManager {
public static final IModelCustom spas_12 = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/spas-12.obj"));
public static final IModelCustom nightmare_dark = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/nightmare_dark.obj"));
public static final IModelCustom glass_cannon = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/glass_cannon.obj"));
public static final IModelCustom bio_revolver = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/bio_revolver.obj"));
public static final IModelCustom lance = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/lance.obj"));
@ -734,6 +735,7 @@ public class ResourceManager {
public static final ResourceLocation detonator_laser_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/detonator_laser.png");
public static final ResourceLocation spas_12_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/spas-12.png");
public static final ResourceLocation glass_cannon_panel_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/glass_cannon_panel.png");
public static final ResourceLocation bio_revolver_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/bio_revolver.png");
public static final ResourceLocation lance_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/lance.png");

View File

@ -55,6 +55,9 @@ public class ParticlePlasmaBlast extends EntityFX {
GL11.glDisable(GL11.GL_CULL_FACE);
RenderHelper.disableStandardItemLighting();
boolean fog = GL11.glIsEnabled(GL11.GL_FOG);
if(fog) GL11.glDisable(GL11.GL_FOG);
float pX = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double)interp - interpPosX);
float pY = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double)interp - interpPosY);
float pZ = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double)interp - interpPosZ);
@ -78,7 +81,8 @@ public class ParticlePlasmaBlast extends EntityFX {
tess.addVertexWithUV((double)(+ 1 * scale), (double)(- 0.25), (double)(+ 1 * scale), 0, 0);
tess.addVertexWithUV((double)(+ 1 * scale), (double)(- 0.25), (double)(- 1 * scale), 0, 1);
tess.draw();
if(fog) GL11.glEnable(GL11.GL_FOG);
GL11.glPolygonOffset(0.0F, 0.0F);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);

View File

@ -76,6 +76,9 @@ public class ParticleRBMKMush extends EntityFX {
GL11.glAlphaFunc(GL11.GL_GREATER, 0);
GL11.glDepthMask(false);
RenderHelper.disableStandardItemLighting();
boolean fog = GL11.glIsEnabled(GL11.GL_FOG);
if(fog) GL11.glDisable(GL11.GL_FOG);
tessellaator.startDrawingQuads();
@ -93,6 +96,7 @@ public class ParticleRBMKMush extends EntityFX {
tessellaator.addVertexWithUV((double) (pX + x * scale - sx * scale), (double) (pY - y * scale), (double) (pZ + z * scale - sz * scale), 0, (prog + 1) * frame);
tessellaator.draw();
if(fog) GL11.glEnable(GL11.GL_FOG);
GL11.glPolygonOffset(0.0F, 0.0F);
GL11.glEnable(GL11.GL_LIGHTING);
}

View File

@ -0,0 +1,124 @@
package com.hbm.render.item.weapon;
import org.lwjgl.opengl.GL11;
import com.hbm.items.weapon.ItemGunBio;
import com.hbm.main.ResourceManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
public class ItemRenderBioRevolver implements IItemRenderer {
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
switch(type) {
case EQUIPPED:
case EQUIPPED_FIRST_PERSON:
case ENTITY:
case INVENTORY:
return true;
default: return false;
}
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return type == ItemRenderType.ENTITY && (helper == ItemRendererHelper.ENTITY_ROTATION || helper == ItemRendererHelper.ENTITY_BOBBING);
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_CULL_FACE);
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.bio_revolver_tex);
switch(type) {
case EQUIPPED_FIRST_PERSON:
double s0 = 0.1D;
GL11.glRotated(25, 0, 0, 1);
GL11.glTranslated(1.0, 0.25, -0.25);
GL11.glRotated(80, 0, 1, 0);
GL11.glScaled(s0, s0, s0);
double width = 0.3D;
GL11.glPushMatrix();
GL11.glTranslated(0.0, 2.0, 10.0);
if(ItemGunBio.smokeNodes.size() > 1) {
Tessellator tess = Tessellator.instance;
tess.startDrawingQuads();
tess.setNormal(0F, 1F, 0F);
for(int i = 0; i < ItemGunBio.smokeNodes.size() - 1; i++) {
double[] node = ItemGunBio.smokeNodes.get(i);
double[] past = ItemGunBio.smokeNodes.get(i + 1);
tess.setColorRGBA_F(1F, 1F, 1F, (float) node[3]);
tess.addVertex(node[0] - width, node[1], node[2]);
tess.addVertex(node[0] + width, node[1], node[2]);
tess.setColorRGBA_F(1F, 1F, 1F, (float) past[3]);
tess.addVertex(past[0] + width, past[1], past[2]);
tess.addVertex(past[0] - width, past[1], past[2]);
}
GL11.glAlphaFunc(GL11.GL_GREATER, 0F);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_TEXTURE_2D);
tess.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.1F);
}
GL11.glPopMatrix();
break;
case EQUIPPED:
double scale = 0.125D;
GL11.glScaled(scale, scale, scale);
GL11.glRotatef(20F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(10, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(15F, 1.0F, 0.0F, 0.0F);
GL11.glTranslatef(4F, -2F, 5F);
break;
case ENTITY:
double s1 = 0.1D;
GL11.glScaled(s1, s1, s1);
break;
case INVENTORY:
GL11.glEnable(GL11.GL_LIGHTING);
double s = 0.8D;
GL11.glTranslated(8, 7, 0);
GL11.glRotated(-90, 0, 1, 0);
GL11.glRotated(-135, 1, 0, 0);
GL11.glScaled(s, s, -s);
break;
default: break;
}
GL11.glShadeModel(GL11.GL_SMOOTH);
ResourceManager.bio_revolver.renderAll();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();
}
}

View File

@ -828,11 +828,20 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
public AxisAlignedBB getRenderBoundingBox() {
return TileEntity.INFINITE_EXTENT_AABB;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared()
{
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
@Override
public void openInventory() {
this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.openC", 1.0F, 1.0F);
}
@Override
public void closeInventory() {
this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.closeC", 1.0F, 1.0F);
}
}

View File

@ -6,6 +6,7 @@ import java.util.List;
import com.hbm.handler.HazmatRegistry;
import com.hbm.hazard.HazardRegistry;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
@ -20,8 +21,15 @@ public class Compat {
public static final String MOD_REC = "ReactorCraft";
public static Item tryLoadItem(String domain, String name) {
String reg = domain + ":" + name;
return (Item) Item.itemRegistry.getObject(reg);
return (Item) Item.itemRegistry.getObject(getReg(domain, name));
}
public static Block tryLoadBlock(String domain, String name) {
return (Block) Block.blockRegistry.getObject(getReg(domain, name));
}
private static String getReg(String domain, String name) {
return domain + ":" + name;
}
public static enum ReikaIsotope {

View File

@ -0,0 +1,81 @@
package com.hbm.world.feature;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.NoiseGeneratorPerlin;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
public class DeepLayer {
NoiseGeneratorPerlin noise;
@SubscribeEvent
public void onDecorate(DecorateBiomeEvent.Pre event) {
if(this.noise == null) {
this.noise = new NoiseGeneratorPerlin(new Random(event.world.getSeed() + 19), 4);
}
World world = event.world;
if(world.provider.dimensionId != 0)
return;
int cX = event.chunkX;
int cZ = event.chunkZ;
double scale = 0.01D;
int threshold = 2;
for(int x = cX + 8; x < cX + 24; x++) {
for(int z = cZ + 8; z < cZ + 24; z++) {
double n = noise.func_151601_a(x * scale, z * scale);
if(n > threshold) {
int range = (int)((n - threshold) * 8);
if(range > 24)
range = 48 - range;
if(range < 0)
continue;
for(int y = 1; y <= range; y++) {
Block target = world.getBlock(x, y, z);
if(target.isNormalCube() && target.getMaterial() == Material.rock && target != Blocks.bedrock) {
boolean lava = false;
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
Block neighbor = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
if(neighbor.getMaterial() == Material.lava) {
lava = true;
break;
}
}
if(lava || world.rand.nextInt(10) == 0) {
world.setBlock(x, y, z, ModBlocks.stone_deep_cobble, 1, 2);
} else if(world.rand.nextInt(10) == 0 && world.getBlock(x, y + 1, z).getMaterial() == Material.air) {
world.setBlock(x, y, z, ModBlocks.stone_deep_cobble, 2, 2);
} else {
world.setBlock(x, y, z, ModBlocks.stone_deep_cobble, 0, 2);
}
}
}
}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -42,6 +42,8 @@
"block.crateClose": {"category": "block", "sounds": [{"name": "block/crateClose", "stream": false}]},
"block.storageOpen": {"category": "block", "sounds": [{"name": "block/storageOpen", "stream": false}]},
"block.storageClose": {"category": "block", "sounds": [{"name": "block/storageClose", "stream": false}]},
"block.openC": {"category": "block", "sounds": ["block/openC1", "block/openC2", "block/openCSqueaky"]},
"block.closeC": {"category": "block", "sounds": ["block/closeC1", "block/closeC2", "block/closeC3"]},
"door.TransitionSealOpen": {"category": "block", "sounds": [{"name": "block/door/transition_seal_open", "stream": true}]},
@ -157,6 +159,7 @@
"weapon.extinguisher": {"category": "player", "sounds": [{"name": "weapon/extinguisher", "stream": false}]},
"weapon.robin_explosion": {"category": "player", "sounds": [{"name": "weapon/robin_explosion", "stream": false}]},
"weapon.shotgunPump": {"category": "player", "sounds": [{"name": "weapon/shotgunShootPump", "stream": false}]},
"weapon.explosionMedium": {"category": "player", "sounds": [{"name": "weapon/explosion_medium", "stream": false}]},
"weapon.dFlash": {"category": "player", "sounds": [{"name": "weapon/dFlash", "stream": false}]},

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB