Tinkered with the beam a bit. Added WIP models for the routing nodes. Added basic item routing node.

This commit is contained in:
WayofTime 2016-01-15 21:53:55 -05:00
parent 08e8ebf724
commit 76dceb3534
11 changed files with 283 additions and 99 deletions

View file

@ -1,7 +1,5 @@
package WayofTime.bloodmagic.block; package WayofTime.bloodmagic.block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -10,19 +8,15 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants; import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.tile.routing.TileInputRoutingNode; import WayofTime.bloodmagic.tile.routing.TileOutputRoutingNode;
public class BlockInputRoutingNode extends BlockContainer public class BlockInputRoutingNode extends BlockRoutingNode
{ {
public BlockInputRoutingNode() public BlockInputRoutingNode()
{ {
super(Material.rock); super();
setUnlocalizedName(Constants.Mod.MODID + ".inputRouting"); setUnlocalizedName(Constants.Mod.MODID + ".inputRouting");
setCreativeTab(BloodMagic.tabBloodMagic);
setHardness(2.0F);
setResistance(5.0F);
setHarvestLevel("pickaxe", 2);
} }
@Override @Override
@ -34,7 +28,7 @@ public class BlockInputRoutingNode extends BlockContainer
@Override @Override
public TileEntity createNewTileEntity(World worldIn, int meta) public TileEntity createNewTileEntity(World worldIn, int meta)
{ {
return new TileInputRoutingNode(); return new TileOutputRoutingNode();
} }
@Override @Override
@ -42,10 +36,10 @@ public class BlockInputRoutingNode extends BlockContainer
public void breakBlock(World world, BlockPos pos, IBlockState state) public void breakBlock(World world, BlockPos pos, IBlockState state)
{ {
TileEntity tile = world.getTileEntity(pos); TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileInputRoutingNode) if (tile instanceof TileOutputRoutingNode)
{ {
((TileInputRoutingNode) tile).removeAllConnections(); ((TileOutputRoutingNode) tile).removeAllConnections();
((TileInputRoutingNode) tile).dropItems(); ((TileOutputRoutingNode) tile).dropItems();
} }
super.breakBlock(world, pos, state); super.breakBlock(world, pos, state);
} }
@ -53,7 +47,7 @@ public class BlockInputRoutingNode extends BlockContainer
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
{ {
if (world.getTileEntity(pos) instanceof TileInputRoutingNode) if (world.getTileEntity(pos) instanceof TileOutputRoutingNode)
{ {
player.openGui(BloodMagic.instance, Constants.Gui.ROUTING_NODE_GUI, world, pos.getX(), pos.getY(), pos.getZ()); player.openGui(BloodMagic.instance, Constants.Gui.ROUTING_NODE_GUI, world, pos.getX(), pos.getY(), pos.getZ());
} }

View file

@ -0,0 +1,42 @@
package WayofTime.bloodmagic.block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.tile.routing.TileItemRoutingNode;
import WayofTime.bloodmagic.tile.routing.TileRoutingNode;
public class BlockItemRoutingNode extends BlockRoutingNode
{
public BlockItemRoutingNode()
{
super();
setUnlocalizedName(Constants.Mod.MODID + ".itemRouting");
}
@Override
public int getRenderType()
{
return 3;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileItemRoutingNode();
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileRoutingNode)
{
((TileRoutingNode) tile).removeAllConnections();
}
super.breakBlock(world, pos, state);
}
}

View file

@ -1,99 +1,22 @@
package WayofTime.bloodmagic.block; package WayofTime.bloodmagic.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.BlockFenceGate;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants; import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.tile.routing.TileOutputRoutingNode; import WayofTime.bloodmagic.tile.routing.TileOutputRoutingNode;
public class BlockOutputRoutingNode extends BlockContainer public class BlockOutputRoutingNode extends BlockRoutingNode
{ {
public static final PropertyBool UP = PropertyBool.create("up");
public static final PropertyBool DOWN = PropertyBool.create("down");
public static final PropertyBool NORTH = PropertyBool.create("north");
public static final PropertyBool EAST = PropertyBool.create("east");
public static final PropertyBool SOUTH = PropertyBool.create("south");
public static final PropertyBool WEST = PropertyBool.create("west");
public BlockOutputRoutingNode() public BlockOutputRoutingNode()
{ {
super(Material.rock); super();
setUnlocalizedName(Constants.Mod.MODID + ".outputRouting"); setUnlocalizedName(Constants.Mod.MODID + ".outputRouting");
setCreativeTab(BloodMagic.tabBloodMagic);
setHardness(2.0F);
setResistance(5.0F);
setHarvestLevel("pickaxe", 2);
this.setDefaultState(this.blockState.getBaseState().withProperty(DOWN, Boolean.valueOf(false)).withProperty(UP, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)));
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean isFullCube()
{
return false;
}
@Override
public boolean isVisuallyOpaque()
{
return false;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState();
}
/**
* Convert the BlockState into the correct metadata value
*/
@Override
public int getMetaFromState(IBlockState state)
{
return 0;
}
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
return state.withProperty(UP, Boolean.valueOf(this.shouldConnect(worldIn, pos.up()))).withProperty(DOWN, Boolean.valueOf(this.shouldConnect(worldIn, pos.down()))).withProperty(NORTH, Boolean.valueOf(this.shouldConnect(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.shouldConnect(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.shouldConnect(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.shouldConnect(worldIn, pos.west())));
}
@Override
protected BlockState createBlockState()
{
return new BlockState(this, new IProperty[] { UP, DOWN, NORTH, EAST, WEST, SOUTH });
}
public boolean shouldConnect(IBlockAccess world, BlockPos pos)
{
Block block = world.getBlockState(pos).getBlock();
if (block instanceof BlockOutputRoutingNode)
{
return false;
}
return block == Blocks.barrier ? false : (block != this && !(block instanceof BlockFenceGate) ? (block.getMaterial().isOpaque() && block.isFullCube() ? block.getMaterial() != Material.gourd : false) : true);
} }
@Override @Override

View file

@ -0,0 +1,97 @@
package WayofTime.bloodmagic.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.BlockFenceGate;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraft.world.IBlockAccess;
import WayofTime.bloodmagic.BloodMagic;
public abstract class BlockRoutingNode extends BlockContainer
{
public static final PropertyBool UP = PropertyBool.create("up");
public static final PropertyBool DOWN = PropertyBool.create("down");
public static final PropertyBool NORTH = PropertyBool.create("north");
public static final PropertyBool EAST = PropertyBool.create("east");
public static final PropertyBool SOUTH = PropertyBool.create("south");
public static final PropertyBool WEST = PropertyBool.create("west");
public BlockRoutingNode()
{
super(Material.rock);
setCreativeTab(BloodMagic.tabBloodMagic);
setHardness(2.0F);
setResistance(5.0F);
setHarvestLevel("pickaxe", 2);
this.setDefaultState(this.blockState.getBaseState().withProperty(DOWN, Boolean.valueOf(false)).withProperty(UP, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)));
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean isFullCube()
{
return false;
}
@Override
public boolean isVisuallyOpaque()
{
return false;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState();
}
/**
* Convert the BlockState into the correct metadata value
*/
@Override
public int getMetaFromState(IBlockState state)
{
return 0;
}
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
return state.withProperty(UP, Boolean.valueOf(this.shouldConnect(worldIn, pos.up()))).withProperty(DOWN, Boolean.valueOf(this.shouldConnect(worldIn, pos.down()))).withProperty(NORTH, Boolean.valueOf(this.shouldConnect(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.shouldConnect(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.shouldConnect(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.shouldConnect(worldIn, pos.west())));
}
@Override
protected BlockState createBlockState()
{
return new BlockState(this, new IProperty[] { UP, DOWN, NORTH, EAST, WEST, SOUTH });
}
public boolean shouldConnect(IBlockAccess world, BlockPos pos)
{
Block block = world.getBlockState(pos).getBlock();
if (block instanceof BlockRoutingNode)
{
return false;
}
return block == Blocks.barrier ? false : (block != this && !(block instanceof BlockFenceGate) ? (block.getMaterial().isOpaque() && block.isFullCube() ? block.getMaterial() != Material.gourd : false) : true);
}
@Override
public int getRenderType()
{
return 3;
}
}

View file

@ -14,6 +14,7 @@ import WayofTime.bloodmagic.block.BlockBloodRune;
import WayofTime.bloodmagic.block.BlockBloodStoneBrick; import WayofTime.bloodmagic.block.BlockBloodStoneBrick;
import WayofTime.bloodmagic.block.BlockCrystal; import WayofTime.bloodmagic.block.BlockCrystal;
import WayofTime.bloodmagic.block.BlockInputRoutingNode; import WayofTime.bloodmagic.block.BlockInputRoutingNode;
import WayofTime.bloodmagic.block.BlockItemRoutingNode;
import WayofTime.bloodmagic.block.BlockLifeEssence; import WayofTime.bloodmagic.block.BlockLifeEssence;
import WayofTime.bloodmagic.block.BlockMasterRoutingNode; import WayofTime.bloodmagic.block.BlockMasterRoutingNode;
import WayofTime.bloodmagic.block.BlockOutputRoutingNode; import WayofTime.bloodmagic.block.BlockOutputRoutingNode;
@ -41,6 +42,7 @@ import WayofTime.bloodmagic.tile.TileSoulForge;
import WayofTime.bloodmagic.tile.TileSpectralBlock; import WayofTime.bloodmagic.tile.TileSpectralBlock;
import WayofTime.bloodmagic.tile.TileTeleposer; import WayofTime.bloodmagic.tile.TileTeleposer;
import WayofTime.bloodmagic.tile.routing.TileInputRoutingNode; import WayofTime.bloodmagic.tile.routing.TileInputRoutingNode;
import WayofTime.bloodmagic.tile.routing.TileItemRoutingNode;
import WayofTime.bloodmagic.tile.routing.TileMasterRoutingNode; import WayofTime.bloodmagic.tile.routing.TileMasterRoutingNode;
import WayofTime.bloodmagic.tile.routing.TileOutputRoutingNode; import WayofTime.bloodmagic.tile.routing.TileOutputRoutingNode;
import WayofTime.bloodmagic.util.helper.InventoryRenderHelper; import WayofTime.bloodmagic.util.helper.InventoryRenderHelper;
@ -68,6 +70,7 @@ public class ModBlocks
public static Block masterRoutingNode; public static Block masterRoutingNode;
public static Block inputRoutingNode; public static Block inputRoutingNode;
public static Block outputRoutingNode; public static Block outputRoutingNode;
public static Block itemRoutingNode;
public static void init() public static void init()
{ {
@ -91,6 +94,7 @@ public class ModBlocks
masterRoutingNode = registerBlock(new BlockMasterRoutingNode()); masterRoutingNode = registerBlock(new BlockMasterRoutingNode());
inputRoutingNode = registerBlock(new BlockInputRoutingNode()); inputRoutingNode = registerBlock(new BlockInputRoutingNode());
outputRoutingNode = registerBlock(new BlockOutputRoutingNode()); outputRoutingNode = registerBlock(new BlockOutputRoutingNode());
itemRoutingNode = registerBlock(new BlockItemRoutingNode());
initTiles(); initTiles();
} }
@ -109,6 +113,7 @@ public class ModBlocks
GameRegistry.registerTileEntity(TileMasterRoutingNode.class, Constants.Mod.MODID + ":" + TileMasterRoutingNode.class.getSimpleName()); GameRegistry.registerTileEntity(TileMasterRoutingNode.class, Constants.Mod.MODID + ":" + TileMasterRoutingNode.class.getSimpleName());
GameRegistry.registerTileEntity(TileInputRoutingNode.class, Constants.Mod.MODID + ":" + TileInputRoutingNode.class.getSimpleName()); GameRegistry.registerTileEntity(TileInputRoutingNode.class, Constants.Mod.MODID + ":" + TileInputRoutingNode.class.getSimpleName());
GameRegistry.registerTileEntity(TileOutputRoutingNode.class, Constants.Mod.MODID + ":" + TileOutputRoutingNode.class.getSimpleName()); GameRegistry.registerTileEntity(TileOutputRoutingNode.class, Constants.Mod.MODID + ":" + TileOutputRoutingNode.class.getSimpleName());
GameRegistry.registerTileEntity(TileItemRoutingNode.class, Constants.Mod.MODID + ":" + TileItemRoutingNode.class.getSimpleName());
} }
public static void initRenders() public static void initRenders()
@ -144,6 +149,8 @@ public class ModBlocks
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(phantomBlock)); renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(phantomBlock));
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(soulForge)); renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(soulForge));
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(outputRoutingNode)); renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(outputRoutingNode));
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(inputRoutingNode));
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(itemRoutingNode));
} }
private static Block registerBlock(Block block, Class<? extends ItemBlock> itemBlock, String name) private static Block registerBlock(Block block, Class<? extends ItemBlock> itemBlock, String name)

