added soyuz capsule, soyuz cargo functionality and new .357 textures

This commit is contained in:
HbmMods 2020-04-28 22:32:14 +02:00
parent be11ba758f
commit fe1fac57e7
33 changed files with 761 additions and 38 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 B

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 B

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 B

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 B

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

After

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 B

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 B

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 B

After

Width:  |  Height:  |  Size: 349 B

View File

@ -282,6 +282,9 @@ public class ModBlocks {
public static Block sat_dock; public static Block sat_dock;
public static final int guiID_dock = 80; public static final int guiID_dock = 80;
public static Block soyuz_capsule;
public static final int guiID_capsule = 93;
public static Block crate_iron; public static Block crate_iron;
public static final int guiID_crate_iron = 46; public static final int guiID_crate_iron = 46;
@ -1159,6 +1162,7 @@ public class ModBlocks {
sat_resonator = new DecoBlock(Material.iron).setBlockName("sat_resonator").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":sat_resonator"); sat_resonator = new DecoBlock(Material.iron).setBlockName("sat_resonator").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":sat_resonator");
sat_dock = new MachineSatDock(Material.iron).setBlockName("sat_dock").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":sat_dock"); sat_dock = new MachineSatDock(Material.iron).setBlockName("sat_dock").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":sat_dock");
soyuz_capsule = new SoyuzCapsule(Material.iron).setBlockName("soyuz_capsule").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":soyuz_capsule");
turret_light = new TurretLight(Material.iron).setBlockName("turret_light").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.weaponTab).setBlockTextureName(RefStrings.MODID + ":turret_light"); turret_light = new TurretLight(Material.iron).setBlockName("turret_light").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.weaponTab).setBlockTextureName(RefStrings.MODID + ":turret_light");
turret_heavy = new TurretHeavy(Material.iron).setBlockName("turret_heavy").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.weaponTab).setBlockTextureName(RefStrings.MODID + ":turret_heavy"); turret_heavy = new TurretHeavy(Material.iron).setBlockName("turret_heavy").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.weaponTab).setBlockTextureName(RefStrings.MODID + ":turret_heavy");
@ -1800,6 +1804,7 @@ public class ModBlocks {
GameRegistry.registerBlock(launch_table, launch_table.getUnlocalizedName()); GameRegistry.registerBlock(launch_table, launch_table.getUnlocalizedName());
GameRegistry.registerBlock(soyuz_launcher, soyuz_launcher.getUnlocalizedName()); GameRegistry.registerBlock(soyuz_launcher, soyuz_launcher.getUnlocalizedName());
GameRegistry.registerBlock(sat_dock, sat_dock.getUnlocalizedName()); GameRegistry.registerBlock(sat_dock, sat_dock.getUnlocalizedName());
GameRegistry.registerBlock(soyuz_capsule, soyuz_capsule.getUnlocalizedName());
GameRegistry.registerBlock(machine_radar, machine_radar.getUnlocalizedName()); GameRegistry.registerBlock(machine_radar, machine_radar.getUnlocalizedName());
//Guide //Guide

View File

@ -123,11 +123,11 @@ public class GeigerCounter extends BlockContainer {
{ {
world.playSoundAtEntity(player, "hbm:item.techBoop", 1.0F, 1.0F); world.playSoundAtEntity(player, "hbm:item.techBoop", 1.0F, 1.0F);
int eRad = (int)player.getEntityData().getFloat("hfr_radiation"); double eRad = ((int)(player.getEntityData().getFloat("hfr_radiation") * 10)) / 10D;
RadiationSavedData data = RadiationSavedData.getData(player.worldObj); RadiationSavedData data = RadiationSavedData.getData(player.worldObj);
Chunk chunk = world.getChunkFromBlockCoords((int)player.posX, (int)player.posZ); Chunk chunk = world.getChunkFromBlockCoords((int)player.posX, (int)player.posZ);
int rads = (int)Math.ceil(data.getRadNumFromCoord(chunk.xPosition, chunk.zPosition)); double rads = ((int)(data.getRadNumFromCoord(chunk.xPosition, chunk.zPosition) * 10)) / 10D;
player.addChatMessage(new ChatComponentText("Current chunk radiation: " + rads + " RAD/s")); player.addChatMessage(new ChatComponentText("Current chunk radiation: " + rads + " RAD/s"));
player.addChatMessage(new ChatComponentText("Player contamination: " + eRad + " RAD")); player.addChatMessage(new ChatComponentText("Player contamination: " + eRad + " RAD"));

View File

@ -0,0 +1,108 @@
package com.hbm.blocks.machine;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.machine.TileEntitySoyuzCapsule;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class SoyuzCapsule extends BlockContainer {
public SoyuzCapsule(Material p_i45386_1_) {
super(p_i45386_1_);
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
return new TileEntitySoyuzCapsule();
}
@Override
public int getRenderType(){
return -1;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if(world.isRemote)
{
return true;
} else if(!player.isSneaking())
{
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_capsule, world, x, y, z);
return true;
} else {
return false;
}
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
{
IInventory tileentityfurnace = (IInventory) world.getTileEntity(x, y, z);
Random rand = world.rand;
if (tileentityfurnace != null) {
for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) {
ItemStack itemstack = tileentityfurnace.getStackInSlot(i1);
if (itemstack != null) {
float f = rand.nextFloat() * 0.8F + 0.1F;
float f1 = rand.nextFloat() * 0.8F + 0.1F;
float f2 = rand.nextFloat() * 0.8F + 0.1F;
while (itemstack.stackSize > 0) {
int j1 = rand.nextInt(21) + 10;
if (j1 > itemstack.stackSize) {
j1 = itemstack.stackSize;
}
itemstack.stackSize -= j1;
EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
if (itemstack.hasTagCompound()) {
entityitem.getEntityItem()
.setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
}
float f3 = 0.05F;
entityitem.motionX = (float) rand.nextGaussian() * f3;
entityitem.motionY = (float) rand.nextGaussian() * f3 + 0.2F;
entityitem.motionZ = (float) rand.nextGaussian() * f3;
world.spawnEntityInWorld(entityitem);
}
}
}
world.func_147453_f(x, y, z, block);
}
super.breakBlock(world, x, y, z, block, meta);
}
}

View File

@ -1,10 +1,10 @@
package com.hbm.entity.missile; package com.hbm.entity.missile;
import com.hbm.explosion.ExplosionLarge; import com.hbm.explosion.ExplosionLarge;
import com.hbm.packet.AuxParticlePacket; import com.hbm.main.MainRegistry;
import com.hbm.packet.PacketDispatcher;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
@ -40,17 +40,22 @@ public class EntityBobmazon extends Entity {
for(int i = 0; i < 4; i++) { for(int i = 0; i < 4; i++) {
if(!this.worldObj.isRemote && i % 2 == 0)
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacket(posX, posY + 1, posZ, 2), new TargetPoint(worldObj.provider.dimensionId, posX, posY + 1, posZ, 300));
if(worldObj.getBlock((int)(posX - 0.5), (int)(posY + 1), (int)(posZ - 0.5)).getMaterial() != Material.air && !worldObj.isRemote && dataWatcher.getWatchableObjectInt(16) != 1) { if(worldObj.getBlock((int)(posX - 0.5), (int)(posY + 1), (int)(posZ - 0.5)).getMaterial() != Material.air && !worldObj.isRemote && dataWatcher.getWatchableObjectInt(16) != 1) {
this.setDead(); ExplosionLarge.spawnParticles(worldObj, posX, posY + 1, posZ, 50);
ExplosionLarge.spawnParticles(worldObj, posX, posY, posZ, 50);
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "hbm:entity.oldExplosion", 10.0F, 0.5F + this.rand.nextFloat() * 0.1F); this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "hbm:entity.oldExplosion", 10.0F, 0.5F + this.rand.nextFloat() * 0.1F);
if(payload != null) if(payload != null) {
worldObj.spawnEntityInWorld(new EntityItem(worldObj, posX, posY + 2, posZ, payload)); EntityItem pack = new EntityItem(worldObj, posX, posY + 2, posZ, payload);
pack.motionX = 0;
pack.motionZ = 0;
if(!worldObj.spawnEntityInWorld(pack))
System.out.println("BBBBBBBBBBB");
} else {
System.out.println("AAAAAAAAAAAA");
}
this.setDead();
break; break;
} }
@ -59,12 +64,43 @@ public class EntityBobmazon extends Entity {
this.posY += this.motionY; this.posY += this.motionY;
this.posZ += this.motionZ; this.posZ += this.motionZ;
} }
if(worldObj.isRemote) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "exhaust");
data.setString("mode", "meteor");
data.setInteger("count", 1);
data.setDouble("width", 0);
data.setDouble("posX", posX);
data.setDouble("posY", posY + 1);
data.setDouble("posZ", posZ);
MainRegistry.proxy.effectNT(data);
}
} }
@Override @Override
protected void readEntityFromNBT(NBTTagCompound nbt) { } protected void readEntityFromNBT(NBTTagCompound nbt) {
NBTTagCompound nbt1 = (NBTTagCompound)nbt.getTag("payload");
this.payload = ItemStack.loadItemStackFromNBT(nbt1);
}
@Override @Override
protected void writeEntityToNBT(NBTTagCompound nbt) { } protected void writeEntityToNBT(NBTTagCompound nbt) {
NBTTagCompound nbt1 = new NBTTagCompound();
payload.writeToNBT(nbt1);
nbt.setTag("payload", nbt1);
}
@Override
@SideOnly(Side.CLIENT)
public boolean isInRangeToRenderDist(double distance)
{
return distance < 500000;
}
} }

