mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
commit
e296fbf636
@ -2934,7 +2934,7 @@ public class ModBlocks {
|
|||||||
GameRegistry.registerBlock(hev_battery, hev_battery.getUnlocalizedName());
|
GameRegistry.registerBlock(hev_battery, hev_battery.getUnlocalizedName());
|
||||||
|
|
||||||
//Chainlink Fence
|
//Chainlink Fence
|
||||||
GameRegistry.registerBlock(fence_metal, fence_metal.getUnlocalizedName());
|
GameRegistry.registerBlock(fence_metal, ItemBlockBase.class, fence_metal.getUnlocalizedName());
|
||||||
|
|
||||||
//Sands, Glass
|
//Sands, Glass
|
||||||
GameRegistry.registerBlock(ash_digamma, ash_digamma.getUnlocalizedName());
|
GameRegistry.registerBlock(ash_digamma, ash_digamma.getUnlocalizedName());
|
||||||
|
|||||||
@ -2,112 +2,139 @@ package com.hbm.blocks.generic;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.hbm.blocks.IBlockMulti;
|
||||||
|
|
||||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.BlockFence;
|
import net.minecraft.block.BlockFence;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockMetalFence extends BlockFence {
|
public class BlockMetalFence extends BlockFence implements IBlockMulti {
|
||||||
|
|
||||||
public BlockMetalFence(Material p_i45406_2_) {
|
public IIcon postIcon;
|
||||||
super("", p_i45406_2_);
|
|
||||||
|
public BlockMetalFence(Material mat) {
|
||||||
|
super("", mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType(){
|
public int getRenderType() {
|
||||||
return renderID;
|
return renderID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock() {
|
public boolean renderAsNormalBlock() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@Override
|
||||||
public void registerBlockIcons(IIconRegister p_149651_1_)
|
public int damageDropped(int meta) {
|
||||||
{
|
return rectify(meta);
|
||||||
this.blockIcon = p_149651_1_.registerIcon(this.getTextureName());
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
public void addCollisionBoxesToList(World p_149743_1_, int p_149743_2_, int p_149743_3_, int p_149743_4_, AxisAlignedBB p_149743_5_, List p_149743_6_, Entity p_149743_7_)
|
@SideOnly(Side.CLIENT)
|
||||||
{
|
public IIcon getIcon(int side, int meta) {
|
||||||
boolean flag = this.canConnectFenceTo(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_ - 1);
|
return meta == 0 ? this.blockIcon : this.postIcon;
|
||||||
boolean flag1 = this.canConnectFenceTo(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_ + 1);
|
}
|
||||||
boolean flag2 = this.canConnectFenceTo(p_149743_1_, p_149743_2_ - 1, p_149743_3_, p_149743_4_);
|
|
||||||
boolean flag3 = this.canConnectFenceTo(p_149743_1_, p_149743_2_ + 1, p_149743_3_, p_149743_4_);
|
|
||||||
float f = 0.375F;
|
|
||||||
float f1 = 0.625F;
|
|
||||||
float f2 = 0.375F;
|
|
||||||
float f3 = 0.625F;
|
|
||||||
|
|
||||||
if (flag)
|
public String getUnlocalizedName(ItemStack stack) {
|
||||||
{
|
return stack.getItemDamage() == 1 ? getUnlocalizedName() + "_post" : getUnlocalizedName();
|
||||||
f2 = 0.0F;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (flag1)
|
@Override
|
||||||
{
|
@SideOnly(Side.CLIENT)
|
||||||
f3 = 1.0F;
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
}
|
this.blockIcon = iconRegister.registerIcon(this.getTextureName());
|
||||||
|
this.postIcon = iconRegister.registerIcon(this.getTextureName() + "_post");
|
||||||
|
}
|
||||||
|
|
||||||
if (flag || flag1)
|
@Override
|
||||||
{
|
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB aabb, List list, Entity entity) {
|
||||||
this.setBlockBounds(f, 0.0F, f2, f1, 1.0F, f3);
|
boolean flag = this.canConnectFenceTo(world, x, y, z - 1);
|
||||||
addCol(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_, p_149743_5_, p_149743_6_, p_149743_7_);
|
boolean flag1 = this.canConnectFenceTo(world, x, y, z + 1);
|
||||||
}
|
boolean flag2 = this.canConnectFenceTo(world, x - 1, y, z);
|
||||||
|
boolean flag3 = this.canConnectFenceTo(world, x + 1, y, z);
|
||||||
|
float f = 0.375F;
|
||||||
|
float f1 = 0.625F;
|
||||||
|
float f2 = 0.375F;
|
||||||
|
float f3 = 0.625F;
|
||||||
|
|
||||||
f2 = 0.375F;
|
if(flag) {
|
||||||
f3 = 0.625F;
|
f2 = 0.0F;
|
||||||
|
}
|
||||||
|
|
||||||
if (flag2)
|
if(flag1) {
|
||||||
{
|
f3 = 1.0F;
|
||||||
f = 0.0F;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (flag3)
|
if(flag || flag1) {
|
||||||
{
|
this.setBlockBounds(f, 0.0F, f2, f1, 1.0F, f3);
|
||||||
f1 = 1.0F;
|
addCol(world, x, y, z, aabb, list, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag2 || flag3 || !flag && !flag1)
|
f2 = 0.375F;
|
||||||
{
|
f3 = 0.625F;
|
||||||
this.setBlockBounds(f, 0.0F, f2, f1, 1.0F, f3);
|
|
||||||
addCol(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_, p_149743_5_, p_149743_6_, p_149743_7_);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flag)
|
if(flag2) {
|
||||||
{
|
f = 0.0F;
|
||||||
f2 = 0.0F;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (flag1)
|
if(flag3) {
|
||||||
{
|
f1 = 1.0F;
|
||||||
f3 = 1.0F;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
this.setBlockBounds(f, 0.0F, f2, f1, 1.0F, f3);
|
if(flag2 || flag3 || !flag && !flag1) {
|
||||||
}
|
this.setBlockBounds(f, 0.0F, f2, f1, 1.0F, f3);
|
||||||
|
addCol(world, x, y, z, aabb, list, entity);
|
||||||
public void addCol(World p_149743_1_, int p_149743_2_, int p_149743_3_, int p_149743_4_, AxisAlignedBB p_149743_5_, List p_149743_6_, Entity p_149743_7_)
|
}
|
||||||
{
|
|
||||||
AxisAlignedBB axisalignedbb1 = this.getCollisionBoundingBoxFromPool(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_);
|
|
||||||
|
|
||||||
if (axisalignedbb1 != null && p_149743_5_.intersectsWith(axisalignedbb1))
|
if(flag) {
|
||||||
{
|
f2 = 0.0F;
|
||||||
p_149743_6_.add(axisalignedbb1);
|
}
|
||||||
}
|
|
||||||
}
|
if(flag1) {
|
||||||
|
f3 = 1.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setBlockBounds(f, 0.0F, f2, f1, 1.0F, f3);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addCol(World world, int x, int y, int z, AxisAlignedBB aabb, List list, Entity entity) {
|
||||||
|
AxisAlignedBB axisalignedbb1 = this.getCollisionBoundingBoxFromPool(world, x, y, z);
|
||||||
|
|
||||||
|
if(axisalignedbb1 != null && aabb.intersectsWith(axisalignedbb1)) {
|
||||||
|
list.add(axisalignedbb1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||||
|
for(int i = 0; i < getSubCount(); ++i) {
|
||||||
|
list.add(new ItemStack(item, 1, i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSubCount() {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import com.hbm.blocks.BlockMulti;
|
|||||||
import com.hbm.blocks.IBlockMulti;
|
import com.hbm.blocks.IBlockMulti;
|
||||||
import com.hbm.blocks.IPersistentInfoProvider;
|
import com.hbm.blocks.IPersistentInfoProvider;
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
|
import com.hbm.blocks.generic.BlockMetalFence;
|
||||||
import com.hbm.tileentity.IPersistentNBT;
|
import com.hbm.tileentity.IPersistentNBT;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
@ -42,6 +43,8 @@ public class ItemBlockBase extends ItemBlock {
|
|||||||
|
|
||||||
if(field_150939_a instanceof BlockMulti) {
|
if(field_150939_a instanceof BlockMulti) {
|
||||||
return ((BlockMulti)field_150939_a).getUnlocalizedName(stack);
|
return ((BlockMulti)field_150939_a).getUnlocalizedName(stack);
|
||||||
|
} else if(field_150939_a instanceof BlockMetalFence) {
|
||||||
|
return ((BlockMetalFence)field_150939_a).getUnlocalizedName(stack); // I considered reworking IBlockMulti instead but there are like a bajillion implementers
|
||||||
} else {
|
} else {
|
||||||
return super.getUnlocalizedName(stack);
|
return super.getUnlocalizedName(stack);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -743,6 +743,8 @@ public class CraftingManager {
|
|||||||
addRecipeAuto(new ItemStack(ModBlocks.obj_tester, 1), new Object[] { "P", "I", "S", 'P', ModItems.polaroid, 'I', ModItems.flame_pony, 'S', STEEL.plate() });
|
addRecipeAuto(new ItemStack(ModBlocks.obj_tester, 1), new Object[] { "P", "I", "S", 'P', ModItems.polaroid, 'I', ModItems.flame_pony, 'S', STEEL.plate() });
|
||||||
|
|
||||||
addRecipeAuto(new ItemStack(ModBlocks.fence_metal, 6), new Object[] { "BIB", "BIB", 'B', Blocks.iron_bars, 'I', Items.iron_ingot });
|
addRecipeAuto(new ItemStack(ModBlocks.fence_metal, 6), new Object[] { "BIB", "BIB", 'B', Blocks.iron_bars, 'I', Items.iron_ingot });
|
||||||
|
addShapelessAuto(new ItemStack(ModBlocks.fence_metal, 1, 1), new Object[] { new ItemStack(ModBlocks.fence_metal, 1, 0) });
|
||||||
|
addShapelessAuto(new ItemStack(ModBlocks.fence_metal, 1, 0), new Object[] { new ItemStack(ModBlocks.fence_metal, 1, 1) });
|
||||||
|
|
||||||
addShapelessAuto(new ItemStack(ModBlocks.waste_trinitite), new Object[] { new ItemStack(Blocks.sand, 1, 0), ModItems.trinitite });
|
addShapelessAuto(new ItemStack(ModBlocks.waste_trinitite), new Object[] { new ItemStack(Blocks.sand, 1, 0), ModItems.trinitite });
|
||||||
addShapelessAuto(new ItemStack(ModBlocks.waste_trinitite_red), new Object[] { new ItemStack(Blocks.sand, 1, 1), ModItems.trinitite });
|
addShapelessAuto(new ItemStack(ModBlocks.waste_trinitite_red), new Object[] { new ItemStack(Blocks.sand, 1, 1), ModItems.trinitite });
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import com.hbm.blocks.generic.BlockMetalFence;
|
|||||||
|
|
||||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockFence;
|
|
||||||
import net.minecraft.client.renderer.RenderBlocks;
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
@ -19,58 +18,55 @@ public class RenderFence implements ISimpleBlockRenderingHandler {
|
|||||||
@Override
|
@Override
|
||||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||||
|
|
||||||
BlockFence fence = (BlockFence) ModBlocks.fence_metal;
|
BlockMetalFence fence = (BlockMetalFence) ModBlocks.fence_metal;
|
||||||
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
|
|
||||||
|
boolean xNeg = fence.canConnectFenceTo(world, x - 1, y, z);
|
||||||
|
boolean xPos = fence.canConnectFenceTo(world, x + 1, y, z);
|
||||||
|
boolean zNeg = fence.canConnectFenceTo(world, x, y, z - 1);
|
||||||
|
boolean zPos = fence.canConnectFenceTo(world, x, y, z + 1);
|
||||||
|
|
||||||
|
boolean hasX = xNeg || xPos;
|
||||||
|
boolean hasZ = zNeg || zPos;
|
||||||
|
|
||||||
float f = 0.375F;
|
boolean straightX = !hasZ && xNeg && xPos;
|
||||||
float f1 = 0.625F;
|
boolean straightZ = !hasX && zNeg && zPos;
|
||||||
renderer.setRenderBounds((double)f, 0.0D, (double)f, (double)f1, 1.0D, (double)f1);
|
boolean showPost = meta == 1 || (!straightX && !straightZ);
|
||||||
renderer.renderStandardBlock(fence, x, y, z);
|
|
||||||
boolean flag1 = false;
|
|
||||||
boolean flag2 = false;
|
|
||||||
|
|
||||||
if (fence.canConnectFenceTo(world, x - 1, y, z) || fence.canConnectFenceTo(world, x + 1, y, z))
|
if (!hasX && !hasZ) {
|
||||||
{
|
hasX = true;
|
||||||
flag1 = true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (fence.canConnectFenceTo(world, x, y, z - 1) || fence.canConnectFenceTo(world, x, y, z + 1))
|
float f = 0.4375F;
|
||||||
{
|
float f1 = 0.5625F;
|
||||||
flag2 = true;
|
float f4 = xNeg ? 0.0F : f;
|
||||||
}
|
float f5 = xPos ? 1.0F : f1;
|
||||||
|
float f6 = zNeg ? 0.0F : f;
|
||||||
|
float f7 = zPos ? 1.0F : f1;
|
||||||
|
renderer.field_152631_f = true;
|
||||||
|
|
||||||
boolean flag3 = fence.canConnectFenceTo(world, x - 1, y, z);
|
if (hasX) {
|
||||||
boolean flag4 = fence.canConnectFenceTo(world, x + 1, y, z);
|
renderer.setRenderBounds((double)f4, (double)0, (double)0.5, (double)f5, (double)1, (double)0.5);
|
||||||
boolean flag5 = fence.canConnectFenceTo(world, x, y, z - 1);
|
renderer.renderStandardBlock(fence, x, y, z);
|
||||||
boolean flag6 = fence.canConnectFenceTo(world, x, y, z + 1);
|
}
|
||||||
|
|
||||||
if (!flag1 && !flag2)
|
if (hasZ) {
|
||||||
{
|
renderer.setRenderBounds((double)0.5, (double)0, (double)f6, (double)0.5, (double)1, (double)f7);
|
||||||
flag1 = true;
|
renderer.renderStandardBlock(fence, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
f = 0.4375F;
|
if(showPost) {
|
||||||
f1 = 0.5625F;
|
f = 0.375F;
|
||||||
float f4 = flag3 ? 0.0F : f;
|
f1 = 0.625F;
|
||||||
float f5 = flag4 ? 1.0F : f1;
|
renderer.setOverrideBlockTexture(fence.postIcon);
|
||||||
float f6 = flag5 ? 0.0F : f;
|
renderer.setRenderBounds((double)f, 0.0D, (double)f, (double)f1, 1.0D, (double)f1);
|
||||||
float f7 = flag6 ? 1.0F : f1;
|
renderer.renderStandardBlock(fence, x, y, z);
|
||||||
renderer.field_152631_f = true;
|
renderer.clearOverrideBlockTexture();
|
||||||
|
}
|
||||||
|
|
||||||
if (flag1)
|
renderer.field_152631_f = false;
|
||||||
{
|
fence.setBlockBoundsBasedOnState(world, x, y, z);
|
||||||
renderer.setRenderBounds((double)f4, (double)0, (double)0.5, (double)f5, (double)1, (double)0.5);
|
return true;
|
||||||
renderer.renderStandardBlock(fence, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flag2)
|
|
||||||
{
|
|
||||||
renderer.setRenderBounds((double)0.5, (double)0, (double)f6, (double)0.5, (double)1, (double)f7);
|
|
||||||
renderer.renderStandardBlock(fence, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
renderer.field_152631_f = false;
|
|
||||||
fence.setBlockBoundsBasedOnState(world, x, y, z);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -5069,6 +5069,7 @@ tile.fallout.name=Fallout
|
|||||||
tile.fan.name=Fan
|
tile.fan.name=Fan
|
||||||
tile.fan.desc=Activates using redstone$Will push entities up to 10 blocks$Right-click with screwdriver to flip
|
tile.fan.desc=Activates using redstone$Will push entities up to 10 blocks$Right-click with screwdriver to flip
|
||||||
tile.fence_metal.name=Chainlink Fence
|
tile.fence_metal.name=Chainlink Fence
|
||||||
|
tile.fence_metal_post.name=Chainlink Fence Post
|
||||||
tile.field_disturber.name=High Energy Field Jammer
|
tile.field_disturber.name=High Energy Field Jammer
|
||||||
tile.filing_cabinet.green.name=Dusty Filing Cabinet
|
tile.filing_cabinet.green.name=Dusty Filing Cabinet
|
||||||
tile.filing_cabinet.steel.name=Steel Filing Cabinet
|
tile.filing_cabinet.steel.name=Steel Filing Cabinet
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 596 B After Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 596 B |
Loading…
x
Reference in New Issue
Block a user