View file

@ -0,0 +1,9 @@
package WayofTime.bloodmagic.tile.routing;
public class TileItemRoutingNode extends TileRoutingNode
{
public TileItemRoutingNode()
{
super(0, "itemNode");
}
}

View file

@ -1,7 +1,45 @@
{ {
"forge_marker": 1,
"defaults": {
"model": "bloodmagic:routing/OutputRoutingNodeCore",
"rotation": [
{
"y": 45
},
{
"x": 45
}
],
"textures": {
"core": "blocks/gold_block",
"attachment": "minecraft:blocks/stone"
},
"uvlock": true // This and all other properties of "defaults" will be inherited by simple submodels. They will NOT be inherited by named submodels.
},
"variants": { "variants": {
"normal": { "model": "bloodmagic:BlockInputRoutingNode" } "north": {
"true": {"submodel": "bloodmagic:routing/RoutingNodeBase"}, // Simple submodel declaration. You can also specify multiple submodels for a variant.
"false": {}
},
"south": {
"true": {"submodel": "bloodmagic:routing/RoutingNodeBase", "y": 180},
"false": {}
},
"east": {
"true": {"submodel": "bloodmagic:routing/RoutingNodeBase", "y": 90}, // Submodel will be rotated.
"false": {}
},
"west": {
"true": {"submodel": "bloodmagic:routing/RoutingNodeBase", "y": 270},
"false": {}
},
"down": {
"true": {"submodel": "bloodmagic:routing/RoutingNodeBase", "x": 90},
"false": {}
},
"up": {
"true": {"submodel": "bloodmagic:routing/RoutingNodeBase", "x": -90},
"false": {}
} // Must have this in here or the blockstates loader will not know of all the properties and values, and it will create the wrong vanilla state strings.
} }
} }