View File

@ -11,11 +11,14 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
public class EntitySoyuz extends Entity { public class EntitySoyuz extends Entity {
double acceleration = 0.00D; double acceleration = 0.00D;
public int mode; public int mode;
public int targetX;
public int targetZ;
private ItemStack[] payload; private ItemStack[] payload;
@ -76,6 +79,23 @@ public class EntitySoyuz extends Entity {
} }
if(mode == 1) {
EntitySoyuzCapsule capsule = new EntitySoyuzCapsule(worldObj);
capsule.payload = this.payload;
capsule.soyuz = this.getSkin();
capsule.setPosition(targetX + 0.5, 600, targetZ + 0.5);
System.out.println(capsule.posX + " " + capsule.posZ);
IChunkProvider provider = worldObj.getChunkProvider();
provider.loadChunk(targetX >> 4, targetZ >> 4);
if(worldObj.spawnEntityInWorld(capsule))
System.out.println("Success!");
else
System.out.println("Crap.");
}
this.setDead(); this.setDead();
} }
@ -114,6 +134,11 @@ public class EntitySoyuz extends Entity {
public void readEntityFromNBT(NBTTagCompound nbt) { public void readEntityFromNBT(NBTTagCompound nbt) {
NBTTagList list = nbt.getTagList("items", 10); NBTTagList list = nbt.getTagList("items", 10);
this.setSkin(nbt.getInteger("skin"));
targetX = nbt.getInteger("targetX");
targetZ = nbt.getInteger("targetZ");
mode = nbt.getInteger("mode");
for (int i = 0; i < list.tagCount(); i++) { for (int i = 0; i < list.tagCount(); i++) {
NBTTagCompound nbt1 = list.getCompoundTagAt(i); NBTTagCompound nbt1 = list.getCompoundTagAt(i);
@ -129,6 +154,11 @@ public class EntitySoyuz extends Entity {
NBTTagList list = new NBTTagList(); NBTTagList list = new NBTTagList();
nbt.setInteger("skin", this.getSkin());
nbt.setInteger("targetX", targetX);
nbt.setInteger("targetZ", targetZ);
nbt.setInteger("mode", mode);
for (int i = 0; i < payload.length; i++) { for (int i = 0; i < payload.length; i++) {
if (payload[i] != null) { if (payload[i] != null) {
NBTTagCompound nbt1 = new NBTTagCompound(); NBTTagCompound nbt1 = new NBTTagCompound();

View File

@ -0,0 +1,107 @@
package com.hbm.entity.missile;
import com.hbm.blocks.ModBlocks;
import com.hbm.items.ModItems;
import com.hbm.tileentity.machine.TileEntitySoyuzCapsule;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class EntitySoyuzCapsule extends EntityThrowable {
public int soyuz;
public ItemStack[] payload = new ItemStack[18];
public EntitySoyuzCapsule(World p_i1582_1_) {
super(p_i1582_1_);
this.ignoreFrustumCheck = true;
this.isImmuneToFire = true;
}
@Override
public void onUpdate() {
this.lastTickPosX = this.prevPosX = posX;
this.lastTickPosY = this.prevPosY = posY;
this.lastTickPosZ = this.prevPosZ = posZ;
this.setPosition(posX + this.motionX, posY + this.motionY, posZ + this.motionZ);
if(this.motionY > -0.2)
this.motionY -= 0.02;
if(posY > 600)
posY = 600;
if(this.worldObj.getBlock((int)this.posX, (int)this.posY, (int)this.posZ) != Blocks.air) {
this.setDead();
if(!worldObj.isRemote) {
worldObj.setBlock((int)(this.posX), (int)(this.posY + 1), (int)(this.posZ), ModBlocks.soyuz_capsule);
TileEntitySoyuzCapsule capsule = (TileEntitySoyuzCapsule)worldObj.getTileEntity((int)(this.posX), (int)(this.posY + 1), (int)(this.posZ));
if(capsule != null) {
for(int i = 0; i < payload.length; i++) {
capsule.setInventorySlotContents(i, payload[i]);
}
}
capsule.setInventorySlotContents(18, new ItemStack(ModItems.missile_soyuz, 1, soyuz));
}
}
}
@Override
protected void onImpact(MovingObjectPosition p_70184_1_) {
}
@Override
@SideOnly(Side.CLIENT)
public boolean isInRangeToRenderDist(double distance)
{
return distance < 500000;
}
@Override
public void readEntityFromNBT(NBTTagCompound nbt) {
NBTTagList list = nbt.getTagList("items", 10);
soyuz = nbt.getInteger("soyuz");
for (int i = 0; i < list.tagCount(); i++) {
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
byte b0 = nbt1.getByte("slot");
if (b0 >= 0 && b0 < payload.length) {
payload[b0] = ItemStack.loadItemStackFromNBT(nbt1);
}
}
}
@Override
public void writeEntityToNBT(NBTTagCompound nbt) {
NBTTagList list = new NBTTagList();
nbt.setInteger("soyuz", soyuz);
for (int i = 0; i < payload.length; i++) {
if (payload[i] != null) {
NBTTagCompound nbt1 = new NBTTagCompound();
nbt1.setByte("slot", (byte) i);
payload[i].writeToNBT(nbt1);
list.appendTag(nbt1);
}
}
nbt.setTag("items", list);
}
}

View File

@ -831,6 +831,15 @@ public class GUIHandler implements IGuiHandler {
} }
return null; return null;
} }
case ModBlocks.guiID_capsule:
{
if(entity instanceof TileEntitySoyuzCapsule)
{
return new ContainerSoyuzCapsule(player.inventory, (TileEntitySoyuzCapsule) entity);
}
return null;
}
} }
} else { } else {
//NON-TE CONTAINERS //NON-TE CONTAINERS
@ -1661,6 +1670,15 @@ public class GUIHandler implements IGuiHandler {
} }
return null; return null;
} }
case ModBlocks.guiID_capsule:
{
if(entity instanceof TileEntitySoyuzCapsule)
{
return new GUISoyuzCapsule(player.inventory, (TileEntitySoyuzCapsule) entity);
}
return null;
}
} }
} else { } else {
//CLIENTONLY GUIS //CLIENTONLY GUIS

View File

@ -48,4 +48,4 @@ public class ContainerCoreEmitter extends Container {
return var3; return var3;
} }
} }

