Created the proper rendering for the crystal clusters while in hand
|
@ -1,7 +1,9 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
|
@ -11,6 +13,7 @@ import net.minecraft.block.state.BlockState;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -23,17 +26,20 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.item.ItemComponent;
|
||||
import WayofTime.bloodmagic.tile.TileAltar;
|
||||
import WayofTime.bloodmagic.tile.TileDemonCrystal;
|
||||
|
||||
public class BlockDemonCrystal extends BlockContainer
|
||||
{
|
||||
public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 6);
|
||||
public static final PropertyEnum<EnumDemonWillType> TYPE = PropertyEnum.<EnumDemonWillType>create("type", EnumDemonWillType.class);
|
||||
public static final PropertyEnum<EnumFacing> ATTACHED = PropertyEnum.<EnumFacing>create("attached", EnumFacing.class);
|
||||
|
||||
public BlockDemonCrystal()
|
||||
{
|
||||
super(Material.rock);
|
||||
this.setDefaultState(this.blockState.getBaseState().withProperty(TYPE, EnumDemonWillType.DEFAULT));
|
||||
this.setDefaultState(this.blockState.getBaseState().withProperty(TYPE, EnumDemonWillType.DEFAULT).withProperty(ATTACHED, EnumFacing.UP));
|
||||
|
||||
setUnlocalizedName(Constants.Mod.MODID + ".demonCrystal");
|
||||
setRegistryName(Constants.BloodMagicBlock.DEMON_CRYSTAL.getRegName());
|
||||
|
@ -43,11 +49,36 @@ public class BlockDemonCrystal extends BlockContainer
|
|||
setHarvestLevel("pickaxe", 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockOnSide(World world, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
BlockPos offsetPos = pos.offset(side.getOpposite());
|
||||
IBlockState offsetState = world.getBlockState(offsetPos);
|
||||
Block offsetBlock = offsetState.getBlock();
|
||||
|
||||
return offsetBlock.isSideSolid(world, offsetPos, side) && this.canPlaceBlockAt(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock)
|
||||
{
|
||||
TileDemonCrystal tile = (TileDemonCrystal) world.getTileEntity(pos);
|
||||
EnumFacing placement = tile.getPlacement();
|
||||
BlockPos offsetPos = pos.offset(placement.getOpposite());
|
||||
IBlockState offsetState = world.getBlockState(offsetPos);
|
||||
Block offsetBlock = offsetState.getBlock();
|
||||
|
||||
if (!offsetBlock.isSideSolid(world, offsetPos, placement))
|
||||
{
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
TileDemonCrystal tile = (TileDemonCrystal) world.getTileEntity(pos);
|
||||
return state.withProperty(AGE, tile.getCrystalCountForRender());
|
||||
return state.withProperty(AGE, tile.getCrystalCountForRender()).withProperty(ATTACHED, tile.getPlacement());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -93,7 +124,6 @@ public class BlockDemonCrystal extends BlockContainer
|
|||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
System.out.println("Meta: " + meta + ", " + EnumDemonWillType.values()[meta]);
|
||||
return this.getDefaultState().withProperty(TYPE, EnumDemonWillType.values()[meta]);
|
||||
}
|
||||
|
||||
|
@ -109,7 +139,7 @@ public class BlockDemonCrystal extends BlockContainer
|
|||
@Override
|
||||
protected BlockState createBlockState()
|
||||
{
|
||||
return new BlockState(this, new IProperty[] { TYPE, AGE });
|
||||
return new BlockState(this, new IProperty[] { TYPE, AGE, ATTACHED });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -118,6 +148,49 @@ public class BlockDemonCrystal extends BlockContainer
|
|||
return new TileDemonCrystal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
TileDemonCrystal tile = (TileDemonCrystal) world.getTileEntity(pos);
|
||||
EnumDemonWillType type = state.getValue(TYPE);
|
||||
int number = tile.getCrystalCount();
|
||||
|
||||
spawnAsEntity(world, pos, getItemStackDropped(type, number));
|
||||
world.removeTileEntity(pos);
|
||||
}
|
||||
|
||||
private ItemStack getItemStackDropped(EnumDemonWillType type, int crystalNumber)
|
||||
{
|
||||
ItemStack stack = null;
|
||||
switch (type)
|
||||
{
|
||||
case CORROSIVE:
|
||||
stack = ItemComponent.getStack(ItemComponent.CRYSTAL_CORROSIVE);
|
||||
break;
|
||||
case DEFAULT:
|
||||
stack = ItemComponent.getStack(ItemComponent.CRYSTAL_DEFAULT);
|
||||
break;
|
||||
case DESTRUCTIVE:
|
||||
stack = ItemComponent.getStack(ItemComponent.CRYSTAL_DESTRUCTIVE);
|
||||
break;
|
||||
case STEADFAST:
|
||||
stack = ItemComponent.getStack(ItemComponent.CRYSTAL_STEADFAST);
|
||||
break;
|
||||
case VENGEFUL:
|
||||
stack = ItemComponent.getStack(ItemComponent.CRYSTAL_VENGEFUL);
|
||||
break;
|
||||
}
|
||||
|
||||
stack.stackSize = crystalNumber;
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
|
|
|
@ -3,6 +3,9 @@ package WayofTime.bloodmagic.block;
|
|||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
|
@ -24,6 +27,12 @@ public class BlockDemonCrystallizer extends BlockContainer
|
|||
// setBlockBounds(0.3F, 0F, 0.3F, 0.72F, 1F, 0.72F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
return side == EnumFacing.UP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
|
|
|
@ -37,6 +37,11 @@ public class ItemComponent extends Item
|
|||
public static final String REAGENT_SEVERANCE = "reagentSeverance";
|
||||
public static final String REAGENT_TELEPOSITION = "reagentTeleposition";
|
||||
public static final String REAGENT_TRANSPOSITION = "reagentTransposition";
|
||||
public static final String CRYSTAL_DEFAULT = "crystalDefault";
|
||||
public static final String CRYSTAL_CORROSIVE = "crystalCorrosive";
|
||||
public static final String CRYSTAL_VENGEFUL = "crystalVengeful";
|
||||
public static final String CRYSTAL_DESTRUCTIVE = "crystalDestructive";
|
||||
public static final String CRYSTAL_STEADFAST = "crystalSteadfast";
|
||||
|
||||
public ItemComponent()
|
||||
{
|
||||
|
@ -71,6 +76,11 @@ public class ItemComponent extends Item
|
|||
names.add(16, REAGENT_SEVERANCE);
|
||||
names.add(17, REAGENT_TELEPOSITION);
|
||||
names.add(18, REAGENT_TRANSPOSITION);
|
||||
names.add(19, CRYSTAL_DEFAULT);
|
||||
names.add(20, CRYSTAL_CORROSIVE);
|
||||
names.add(21, CRYSTAL_VENGEFUL);
|
||||
names.add(22, CRYSTAL_DESTRUCTIVE);
|
||||
names.add(23, CRYSTAL_STEADFAST);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
package WayofTime.bloodmagic.item.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.tile.TileDemonCrystal;
|
||||
|
||||
public class ItemBlockDemonCrystal extends ItemBlock
|
||||
{
|
||||
|
@ -24,4 +31,21 @@ public class ItemBlockDemonCrystal extends ItemBlock
|
|||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState)
|
||||
{
|
||||
if (super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, newState))
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileDemonCrystal)
|
||||
{
|
||||
((TileDemonCrystal) tile).setPlacement(side);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package WayofTime.bloodmagic.registry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
@ -64,6 +65,7 @@ import WayofTime.bloodmagic.tile.routing.TileItemRoutingNode;
|
|||
import WayofTime.bloodmagic.tile.routing.TileMasterRoutingNode;
|
||||
import WayofTime.bloodmagic.tile.routing.TileOutputRoutingNode;
|
||||
import WayofTime.bloodmagic.util.helper.InventoryRenderHelper;
|
||||
import WayofTime.bloodmagic.util.helper.InventoryRenderHelperV2;
|
||||
|
||||
public class ModBlocks
|
||||
{
|
||||
|
@ -168,6 +170,7 @@ public class ModBlocks
|
|||
public static void initRenders()
|
||||
{
|
||||
InventoryRenderHelper renderHelper = BloodMagic.proxy.getRenderHelper();
|
||||
InventoryRenderHelperV2 renderHelperV2 = BloodMagic.proxy.getRenderHelperV2();
|
||||
|
||||
renderHelper.fluidRender(lifeEssence);
|
||||
for (int i = 0; i < BlockBloodRune.names.length; i++)
|
||||
|
@ -212,8 +215,12 @@ public class ModBlocks
|
|||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(pathBlock), 5);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(pathBlock), 6);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(pathBlock), 7);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(demonCrystal));
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(demonPylon));
|
||||
renderHelperV2.registerRender(InventoryRenderHelper.getItemFromBlock(demonCrystal), 0, "ItemBlockDemonCrystal", "default");
|
||||
renderHelperV2.registerRender(InventoryRenderHelper.getItemFromBlock(demonCrystal), 1, "ItemBlockDemonCrystal", "corrosive");
|
||||
renderHelperV2.registerRender(InventoryRenderHelper.getItemFromBlock(demonCrystal), 2, "ItemBlockDemonCrystal", "destructive");
|
||||
renderHelperV2.registerRender(InventoryRenderHelper.getItemFromBlock(demonCrystal), 3, "ItemBlockDemonCrystal", "vengeful");
|
||||
renderHelperV2.registerRender(InventoryRenderHelper.getItemFromBlock(demonCrystal), 4, "ItemBlockDemonCrystal", "steadfast");
|
||||
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(dimensionalPortal));
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.network.Packet;
|
|||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -25,6 +26,9 @@ public class TileDemonCrystal extends TileEntity implements ITickable, IDemonWil
|
|||
@Getter
|
||||
@Setter
|
||||
public int crystalCount = 1;
|
||||
@Getter
|
||||
@Setter
|
||||
public EnumFacing placement = EnumFacing.UP; //Side that this crystal is placed on.
|
||||
|
||||
public TileDemonCrystal()
|
||||
{
|
||||
|
@ -43,8 +47,6 @@ public class TileDemonCrystal extends TileEntity implements ITickable, IDemonWil
|
|||
{
|
||||
crystalCount = Math.min(crystalCount + 1, 7);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
|
||||
System.out.println("" + crystalCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,6 +62,7 @@ public class TileDemonCrystal extends TileEntity implements ITickable, IDemonWil
|
|||
|
||||
holder.readFromNBT(tag, "Will");
|
||||
crystalCount = tag.getInteger("crystalCount");
|
||||
placement = EnumFacing.getFront(tag.getInteger("placement"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -69,6 +72,7 @@ public class TileDemonCrystal extends TileEntity implements ITickable, IDemonWil
|
|||
|
||||
holder.writeToNBT(tag, "Will");
|
||||
tag.setInteger("crystalCount", crystalCount);
|
||||
tag.setInteger("placement", placement.getIndex());
|
||||
}
|
||||
|
||||
// IDemonWillConduit
|
||||
|
|
|
@ -9,6 +9,40 @@
|
|||
}
|
||||
},
|
||||
"variants": {
|
||||
"attached": {
|
||||
"down": {
|
||||
"transform": {
|
||||
"translation": [ 0, 0, -1 ],
|
||||
"rotation": {"x": 180}
|
||||
}
|
||||
},
|
||||
"up": {
|
||||
},
|
||||
"north": {
|
||||
"transform": {
|
||||
"translation": [ 0, 1, 0 ],
|
||||
"rotation": {"x": -90}
|
||||
}
|
||||
},
|
||||
"south": {
|
||||
"transform": {
|
||||
"translation": [ 0, -1, 0 ],
|
||||
"rotation": {"x": 90}
|
||||
}
|
||||
},
|
||||
"east": {
|
||||
"transform": {
|
||||
"translation": [ 0, 0, 1 ],
|
||||
"rotation": {"z": -90}
|
||||
}
|
||||
},
|
||||
"west": {
|
||||
"transform": {
|
||||
"translation": [ 0, 0, 1 ],
|
||||
"rotation": {"z": 90}
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": {
|
||||
"default": {
|
||||
"textures": {
|
||||
|
@ -89,6 +123,35 @@
|
|||
"inventory": [{
|
||||
"transform": {
|
||||
"translation": [0.44, -0.1, 0.44]
|
||||
},
|
||||
"variants": {
|
||||
"type": {
|
||||
"default": {
|
||||
"textures": {
|
||||
"#crystal" : "bloodmagic:models/DefaultCrystal"
|
||||
}
|
||||
},
|
||||
"corrosive": {
|
||||
"textures": {
|
||||
"#crystal" : "bloodmagic:models/CorrosiveCrystal"
|
||||
}
|
||||
},
|
||||
"destructive": {
|
||||
"textures": {
|
||||
"#crystal" : "bloodmagic:models/DestructiveCrystal"
|
||||
}
|
||||
},
|
||||
"vengeful": {
|
||||
"textures": {
|
||||
"#crystal" : "bloodmagic:models/VengefulCrystal"
|
||||
}
|
||||
},
|
||||
"steadfast": {
|
||||
"textures": {
|
||||
"#crystal" : "bloodmagic:models/SteadfastCrystal"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"model": "bloodmagic:crystal/Crystal1.obj",
|
||||
"custom": { "flip-v": true },
|
||||
"transform": {
|
||||
"translation": [ 0, 0, 1]
|
||||
}
|
||||
},
|
||||
"variants": {
|
||||
"type": {
|
||||
"default": {
|
||||
"textures": {
|
||||
"#crystal" : "bloodmagic:models/DefaultCrystal"
|
||||
}
|
||||
},
|
||||
"corrosive": {
|
||||
"textures": {
|
||||
"#crystal" : "bloodmagic:models/CorrosiveCrystal"
|
||||
}
|
||||
},
|
||||
"destructive": {
|
||||
"textures": {
|
||||
"#crystal" : "bloodmagic:models/DestructiveCrystal"
|
||||
}
|
||||
},
|
||||
"vengeful": {
|
||||
"textures": {
|
||||
"#crystal" : "bloodmagic:models/VengefulCrystal"
|
||||
}
|
||||
},
|
||||
"steadfast": {
|
||||
"textures": {
|
||||
"#crystal" : "bloodmagic:models/SteadfastCrystal"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -100,6 +100,31 @@
|
|||
"textures": {
|
||||
"layer0": "bloodmagic:items/ReagentTransposition"
|
||||
}
|
||||
},
|
||||
"crystaldefault": {
|
||||
"textures": {
|
||||
"layer0": "bloodmagic:items/DefaultCrystal"
|
||||
}
|
||||
},
|
||||
"crystalcorrosive": {
|
||||
"textures": {
|
||||
"layer0": "bloodmagic:items/CorrosiveCrystal"
|
||||
}
|
||||
},
|
||||
"crystalvengeful": {
|
||||
"textures": {
|
||||
"layer0": "bloodmagic:items/VengefulCrystal"
|
||||
}
|
||||
},
|
||||
"crystaldestructive": {
|
||||
"textures": {
|
||||
"layer0": "bloodmagic:items/DestructiveCrystal"
|
||||
}
|
||||
},
|
||||
"crystalsteadfast": {
|
||||
"textures": {
|
||||
"layer0": "bloodmagic:items/SteadfastCrystal"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
After Width: | Height: | Size: 761 B |
After Width: | Height: | Size: 740 B |
After Width: | Height: | Size: 765 B |
After Width: | Height: | Size: 751 B |
After Width: | Height: | Size: 796 B |
Before Width: | Height: | Size: 765 B After Width: | Height: | Size: 749 B |