use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.
the class RenderBlockSkinnable method renderTileEntityAt.
public void renderTileEntityAt(TileEntitySkinnable tileEntity, double x, double y, double z, float partialTickTime) {
ModRenderHelper.setLightingForBlock(tileEntity.getWorldObj(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
SkinPointer skinPointer = tileEntity.getSkinPointer();
if (skinPointer != null) {
Skin skin = ClientSkinCache.INSTANCE.getSkin(skinPointer);
if (skin != null) {
renderSkin(tileEntity, x, y, z, skin);
} else {
ClientSkinCache.INSTANCE.requestSkinFromServer(skinPointer);
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5F, y + 0.5F, z + 0.5F);
loadingModel.render(tileEntity, partialTickTime, 0.0625F);
GL11.glPopMatrix();
}
}
}
use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.
the class RecipeClearDye method getCraftingResult.
@Override
public ItemStack getCraftingResult(InventoryCrafting invCrafting) {
ItemStack skinStack = null;
ItemStack soapStack = null;
for (int slotId = 0; slotId < invCrafting.getSizeInventory(); slotId++) {
ItemStack stack = invCrafting.getStackInSlot(slotId);
if (stack == null) {
continue;
}
Item item = stack.getItem();
if (item == ModItems.soap) {
if (soapStack != null) {
return null;
}
soapStack = stack;
} else if (item == ModItems.equipmentSkin) {
if (skinStack != null) {
return null;
}
if (SkinNBTHelper.stackHasSkinData(stack)) {
skinStack = stack;
} else {
return null;
}
}
}
if (skinStack != null && soapStack != null) {
ItemStack returnStack = skinStack.copy();
SkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(returnStack);
ISkinDye dye = skinPointer.getSkinDye();
for (int i = 0; i < 8; i++) {
dye.removeDye(i);
}
SkinNBTHelper.addSkinDataToStack(returnStack, skinPointer);
return returnStack;
}
return null;
}
use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.
the class BlockSkinnable method getPickBlock.
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
SkinPointer skinPointer = getSkinPointer(world, x, y, z);
if (skinPointer != null) {
ItemStack returnStack = new ItemStack(ModItems.equipmentSkin, 1);
SkinNBTHelper.addSkinDataToStack(returnStack, skinPointer);
return returnStack;
}
return null;
}
use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.
the class BlockSkinnable method dropSkin.
private void dropSkin(World world, int x, int y, int z, boolean isCreativeMode) {
TileEntitySkinnable te = getTileEntity(world, x, y, z);
if (te != null) {
SkinPointer skinPointer = te.getSkinPointer();
if (skinPointer != null) {
if (!isCreativeMode) {
ItemStack skinStack = new ItemStack(ModItems.equipmentSkin, 1);
SkinNBTHelper.addSkinDataToStack(skinStack, skinPointer);
UtilItems.spawnItemInWorld(world, x, y, z, skinStack);
}
te.killChildren(world);
} else {
ModLogger.log(Level.WARN, String.format("Block skin at x:%d y:%d z:%d had no skin data.", x, y, z));
}
}
}
use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.
the class SkinDataHandler method saveSkinPointerOnStack.
@Override
public void saveSkinPointerOnStack(ISkinPointer skinPointer, ItemStack stack) {
if (stack == null) {
return;
}
SkinPointer sp = new SkinPointer(skinPointer);
SkinNBTHelper.addSkinDataToStack(stack, sp);
}
Aggregations