View File

@ -0,0 +1,81 @@
package com.hbm.inventory.container;
import com.hbm.tileentity.machine.TileEntitySoyuzCapsule;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerSoyuzCapsule extends Container {
private TileEntitySoyuzCapsule diFurnace;
public ContainerSoyuzCapsule(InventoryPlayer invPlayer, TileEntitySoyuzCapsule tedf) {
diFurnace = tedf;
for(int i = 0; i < 3; i++)
{
for(int j = 0; j < 6; j++)
{
this.addSlotToContainer(new Slot(tedf, j + i * 6, 8 + j * 18 + 18 * 2, 17 + i * 18));
}
}
this.addSlotToContainer(new Slot(tedf, 18, 8, 35));
for(int i = 0; i < 3; i++)
{
for(int j = 0; j < 9; j++)
{
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for(int i = 0; i < 9; i++)
{
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2)
{
ItemStack var3 = null;
Slot var4 = (Slot) this.inventorySlots.get(par2);
if (var4 != null && var4.getHasStack())
{
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if (par2 <= diFurnace.getSizeInventory() - 1) {
if (!this.mergeItemStack(var5, diFurnace.getSizeInventory(), this.inventorySlots.size(), true))
{
return null;
}
}
else if (!this.mergeItemStack(var5, 0, diFurnace.getSizeInventory(), false))
{
return null;
}
if (var5.stackSize == 0)
{
var4.putStack((ItemStack) null);
}
else
{
var4.onSlotChanged();
}
}
return var3;
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return diFurnace.isUseableByPlayer(player);
}
}

View File

@ -77,7 +77,7 @@ public class GUICoreEmitter extends GuiInfoContainer {
@Override @Override
protected void drawGuiContainerForegroundLayer( int i, int j) { protected void drawGuiContainerForegroundLayer( int i, int j) {
String name = this.emitter.hasCustomInventoryName() ? this.emitter.getInventoryName() : I18n.format(this.emitter.getInventoryName()); String name = I18n.format(this.emitter.getInventoryName());
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString("Output: " + Library.getShortNumber(emitter.prev) + "Spk", 50, 30, 0xFF7F7F); this.fontRendererObj.drawString("Output: " + Library.getShortNumber(emitter.prev) + "Spk", 50, 30, 0xFF7F7F);

View File

@ -0,0 +1,42 @@
package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerSoyuzCapsule;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntitySoyuzCapsule;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GUISoyuzCapsule extends GuiContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_soyuz_capsule.png");
private TileEntitySoyuzCapsule diFurnace;
public GUISoyuzCapsule(InventoryPlayer invPlayer, TileEntitySoyuzCapsule tedf) {
super(new ContainerSoyuzCapsule(invPlayer, tedf));
diFurnace = tedf;
this.xSize = 176;
this.ySize = 168;
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
}
}

View File

@ -91,6 +91,7 @@ public class ItemGeigerCounter extends Item {
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int i, float f0, float f1, float f2) public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int i, float f0, float f1, float f2)
{ {
if(world.getBlock(x, y, z) == ModBlocks.block_red_copper) { if(world.getBlock(x, y, z) == ModBlocks.block_red_copper) {
world.func_147480_a(x, y, z, false);
player.inventory.consumeInventoryItem(ModItems.geiger_counter); player.inventory.consumeInventoryItem(ModItems.geiger_counter);
player.inventory.addItemStackToInventory(new ItemStack(ModItems.survey_scanner)); player.inventory.addItemStackToInventory(new ItemStack(ModItems.survey_scanner));
return true; return true;
@ -105,11 +106,11 @@ public class ItemGeigerCounter extends Item {
if(!world.isRemote) { if(!world.isRemote) {
world.playSoundAtEntity(player, "hbm:item.techBoop", 1.0F, 1.0F); world.playSoundAtEntity(player, "hbm:item.techBoop", 1.0F, 1.0F);
int eRad = (int)player.getEntityData().getFloat("hfr_radiation"); double eRad = ((int)(player.getEntityData().getFloat("hfr_radiation") * 10)) / 10D;
RadiationSavedData data = RadiationSavedData.getData(player.worldObj); RadiationSavedData data = RadiationSavedData.getData(player.worldObj);
Chunk chunk = world.getChunkFromBlockCoords((int)player.posX, (int)player.posZ); Chunk chunk = world.getChunkFromBlockCoords((int)player.posX, (int)player.posZ);
int rads = (int)Math.ceil(data.getRadNumFromCoord(chunk.xPosition, chunk.zPosition)); double rads = ((int)(data.getRadNumFromCoord(chunk.xPosition, chunk.zPosition) * 10)) / 10D;
player.addChatMessage(new ChatComponentText("Current chunk radiation: " + rads + " RAD/s")); player.addChatMessage(new ChatComponentText("Current chunk radiation: " + rads + " RAD/s"));
player.addChatMessage(new ChatComponentText("Player contamination: " + eRad + " RAD")); player.addChatMessage(new ChatComponentText("Player contamination: " + eRad + " RAD"));

View File

@ -102,6 +102,7 @@ import com.hbm.render.entity.rocket.RenderMissileStrong;
import com.hbm.render.entity.rocket.RenderMissileTaint; import com.hbm.render.entity.rocket.RenderMissileTaint;
import com.hbm.render.entity.rocket.RenderMissileThermo; import com.hbm.render.entity.rocket.RenderMissileThermo;
import com.hbm.render.entity.rocket.RenderSoyuz; import com.hbm.render.entity.rocket.RenderSoyuz;
import com.hbm.render.entity.rocket.RenderSoyuzCapsule;
import com.hbm.render.item.*; import com.hbm.render.item.*;
import com.hbm.render.loader.HmfModelLoader; import com.hbm.render.loader.HmfModelLoader;
import com.hbm.render.tileentity.*; import com.hbm.render.tileentity.*;
@ -405,6 +406,7 @@ public class ClientProxy extends ServerProxy
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCompactLauncher.class, new RenderCompactLauncher()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCompactLauncher.class, new RenderCompactLauncher());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLaunchTable.class, new RenderLaunchTable()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLaunchTable.class, new RenderLaunchTable());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySoyuzLauncher.class, new RenderSoyuzLauncher()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySoyuzLauncher.class, new RenderSoyuzLauncher());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySoyuzCapsule.class, new RenderCapsule());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCable.class, new RenderCable()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCable.class, new RenderCable());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityOilDuct.class, new RenderOilDuct()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityOilDuct.class, new RenderOilDuct());
@ -459,6 +461,7 @@ public class ClientProxy extends ServerProxy
RenderingRegistry.registerEntityRenderingHandler(EntityCarrier.class, new RenderCarrierMissile()); RenderingRegistry.registerEntityRenderingHandler(EntityCarrier.class, new RenderCarrierMissile());
RenderingRegistry.registerEntityRenderingHandler(EntityBooster.class, new RenderBoosterMissile()); RenderingRegistry.registerEntityRenderingHandler(EntityBooster.class, new RenderBoosterMissile());
RenderingRegistry.registerEntityRenderingHandler(EntitySoyuz.class, new RenderSoyuz()); RenderingRegistry.registerEntityRenderingHandler(EntitySoyuz.class, new RenderSoyuz());
RenderingRegistry.registerEntityRenderingHandler(EntitySoyuzCapsule.class, new RenderSoyuzCapsule());
RenderingRegistry.registerEntityRenderingHandler(EntityBomber.class, new RenderBomber()); RenderingRegistry.registerEntityRenderingHandler(EntityBomber.class, new RenderBomber());
RenderingRegistry.registerEntityRenderingHandler(EntityBurningFOEQ.class, new RenderFOEQ()); RenderingRegistry.registerEntityRenderingHandler(EntityBurningFOEQ.class, new RenderFOEQ());
RenderingRegistry.registerEntityRenderingHandler(EntityFallingNuke.class, new RenderFallingNuke()); RenderingRegistry.registerEntityRenderingHandler(EntityFallingNuke.class, new RenderFallingNuke());

View File

@ -542,6 +542,7 @@ public class MainRegistry
GameRegistry.registerTileEntity(TileEntityTesla.class, "tileentity_tesla_coil"); GameRegistry.registerTileEntity(TileEntityTesla.class, "tileentity_tesla_coil");
GameRegistry.registerTileEntity(TileEntityBarrel.class, "tileentity_fluid_barrel"); GameRegistry.registerTileEntity(TileEntityBarrel.class, "tileentity_fluid_barrel");
GameRegistry.registerTileEntity(TileEntityCyberCrab.class, "tileentity_crabs"); GameRegistry.registerTileEntity(TileEntityCyberCrab.class, "tileentity_crabs");
GameRegistry.registerTileEntity(TileEntitySoyuzCapsule.class, "tileentity_soyuz_capsule");
EntityRegistry.registerModEntity(EntityRocket.class, "entity_rocket", 0, this, 250, 1, true); EntityRegistry.registerModEntity(EntityRocket.class, "entity_rocket", 0, this, 250, 1, true);
EntityRegistry.registerModEntity(EntityNukeExplosion.class, "entity_nuke_explosion", 1, this, 250, 1, true); EntityRegistry.registerModEntity(EntityNukeExplosion.class, "entity_nuke_explosion", 1, this, 250, 1, true);
@ -688,6 +689,7 @@ public class MainRegistry
EntityRegistry.registerModEntity(EntityTomBlast.class, "entity_tom_bust", 142, this, 1000, 1, true); EntityRegistry.registerModEntity(EntityTomBlast.class, "entity_tom_bust", 142, this, 1000, 1, true);
EntityRegistry.registerModEntity(EntityBuilding.class, "entity_falling_building", 143, this, 1000, 1, true); EntityRegistry.registerModEntity(EntityBuilding.class, "entity_falling_building", 143, this, 1000, 1, true);
EntityRegistry.registerModEntity(EntitySoyuz.class, "entity_soyuz", 144, this, 1000, 1, true); EntityRegistry.registerModEntity(EntitySoyuz.class, "entity_soyuz", 144, this, 1000, 1, true);
EntityRegistry.registerModEntity(EntitySoyuzCapsule.class, "entity_soyuz_capsule", 145, this, 1000, 1, true);
EntityRegistry.registerGlobalEntityID(EntityNuclearCreeper.class, "entity_mob_nuclear_creeper", EntityRegistry.findGlobalUniqueEntityId(), 0x204131, 0x75CE00); EntityRegistry.registerGlobalEntityID(EntityNuclearCreeper.class, "entity_mob_nuclear_creeper", EntityRegistry.findGlobalUniqueEntityId(), 0x204131, 0x75CE00);
EntityRegistry.registerGlobalEntityID(EntityTaintedCreeper.class, "entity_mob_tainted_creeper", EntityRegistry.findGlobalUniqueEntityId(), 0x813b9b, 0xd71fdd); EntityRegistry.registerGlobalEntityID(EntityTaintedCreeper.class, "entity_mob_tainted_creeper", EntityRegistry.findGlobalUniqueEntityId(), 0x813b9b, 0xd71fdd);

View File

@ -283,8 +283,11 @@ public class ModEventHandler
if(eRad < 200 || entity instanceof EntityNuclearCreeper || entity instanceof EntityMooshroom || entity instanceof EntityZombie || entity instanceof EntitySkeleton) if(eRad < 200 || entity instanceof EntityNuclearCreeper || entity instanceof EntityMooshroom || entity instanceof EntityZombie || entity instanceof EntitySkeleton)
continue; continue;
if(eRad > 2500)
entity.getEntityData().setFloat("hfr_radiation", 2500);
if(eRad >= 1000) { if(eRad >= 1000) {
if(entity.attackEntityFrom(ModDamageSource.radiation, 1000)) if(entity.attackEntityFrom(ModDamageSource.radiation, entity.getMaxHealth() * 100))
entity.getEntityData().setFloat("hfr_radiation", 0); entity.getEntityData().setFloat("hfr_radiation", 0);
} else if(eRad >= 800) { } else if(eRad >= 800) {
if(event.world.rand.nextInt(300) == 0) if(event.world.rand.nextInt(300) == 0)

View File

@ -97,7 +97,7 @@ public class ItemBobmazonPacket implements IMessage {
bob.posX = p.posX + rand.nextGaussian() * 10; bob.posX = p.posX + rand.nextGaussian() * 10;
bob.posY = 300; bob.posY = 300;
bob.posZ = p.posZ + rand.nextGaussian() * 10; bob.posZ = p.posZ + rand.nextGaussian() * 10;
bob.payload = stack; bob.payload = stack.copy();
world.spawnEntityInWorld(bob); world.spawnEntityInWorld(bob);
} else { } else {

View File

@ -3,6 +3,7 @@ package com.hbm.packet;
import java.io.IOException; import java.io.IOException;
import com.hbm.tileentity.TileEntityMachineBase; import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.tileentity.TileEntityTickingBase;
import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
@ -74,17 +75,16 @@ public class NBTPacket implements IMessage {
TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(m.x, m.y, m.z); TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(m.x, m.y, m.z);
if(!(te instanceof TileEntityMachineBase))
return null;
TileEntityMachineBase base = (TileEntityMachineBase)te;
try { try {
NBTTagCompound nbt = m.buffer.readNBTTagCompoundFromBuffer(); NBTTagCompound nbt = m.buffer.readNBTTagCompoundFromBuffer();
if(nbt != null) if(nbt != null) {
base.networkUnpack(nbt); if(te instanceof TileEntityMachineBase)
((TileEntityMachineBase) te).networkUnpack(nbt);
if(te instanceof TileEntityTickingBase)
((TileEntityTickingBase) te).networkUnpack(nbt);
}
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -0,0 +1,44 @@
package com.hbm.render.entity.rocket;
import org.lwjgl.opengl.GL11;
import com.hbm.main.ResourceManager;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
public class RenderSoyuzCapsule extends Render {
@Override
public void doRender(Entity entity, double x, double y, double z, float i, float j) {
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
double time = (entity.worldObj.getTotalWorldTime());
double sine = Math.sin(time * 0.05) * 5;
double sin3 = Math.sin(time * 0.05 + Math.PI * 0.5) * 5;
int height = 7;
GL11.glTranslated(0.0F, height, 0.0F);
GL11.glRotated(sine, 0, 0, 1);
GL11.glRotated(sin3, 1, 0, 0);
GL11.glTranslated(0.0F, -height, 0.0F);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.soyuz_lander_tex);
ResourceManager.soyuz_lander.renderPart("Capsule");
bindTexture(ResourceManager.soyuz_chute_tex);
ResourceManager.soyuz_lander.renderPart("Chute");
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
return ResourceManager.soyuz_lander_tex;
}
}

View File

@ -0,0 +1,32 @@
package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.main.ResourceManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
public class RenderCapsule extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float i) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y, z + 0.5);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glTranslatef(0.0F, -0.25F, 0.0F);
GL11.glRotatef(-25, 0, 1, 0);
GL11.glRotatef(15, 0, 0, 1);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.soyuz_lander_tex);
ResourceManager.soyuz_lander.renderPart("Capsule");
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();
}
}

View File

@ -4,7 +4,6 @@ import org.lwjgl.opengl.GL11;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.render.util.SoyuzPronter;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;

View File

@ -0,0 +1,167 @@
package com.hbm.tileentity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
public abstract class TileEntityInventoryBase extends TileEntity implements ISidedInventory {
public ItemStack slots[];
private String customName;
public TileEntityInventoryBase(int scount) {
slots = new ItemStack[scount];
}
@Override
public int getSizeInventory() {
return slots.length;
}
@Override
public ItemStack getStackInSlot(int i) {
return slots[i];
}
@Override
public ItemStack getStackInSlotOnClosing(int i) {
if(slots[i] != null)
{
ItemStack itemStack = slots[i];
slots[i] = null;
return itemStack;
} else {
return null;
}
}
@Override
public void setInventorySlotContents(int i, ItemStack itemStack) {
slots[i] = itemStack;
if(itemStack != null && itemStack.stackSize > getInventoryStackLimit())
{
itemStack.stackSize = getInventoryStackLimit();
}
}
@Override
public String getInventoryName() {
return this.hasCustomInventoryName() ? this.customName : getName();
}
public abstract String getName();
@Override
public boolean hasCustomInventoryName() {
return this.customName != null && this.customName.length() > 0;
}
public void setCustomName(String name) {
this.customName = name;
}
@Override
public int getInventoryStackLimit() {
return 64;
}
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this)
{
return false;
}else{
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=128;
}
}
@Override
public void openInventory() {}
@Override
public void closeInventory() {}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
return false;
}
@Override
public ItemStack decrStackSize(int i, int j) {
if(slots[i] != null)
{
if(slots[i].stackSize <= j)
{
ItemStack itemStack = slots[i];
slots[i] = null;
return itemStack;
}
ItemStack itemStack1 = slots[i].splitStack(j);
if (slots[i].stackSize == 0)
{
slots[i] = null;
}
return itemStack1;
} else {
return null;
}
}
@Override
public boolean canInsertItem(int i, ItemStack itemStack, int j) {
return this.isItemValidForSlot(i, itemStack);
}
@Override
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
return false;
}
@Override
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
return new int[] { 0 };
}
@Override
public boolean canUpdate() {
return false;
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
NBTTagList list = nbt.getTagList("items", 10);
for(int i = 0; i < list.tagCount(); i++)
{
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
byte b0 = nbt1.getByte("slot");
if(b0 >= 0 && b0 < slots.length)
{
slots[b0] = ItemStack.loadItemStackFromNBT(nbt1);
}
}
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
NBTTagList list = new NBTTagList();
for(int i = 0; i < slots.length; i++)
{
if(slots[i] != null)
{
NBTTagCompound nbt1 = new NBTTagCompound();
nbt1.setByte("slot", (byte)i);
slots[i].writeToNBT(nbt1);
list.appendTag(nbt1);
}
}
nbt.setTag("items", list);
}
}