View file

@ -0,0 +1,45 @@
{
"forge_marker": 1,
"defaults": {
"model": "bloodmagic:routing/OutputRoutingNodeCore",
"rotation": [
{
"y": 45
},
{
"x": 45
}
],
"textures": {
"core": "blocks/cobblestone",
"attachment": "minecraft:blocks/stone"
},
"uvlock": true // This and all other properties of "defaults" will be inherited by simple submodels. They will NOT be inherited by named submodels.
},
"variants": {
"north": {
"true": {"submodel": "bloodmagic:routing/RoutingNodeBase"}, // Simple submodel declaration. You can also specify multiple submodels for a variant.
"false": {}
},
"south": {
"true": {"submodel": "bloodmagic:routing/RoutingNodeBase", "y": 180},
"false": {}
},
"east": {
"true": {"submodel": "bloodmagic:routing/RoutingNodeBase", "y": 90}, // Submodel will be rotated.
"false": {}
},
"west": {
"true": {"submodel": "bloodmagic:routing/RoutingNodeBase", "y": 270},
"false": {}
},
"down": {
"true": {"submodel": "bloodmagic:routing/RoutingNodeBase", "x": 90},
"false": {}
},
"up": {
"true": {"submodel": "bloodmagic:routing/RoutingNodeBase", "x": -90},
"false": {}
} // Must have this in here or the blockstates loader will not know of all the properties and values, and it will create the wrong vanilla state strings.
}
}

