mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
pheo's ivy mike GUI, det cord is now cord shaped, as the name implies
This commit is contained in:
parent
da45bb91c8
commit
fdcf09abfb
@ -1672,9 +1672,9 @@ public class ModBlocks {
|
||||
therm_endo = new BombThermo(Material.iron).setBlockName("therm_endo").setCreativeTab(MainRegistry.nukeTab).setHardness(5.0F).setResistance(6000.0F);
|
||||
therm_exo = new BombThermo(Material.iron).setBlockName("therm_exo").setCreativeTab(MainRegistry.nukeTab).setHardness(5.0F).setResistance(6000.0F);
|
||||
emp_bomb = new BombFloat(Material.iron).setBlockName("emp_bomb").setCreativeTab(MainRegistry.nukeTab).setHardness(5.0F).setResistance(6000.0F);
|
||||
det_cord = new DetCord(Material.iron).setBlockName("det_cord").setCreativeTab(MainRegistry.nukeTab).setHardness(0.1F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":det_cord");
|
||||
det_charge = new DetCord(Material.iron).setBlockName("det_charge").setCreativeTab(MainRegistry.nukeTab).setHardness(0.1F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":det_charge");
|
||||
det_nuke = new DetCord(Material.iron).setBlockName("det_nuke").setCreativeTab(MainRegistry.nukeTab).setHardness(0.1F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":det_nuke");
|
||||
det_cord = new ExplosiveCharge(Material.iron).setBlockName("det_cord").setCreativeTab(MainRegistry.nukeTab).setHardness(0.1F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":det_cord");
|
||||
det_charge = new ExplosiveCharge(Material.iron).setBlockName("det_charge").setCreativeTab(MainRegistry.nukeTab).setHardness(0.1F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":det_charge");
|
||||
det_nuke = new ExplosiveCharge(Material.iron).setBlockName("det_nuke").setCreativeTab(MainRegistry.nukeTab).setHardness(0.1F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":det_nuke");
|
||||
det_miner = new DetMiner(Material.iron, RefStrings.MODID + ":det_miner_top").setBlockName("det_miner").setCreativeTab(MainRegistry.nukeTab).setHardness(0.1F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":det_miner_side");
|
||||
red_barrel = new RedBarrel(Material.iron).setBlockName("red_barrel").setCreativeTab(MainRegistry.nukeTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":barrel_red");
|
||||
pink_barrel = new RedBarrel(Material.iron).setBlockName("pink_barrel").setCreativeTab(MainRegistry.nukeTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":barrel_pink");
|
||||
|
||||
@ -1,88 +1,60 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.config.BombConfig;
|
||||
import com.hbm.entity.effect.EntityNukeCloudSmall;
|
||||
import com.hbm.entity.logic.EntityNukeExplosionMK4;
|
||||
import com.hbm.explosion.ExplosionLarge;
|
||||
import com.hbm.explosion.ExplosionNT;
|
||||
import com.hbm.interfaces.IBomb;
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
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.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class DetCord extends Block implements IBomb {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
public DetCord(Material p_i45394_1_) {
|
||||
super(p_i45394_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
|
||||
super.registerBlockIcons(iconRegister);
|
||||
|
||||
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":det_nuke_top");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
|
||||
if(this != ModBlocks.det_nuke)
|
||||
return this.blockIcon;
|
||||
|
||||
return side == 1 ? this.iconTop : (side == 0 ? this.iconTop : this.blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion p_149723_5_) {
|
||||
this.explode(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) {
|
||||
if(world.isBlockIndirectlyGettingPowered(x, y, z)) {
|
||||
this.explode(world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BombReturnCode explode(World world, int x, int y, int z) {
|
||||
|
||||
if(!world.isRemote) {
|
||||
world.setBlock(x, y, z, Blocks.air);
|
||||
if(this == ModBlocks.det_cord) {
|
||||
world.createExplosion(null, x + 0.5, y + 0.5, z + 0.5, 1.5F, true);
|
||||
}
|
||||
if(this == ModBlocks.det_charge) {
|
||||
new ExplosionNT(world, null, x + 0.5, y + 0.5, z + 0.5, 15).overrideResolution(64).explode();
|
||||
ExplosionLarge.spawnParticles(world, x, y, z, ExplosionLarge.cloudFunction(15));
|
||||
}
|
||||
if(this == ModBlocks.det_nuke) {
|
||||
world.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(world, BombConfig.missileRadius, x + 0.5, y + 0.5, z + 0.5));
|
||||
|
||||
EntityNukeCloudSmall entity2 = new EntityNukeCloudSmall(world, 1000, BombConfig.missileRadius * 0.005F);
|
||||
entity2.posX = x;
|
||||
entity2.posY = y;
|
||||
entity2.posZ = z;
|
||||
world.spawnEntityInWorld(entity2);
|
||||
}
|
||||
}
|
||||
|
||||
return BombReturnCode.DETONATED;
|
||||
}
|
||||
|
||||
}
|
||||
package com.hbm.blocks.bomb;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.interfaces.IBomb.BombReturnCode;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class DetCord extends Block implements IDetConnectible {
|
||||
|
||||
protected DetCord(Material p_i45394_1_) {
|
||||
super(p_i45394_1_);
|
||||
}
|
||||
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion p_149723_5_) {
|
||||
this.explode(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDropFromExplosion(Explosion explosion) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) {
|
||||
if(world.isBlockIndirectlyGettingPowered(x, y, z)) {
|
||||
this.explode(world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
public void explode(World world, int x, int y, int z) {
|
||||
|
||||
if(!world.isRemote) {
|
||||
world.setBlock(x, y, z, Blocks.air);
|
||||
world.createExplosion(null, x + 0.5, y + 0.5, z + 0.5, 1.5F, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
93
src/main/java/com/hbm/blocks/bomb/ExplosiveCharge.java
Normal file
93
src/main/java/com/hbm/blocks/bomb/ExplosiveCharge.java
Normal file
@ -0,0 +1,93 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.config.BombConfig;
|
||||
import com.hbm.entity.effect.EntityNukeCloudSmall;
|
||||
import com.hbm.entity.logic.EntityNukeExplosionMK4;
|
||||
import com.hbm.explosion.ExplosionLarge;
|
||||
import com.hbm.explosion.ExplosionNT;
|
||||
import com.hbm.interfaces.IBomb;
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
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.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ExplosiveCharge extends Block implements IBomb, IDetConnectible {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
public ExplosiveCharge(Material p_i45394_1_) {
|
||||
super(p_i45394_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
|
||||
super.registerBlockIcons(iconRegister);
|
||||
|
||||
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":det_nuke_top");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
|
||||
if(this != ModBlocks.det_nuke)
|
||||
return this.blockIcon;
|
||||
|
||||
return side == 1 ? this.iconTop : (side == 0 ? this.iconTop : this.blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion p_149723_5_) {
|
||||
this.explode(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDropFromExplosion(Explosion explosion) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) {
|
||||
if(world.isBlockIndirectlyGettingPowered(x, y, z)) {
|
||||
this.explode(world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BombReturnCode explode(World world, int x, int y, int z) {
|
||||
|
||||
if(!world.isRemote) {
|
||||
world.setBlock(x, y, z, Blocks.air);
|
||||
if(this == ModBlocks.det_cord) {
|
||||
world.createExplosion(null, x + 0.5, y + 0.5, z + 0.5, 1.5F, true);
|
||||
}
|
||||
if(this == ModBlocks.det_charge) {
|
||||
new ExplosionNT(world, null, x + 0.5, y + 0.5, z + 0.5, 15).overrideResolution(64).explode();
|
||||
ExplosionLarge.spawnParticles(world, x, y, z, ExplosionLarge.cloudFunction(15));
|
||||
}
|
||||
if(this == ModBlocks.det_nuke) {
|
||||
world.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(world, BombConfig.missileRadius, x + 0.5, y + 0.5, z + 0.5));
|
||||
|
||||
EntityNukeCloudSmall entity2 = new EntityNukeCloudSmall(world, 1000, BombConfig.missileRadius * 0.005F);
|
||||
entity2.posX = x;
|
||||
entity2.posY = y;
|
||||
entity2.posZ = z;
|
||||
world.spawnEntityInWorld(entity2);
|
||||
}
|
||||
}
|
||||
|
||||
return BombReturnCode.DETONATED;
|
||||
}
|
||||
|
||||
}
|
||||
21
src/main/java/com/hbm/blocks/bomb/IDetConnectible.java
Normal file
21
src/main/java/com/hbm/blocks/bomb/IDetConnectible.java
Normal file
@ -0,0 +1,21 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IDetConnectible {
|
||||
|
||||
public default boolean canConnectToDetCord(IBlockAccess world, int x, int y, int z, ForgeDirection dir) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isConnectible(IBlockAccess world, int x, int y, int z, ForgeDirection dir) {
|
||||
Block b = world.getBlock(x, y, z);
|
||||
if(b instanceof IDetConnectible) {
|
||||
return ((IDetConnectible)b).canConnectToDetCord(world, x, y, z, dir);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -10,71 +10,62 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerNukeMike extends Container {
|
||||
|
||||
private TileEntityNukeMike nukeMike;
|
||||
|
||||
private TileEntityNukeMike nukeMike;
|
||||
|
||||
public ContainerNukeMike(InventoryPlayer invPlayer, TileEntityNukeMike tedf) {
|
||||
|
||||
|
||||
nukeMike = tedf;
|
||||
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 26, 17));
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 62, 17));
|
||||
this.addSlotToContainer(new Slot(tedf, 2, 26, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 3, 62, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 4, 44, 35));
|
||||
this.addSlotToContainer(new Slot(tedf, 5, 80, 35));
|
||||
this.addSlotToContainer(new Slot(tedf, 6, 98, 35));
|
||||
this.addSlotToContainer(new Slot(tedf, 7, 116, 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));
|
||||
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 26, 83));
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 26, 101));
|
||||
this.addSlotToContainer(new Slot(tedf, 2, 44, 83));
|
||||
this.addSlotToContainer(new Slot(tedf, 3, 44, 101));
|
||||
this.addSlotToContainer(new Slot(tedf, 4, 39, 35));
|
||||
this.addSlotToContainer(new Slot(tedf, 5, 98, 91));
|
||||
this.addSlotToContainer(new Slot(tedf, 6, 116, 91));
|
||||
this.addSlotToContainer(new Slot(tedf, 7, 134, 91));
|
||||
|
||||
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, 135 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 193));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2)
|
||||
{
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
if (var4 != null && var4.getHasStack())
|
||||
{
|
||||
|
||||
if(var4 != null && var4.getHasStack()) {
|
||||
ItemStack var5 = var4.getStack();
|
||||
var3 = var5.copy();
|
||||
|
||||
if (par2 <= 7) {
|
||||
if (!this.mergeItemStack(var5, 8, this.inventorySlots.size(), true))
|
||||
{
|
||||
|
||||
if(par2 <= 7) {
|
||||
if(!this.mergeItemStack(var5, 8, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (var5.stackSize == 0)
|
||||
{
|
||||
|
||||
if(var5.stackSize == 0) {
|
||||
var4.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
var4.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return var3;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return nukeMike.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,7 @@ package com.hbm.inventory.gui;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerNukeMike;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.bomb.TileEntityNukeMike;
|
||||
|
||||
@ -22,14 +23,14 @@ public class GUINukeMike extends GuiContainer {
|
||||
testNuke = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 166;
|
||||
this.ySize = 217;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( int i, int j) {
|
||||
String name = this.testNuke.hasCustomInventoryName() ? this.testNuke.getInventoryName() : I18n.format(this.testNuke.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, 4, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@ -41,13 +42,31 @@ public class GUINukeMike extends GuiContainer {
|
||||
|
||||
if(testNuke.isReady() && !testNuke.isFilled())
|
||||
{
|
||||
drawTexturedModalRect(guiLeft + 142, guiTop + 34, 176, 0, 18, 18);
|
||||
drawTexturedModalRect(guiLeft + 5, guiTop + 35, 177, 1, 16, 16);
|
||||
}
|
||||
|
||||
if(testNuke.isReady() && testNuke.isFilled())
|
||||
{
|
||||
drawTexturedModalRect(guiLeft + 142, guiTop + 34, 176, 18, 18, 18);
|
||||
drawTexturedModalRect(guiLeft + 5, guiTop + 35, 177, 19, 16, 16);
|
||||
}
|
||||
|
||||
if(testNuke.getStackInSlot(5) != null && testNuke.getStackInSlot(5).getItem() == ModItems.mike_core)
|
||||
drawTexturedModalRect(guiLeft + 75, guiTop + 25, 176, 49, 80, 36);
|
||||
|
||||
if(testNuke.getStackInSlot(6) != null && testNuke.getStackInSlot(6).getItem() == ModItems.mike_deut)
|
||||
drawTexturedModalRect(guiLeft + 79, guiTop + 30, 180, 88, 58, 26);
|
||||
|
||||
if(testNuke.getStackInSlot(7) != null && testNuke.getStackInSlot(7).getItem() == ModItems.mike_cooling_unit)
|
||||
drawTexturedModalRect(guiLeft + 140, guiTop + 30, 240, 88, 12, 26);
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
if(testNuke.getStackInSlot(i) != null && testNuke.getStackInSlot(i).getItem() == ModItems.man_explosive8)
|
||||
switch(i) {
|
||||
case 0: drawTexturedModalRect(guiLeft + 24, guiTop + 20 , 209, 1, 23, 23); break;
|
||||
case 2: drawTexturedModalRect(guiLeft + 47, guiTop + 20 , 232, 1, 23, 23); break;
|
||||
case 1: drawTexturedModalRect(guiLeft + 24, guiTop + 43 , 209, 24, 23, 23); break;
|
||||
case 3: drawTexturedModalRect(guiLeft + 47, guiTop + 43 , 232, 24, 23, 23); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -634,6 +634,7 @@ public class ClientProxy extends ServerProxy {
|
||||
RenderingRegistry.registerBlockHandler(new RenderCrystal());
|
||||
RenderingRegistry.registerBlockHandler(new RenderTestCable());
|
||||
RenderingRegistry.registerBlockHandler(new RenderBlockCT());
|
||||
RenderingRegistry.registerBlockHandler(new RenderDetCord());
|
||||
|
||||
RenderingRegistry.registerBlockHandler(new RenderBlockRotated(ModBlocks.charge_dynamite.getRenderType(), ResourceManager.charge_dynamite));
|
||||
|
||||
|
||||
@ -958,6 +958,9 @@ public class MainRegistry {
|
||||
TileEntityMachineReactorLarge.registerAll();
|
||||
|
||||
proxy.registerMissileItems();
|
||||
|
||||
//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);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
96
src/main/java/com/hbm/render/block/RenderDetCord.java
Normal file
96
src/main/java/com/hbm/render/block/RenderDetCord.java
Normal file
@ -0,0 +1,96 @@
|
||||
package com.hbm.render.block;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.bomb.IDetConnectible;
|
||||
import com.hbm.blocks.test.TestConductor;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.util.ObjUtil;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.model.obj.WavefrontObject;
|
||||
|
||||
public class RenderDetCord implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
IIcon iicon = block.getIcon(0, 0);
|
||||
tessellator.setColorOpaque_F(1, 1, 1);
|
||||
|
||||
if(renderer.hasOverrideBlockTexture()) {
|
||||
iicon = renderer.overrideBlockTexture;
|
||||
}
|
||||
|
||||
GL11.glRotated(180, 0, 1, 0);
|
||||
GL11.glScaled(1.25D, 1.25D, 1.25D);
|
||||
tessellator.startDrawingQuads();
|
||||
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.cable_neo, "CX", iicon, tessellator, 0, false);
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
IIcon iicon = block.getIcon(0, 0);
|
||||
tessellator.setColorOpaque_F(1, 1, 1);
|
||||
|
||||
if(renderer.hasOverrideBlockTexture()) {
|
||||
iicon = renderer.overrideBlockTexture;
|
||||
}
|
||||
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
tessellator.setColorOpaque_F(1, 1, 1);
|
||||
|
||||
boolean pX = IDetConnectible.isConnectible(world, x + 1, y, z, Library.NEG_X);
|
||||
boolean nX = IDetConnectible.isConnectible(world, x - 1, y, z, Library.POS_X);
|
||||
boolean pY = IDetConnectible.isConnectible(world, x, y + 1, z, Library.NEG_Y);
|
||||
boolean nY = IDetConnectible.isConnectible(world, x, y - 1, z, Library.POS_Y);
|
||||
boolean pZ = IDetConnectible.isConnectible(world, x, y, z + 1, Library.NEG_Z);
|
||||
boolean nZ = IDetConnectible.isConnectible(world, x, y, z - 1, Library.POS_Z);
|
||||
|
||||
tessellator.addTranslation(x + 0.5F, y + 0.5F, z + 0.5F);
|
||||
|
||||
if(pX && nX && !pY && !nY && !pZ && !nZ)
|
||||
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.cable_neo, "CX", iicon, tessellator, 0, true);
|
||||
else if(!pX && !nX && pY && nY && !pZ && !nZ)
|
||||
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.cable_neo, "CY", iicon, tessellator, 0, true);
|
||||
else if(!pX && !nX && !pY && !nY && pZ && nZ)
|
||||
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.cable_neo, "CZ", iicon, tessellator, 0, true);
|
||||
|
||||
else {
|
||||
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.cable_neo, "Core", iicon, tessellator, 0, true);
|
||||
if(pX) ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.cable_neo, "posX", iicon, tessellator, 0, true);
|
||||
if(nX) ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.cable_neo, "negX", iicon, tessellator, 0, true);
|
||||
if(pY) ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.cable_neo, "posY", iicon, tessellator, 0, true);
|
||||
if(nY) ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.cable_neo, "negY", iicon, tessellator, 0, true);
|
||||
if(nZ) ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.cable_neo, "posZ", iicon, tessellator, 0, true);
|
||||
if(pZ) ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.cable_neo, "negZ", iicon, tessellator, 0, true);
|
||||
}
|
||||
|
||||
tessellator.addTranslation(-x - 0.5F, -y - 0.5F, -z - 0.5F);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return TestConductor.renderID;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 191 B After Width: | Height: | Size: 183 B |
Binary file not shown.
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 16 KiB |
Loading…
x
Reference in New Issue
Block a user