mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
some more loot block rendering stuff, RTG blast furnace GUI
This commit is contained in:
parent
c1d0447ec8
commit
06b5c8b67d
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.generic.BlockLoot.TileEntityLoot;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.bomb.TileEntityBombMulti;
|
||||
@ -11,9 +12,12 @@ import com.hbm.util.LootGenerator;
|
||||
import com.hbm.util.Tuple.Quartet;
|
||||
|
||||
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.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
@ -48,7 +52,31 @@ public class BlockLoot extends BlockContainer {
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
LootGenerator.lootMedicine(world, x, y, z);
|
||||
|
||||
/*TileEntityLoot loot = (TileEntityLoot) world.getTileEntity(x, y, z);
|
||||
|
||||
if(loot != null && loot.items.isEmpty()) {
|
||||
loot.addItem(new ItemStack(ModItems.gun_lever_action), 0, 0, 0);
|
||||
}*/
|
||||
|
||||
LootGenerator.lootCapStash(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
|
||||
if(!world.isRemote) {
|
||||
TileEntityLoot entity = (TileEntityLoot) world.getTileEntity(x, y, z);
|
||||
if(entity != null) {
|
||||
|
||||
for(Quartet<ItemStack, Double, Double, Double> quartet : entity.items) {
|
||||
EntityItem item = new EntityItem(world, x + 0.5, y, z + 0.5, quartet.getW());
|
||||
world.spawnEntityInWorld(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -72,11 +100,6 @@ public class BlockLoot extends BlockContainer {
|
||||
|
||||
TileEntityLoot entity = (TileEntityLoot) world.getTileEntity(x, y, z);
|
||||
if(entity != null) {
|
||||
|
||||
for(Quartet<ItemStack, Double, Double, Double> quartet : entity.items) {
|
||||
player.inventory.addItemStackToInventory(quartet.getW());
|
||||
}
|
||||
|
||||
world.setBlockToAir(x, y, z);
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@ -4,17 +4,21 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.generic.BlockLoot.TileEntityLoot;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.util.RenderItemStack;
|
||||
import com.hbm.render.model.ModelFatman;
|
||||
import com.hbm.render.model.ModelLeverAction;
|
||||
import com.hbm.util.Tuple.Quartet;
|
||||
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderLoot extends TileEntitySpecialRenderer {
|
||||
|
||||
@ -22,6 +26,8 @@ public class RenderLoot extends TileEntitySpecialRenderer {
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float interp) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
|
||||
TileEntityLoot loot = (TileEntityLoot) te;
|
||||
|
||||
@ -36,6 +42,13 @@ public class RenderLoot extends TileEntitySpecialRenderer {
|
||||
stack.getItem() == ModItems.ammo_nuke_high || stack.getItem() == ModItems.ammo_nuke_safe ||
|
||||
stack.getItem() == ModItems.ammo_nuke_pumpkin) {
|
||||
renderNuke();
|
||||
|
||||
} else if(stack.getItem() == ModItems.gun_fatman || stack.getItem() == ModItems.gun_proto || stack.getItem() == ModItems.gun_mirv) {
|
||||
renderLauncher();
|
||||
|
||||
} else if(stack.getItem() == ModItems.gun_lever_action) {
|
||||
renderShotgun();
|
||||
|
||||
} else {
|
||||
renderStandardItem(item.getW());
|
||||
}
|
||||
@ -54,6 +67,34 @@ public class RenderLoot extends TileEntitySpecialRenderer {
|
||||
ResourceManager.projectiles.renderPart("MiniNuke");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}
|
||||
|
||||
protected ModelFatman launcher;
|
||||
private void renderLauncher() {
|
||||
|
||||
if(launcher == null)
|
||||
launcher = new ModelFatman();
|
||||
|
||||
GL11.glRotated(180, 1, 0, 0);
|
||||
GL11.glRotated(3, 0, 0, 1);
|
||||
GL11.glTranslated(0.5, -0.3751, -0.625);
|
||||
|
||||
bindTexture(new ResourceLocation(RefStrings.MODID +":textures/models/FatmanLauncher.png"));
|
||||
launcher.render(null, 0F, 0F, 0F, 0F, 0F, 0.0625F, new ItemStack(ModItems.gun_fatman));
|
||||
}
|
||||
|
||||
protected ModelLeverAction shotgun;
|
||||
private void renderShotgun() {
|
||||
|
||||
if(shotgun == null)
|
||||
shotgun = new ModelLeverAction();
|
||||
|
||||
GL11.glScaled(0.25, 0.25, 0.25);
|
||||
GL11.glTranslated(3, 0.0625, 2);
|
||||
GL11.glRotated(-25, 0, 1, 0);
|
||||
GL11.glRotated(90, 1, 0, 0);
|
||||
bindTexture(new ResourceLocation(RefStrings.MODID +":textures/models/ModelLeverAction.png"));
|
||||
shotgun.render(null, 0F, 0F, 0F, 0F, 0F, 0.0625F);
|
||||
}
|
||||
|
||||
private void renderStandardItem(ItemStack stack) {
|
||||
GL11.glTranslated(0.25, 0, 0.25);
|
||||
|
||||
@ -229,6 +229,7 @@ public class TileMappings {
|
||||
}
|
||||
|
||||
private static void putMachines() {
|
||||
map.put(TileEntityDiFurnaceRTG.class, "tileentity_rtg_difurnace");
|
||||
map.put(TileEntityUVLamp.class, "tileentity_uv_lamp");
|
||||
|
||||
map.put(TileEntityCondenser.class, "tileentity_condenser");
|
||||
|
||||
@ -72,7 +72,11 @@ public class LootGenerator {
|
||||
|
||||
int count = world.rand.nextInt(5) + 3;
|
||||
for(int k = 0; k < count; k++) {
|
||||
addItemWithDeviation(loot, world.rand, new ItemStack(cap, 4), i * 0.125, k * 0.03125, k * 0.125);
|
||||
|
||||
if(cap == ModItems.cap_sunset && world.rand.nextInt(10) == 0)
|
||||
addItemWithDeviation(loot, world.rand, new ItemStack(ModItems.cap_star, 1), i * 0.3125, k * 0.03125, j * 0.3125);
|
||||
else
|
||||
addItemWithDeviation(loot, world.rand, new ItemStack(cap, 4), i * 0.3125, k * 0.03125, j * 0.3125);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 8.4 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 13 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
Loading…
x
Reference in New Issue
Block a user