View file

@ -0,0 +1,14 @@
{
"parent": "bloodmagic:block/routing/OutputRoutingNodeCore",
"textures": {
"core": "blocks/gold_block",
"attachment": "minecraft:blocks/stone"
},
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View file

@ -0,0 +1,15 @@
{
"parent": "bloodmagic:block/routing/OutputRoutingNodeCore",
"textures": {
"core": "blocks/cobblestone",
"attachment": "minecraft:blocks/stone"
},
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View file

@ -6,5 +6,5 @@
vec4 color = texture2D(bgl_RenderedTexture, texcoord); vec4 color = texture2D(bgl_RenderedTexture, texcoord);
float r = sin(texcoord.x * 6 - 1.5 + sin(texcoord.y - time / 3.0)) * 1.1; //(sin((texcoord.x - texcoord.y) * 4 - time) + 1) / 2; float r = sin(texcoord.x * 6 - 1.5 + sin(texcoord.y - time / 3.0)) * 1.1; //(sin((texcoord.x - texcoord.y) * 4 - time) + 1) / 2;
gl_FragColor = vec4(color.r * gl_Color.r, color.g * gl_Color.g, max(color.b * gl_Color.b, r), color.a * gl_Color.a); gl_FragColor = vec4(min(1 - r, color.r * gl_Color.r), min(1 - r, color.g * gl_Color.g), color.b * gl_Color.b, color.a * gl_Color.a);
} }