View File

@ -0,0 +1,35 @@
package com.hbm.tileentity;
import com.hbm.packet.NBTPacket;
import com.hbm.packet.PacketDispatcher;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.FluidTank;
public abstract class TileEntityTickingBase extends TileEntity {
public TileEntityTickingBase() { }
public abstract String getInventoryName();
public int getGaugeScaled(int i, FluidTank tank) {
return tank.getFluidAmount() * i / tank.getCapacity();
}
//abstracting this method forces child classes to implement it
//so i don't have to remember the fucking method name
//was it update? onUpdate? updateTile? did it have any args?
//shit i don't know man
@Override
public abstract void updateEntity();
public void networkPack(NBTTagCompound nbt, int range) {
if(!worldObj.isRemote)
PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(nbt, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range));
}
public void networkUnpack(NBTTagCompound nbt) { }
}

View File

@ -0,0 +1,16 @@
package com.hbm.tileentity.machine;
import com.hbm.tileentity.TileEntityInventoryBase;
public class TileEntitySoyuzCapsule extends TileEntityInventoryBase {
public TileEntitySoyuzCapsule() {
super(19);
}
@Override
public String getName() {
return "container.soyuzCapsule";
}
}

View File

@ -117,15 +117,6 @@ public class TileEntitySoyuzLauncher extends TileEntityMachineBase implements IS
if(!entities.isEmpty()) { if(!entities.isEmpty()) {
//for(int i = 0; i < 35; i++) {
//Vec3 vec = Vec3.createVectorHelper(worldObj.rand.nextGaussian() * 0.5 + 1, 0, 0);
//vec.rotateAroundY(worldObj.rand.nextFloat() * (float) (Math.PI * 2));
//MainRegistry.proxy.spawnParticle(xCoord + 0.5, yCoord + 0.25 + worldObj.rand.nextFloat() * 3, zCoord + 0.5, "launchsmoke", new float[] {(float) vec.xCoord, 0, (float) vec.zCoord});
//}
NBTTagCompound data = new NBTTagCompound(); NBTTagCompound data = new NBTTagCompound();
data.setString("type", "smoke"); data.setString("type", "smoke");
data.setString("mode", "shockRand"); data.setString("mode", "shockRand");
@ -170,6 +161,7 @@ public class TileEntitySoyuzLauncher extends TileEntityMachineBase implements IS
EntitySoyuz soyuz = new EntitySoyuz(worldObj); EntitySoyuz soyuz = new EntitySoyuz(worldObj);
soyuz.setSkin(this.getType()); soyuz.setSkin(this.getType());
soyuz.mode = this.mode;
soyuz.setLocationAndAngles(xCoord + 0.5, yCoord + 5, zCoord + 0.5, 0, 0); soyuz.setLocationAndAngles(xCoord + 0.5, yCoord + 5, zCoord + 0.5, 0, 0);
worldObj.spawnEntityInWorld(soyuz); worldObj.spawnEntityInWorld(soyuz);
@ -189,7 +181,9 @@ public class TileEntitySoyuzLauncher extends TileEntityMachineBase implements IS
payload.add(slots[i]); payload.add(slots[i]);
slots[i] = null; slots[i] = null;
} }
soyuz.targetX = slots[1].stackTagCompound.getInteger("xCoord");
soyuz.targetZ = slots[1].stackTagCompound.getInteger("zCoord");
soyuz.setPayload(payload); soyuz.setPayload(payload);
} }