Code: Select all
##
##START BTW BLOCS
##
# SFS
block(blockid=209, top_image="textures/blocks/fcBlockSoulforgedSteel.png")
# fcTurntable
block(blockid=249, top_image="textures/blocks/fcBlockTurntable_top.png", side_image="textures/blocks/fcBlockTurntable_side.png")
#fcMillStone
block(blockid=243, top_image="textures/blocks/fcBlockMillStone_top.png", side_image="textures/blocks/fcBlockMillStone_side.png")
#fcCauldron
block(blockid=234, top_image="textures/blocks/fcBlockCauldron_top.png", side_image="textures/blocks/fcBlockCauldron_side.png")
#fcPressurePlateObsidian see Pressure_Plate
#fcPulley
block(blockid=229, top_image="textures/blocks/fcBlockPulley_bottom.png", side_image="textures/blocks/fcBlockPulley_bottom.png")
#fcPlatform
block(blockid=227, top_image="textures/blocks/fcBlockPlatform_top.png", side_image="textures/blocks/fcBlockPlatform_side.png")
#FcBBQ
block(blockid=224, top_image="textures/blocks/fcBlockHibachi_top.png", side_image="textures/blocks/fcBlockHibachi_side.png")
#fcLightBulbOn
block(blockid=223, top_image="textures/blocks/fcBlockLightBlock_lit")
#fcLightBulbOff
block(blockid=222, top_image="textures/blocks/fcBlockLightBlock.png")
#fcLeaves
block(blockid=221, top_index="textures/blocks/fcBlockLeavesBloodWood_old.png")
#FCHoper
block(blockid=225, top_image="textures/blocks/fcBlockHopper_top.png", side_image="textures/blocks/fcBlockHopper_side.png")
#ciment
block(blockid=228, top_image="textures/blocks/fcBlockCement_drying.png")
#fcWoolSlab 220
@material(blockid=[220,205], data=range(16), solid=True)
def fcWoolSlab(self, blockid, data):
texture = self.load_image_texture("textures/blocks/cloth_"+data+".png")
side = texture
top = side
# cut the side texture in half
mask = side.crop((0,8,16,16))
side = Image.new(side.mode, side.size, self.bgcolor)
alpha_over(side, mask,(0,0,16,8), mask)
# plain slab
top = self.transform_image_top(top)
side = self.transform_image_side(side)
otherside = side.transpose(Image.FLIP_LEFT_RIGHT)
sidealpha = side.split()[3]
side = ImageEnhance.Brightness(side).enhance(0.9)
side.putalpha(sidealpha)
othersidealpha = otherside.split()[3]
otherside = ImageEnhance.Brightness(otherside).enhance(0.8)
otherside.putalpha(othersidealpha)
# upside down slab
delta = 0
if(blockid==205):
delta = 6
img = Image.new("RGBA", (24,24), self.bgcolor)
alpha_over(img, side, (0,12 - delta), side)
alpha_over(img, otherside, (12,12 - delta), otherside)
alpha_over(img, top, (0,6 - delta), top)
return img
#fcAestheticOpaque
@material(blockid=215, data=range(12), solid=True)
def fcAestheticOpaque(self, blockid, data):
#Wicker
if data==0:
return self.build_block(self.load_image_texture("textures/blocks/fcBlockWicker.png"), self.load_image_texture("textures/blocks/fcBlockWicker.png"))
#Dung
if data==1:
return self.build_block(self.load_image_texture("textures/blocks/fcBlockDung.png"), self.load_image_texture("textures/blocks/fcBlockDung.png"))
#Steel
if data==2:
return self.build_block(self.load_image_texture("textures/blocks/fcBlockSoulforgedSteel.png"), self.load_image_texture("textures/blocks/fcBlockSoulforgedSteel.png"))
#Hellfire
if data==3:
return self.build_block(self.load_image_texture("textures/blocks/fcBlockConcentratedHellfire.png"), self.load_image_texture("textures/blocks/fcBlockConcentratedHellfire.png"))
#Padding
if data==4:
return self.build_block(self.load_image_texture("textures/blocks/fcBlockPadding.png"), self.load_image_texture("textures/blocks/fcBlockPadding.png"))
#Soap
if data==5:
return self.build_block(self.load_image_texture("textures/blocks/fcBlockSoap_top.png"), self.load_image_texture("textures/blocks/fcBlockSoap_top.png"))
#Rope
if data==6:
return self.build_block(self.load_image_texture("textures/blocks/fcBlockRope_top.png"), self.load_image_texture("textures/blocks/fcBlockRope_side.png"))
#Flint
if data==7:
return self.build_block(self.load_image_texture("textures/blocks/bedrock.png"), self.load_image_texture("textures/blocks/bedrock.png"))
#NetherrackWithGrowth
if data==8:
return self.build_block(self.load_image_texture("textures/blocks/fcBlockGroth_top_grown.png"), self.load_image_texture("textures/blocks/fcBlockGroth_side.png"))
#WhiteStone
if data==9:
return self.build_block(self.load_image_texture("textures/blocks/fcBlockWhiteStone.png"), self.load_image_texture("textures/blocks/fcBlockWhiteStone.png"))
#WhiteCobble
if data==10:
return self.build_block(self.load_image_texture("textures/blocks/fcBlockWhiteCobble.png"), self.load_image_texture("textures/blocks/fcBlockWhiteCobble.png"))
#Barrel
if data==11:
return self.build_block(self.load_image_texture("textures/blocks/fcBlockBarrel_top.png"), self.load_image_texture("textures/blocks/fcBlockBarrel_side.png"))
return self.build_block(self.load_image_texture("textures/blocks/stone.png"),self.load_image_texture("textures/blocks/stone.png"))
#fcAestheticNonOpaque
@material(blockid=216, data=range(12), solid=True, transparent=True, nospawn=True)
def fcAestheticNonOpaque(self, blockid, data):
#Urns
#if data==0:
# return
#if data==1:
# return
#if data==2:
# return
#if data==3:
# return
#if data==4:
# return
#WickerSlab whiteCooble
if (data==5 or data==9 or data==10 or data==11):
if(data==5 or data==9):
side = self.load_image_texture("textures/blocks/fcBlockWicker.png")
if(data==10 or data==11):
side = self.load_image_texture("textures/blocks/fcBlockWhiteCobble.png")
top = side
# cut the side texture in half
mask = side.crop((0,8,16,16))
side = Image.new(side.mode, side.size, self.bgcolor)
alpha_over(side, mask,(0,0,16,8), mask)
# plain slab
top = self.transform_image_top(top)
side = self.transform_image_side(side)
otherside = side.transpose(Image.FLIP_LEFT_RIGHT)
sidealpha = side.split()[3]
side = ImageEnhance.Brightness(side).enhance(0.9)
side.putalpha(sidealpha)
othersidealpha = otherside.split()[3]
otherside = ImageEnhance.Brightness(otherside).enhance(0.8)
otherside.putalpha(othersidealpha)
# upside down slab
delta = 0
if(data==9 or data==11):
delta = 6
img = Image.new("RGBA", (24,24), self.bgcolor)
alpha_over(img, side, (0,12 - delta), side)
alpha_over(img, otherside, (12,12 - delta), otherside)
alpha_over(img, top, (0,6 - delta), top)
return img
#grate whiker slats
if (data==6 or data==7 or data==8):
#grate
if data==6:
t = self.load_image_texture("textures/blocks/fcBlockGrate.png")
#whiker
if data==7:
t = self.load_image_texture("textures/blocks/fcBlockWicker.png")
#slats
if data==8:
t = self.load_image_texture("textures/blocks/fcBlockSlats.png")
left = t.copy()
right = t.copy()
# generate the four small pieces of the glass pane
ImageDraw.Draw(right).rectangle((0,0,7,15),outline=(0,0,0,0),fill=(0,0,0,0))
ImageDraw.Draw(left).rectangle((8,0,15,15),outline=(0,0,0,0),fill=(0,0,0,0))
up_left = self.transform_image_side(left)
up_right = self.transform_image_side(right).transpose(Image.FLIP_TOP_BOTTOM)
dw_right = self.transform_image_side(right)
dw_left = self.transform_image_side(left).transpose(Image.FLIP_TOP_BOTTOM)
# Create img to compose the texture
img = Image.new("RGBA", (24,24), self.bgcolor)
# +x axis points top right direction
# +y axis points bottom right direction
# First compose things in the back of the image,
# then things in the front.
if (data & 0b0001) == 1 or data == 0:
alpha_over(img,up_left, (6,3),up_left) # top left
if (data & 0b1000) == 8 or data == 0:
alpha_over(img,up_right, (6,3),up_right) # top right
if (data & 0b0010) == 2 or data == 0:
alpha_over(img,dw_left, (6,3),dw_left) # bottom left
if (data & 0b0100) == 4 or data == 0:
alpha_over(img,dw_right, (6,3),dw_right) # bottom right
return img
return self.build_block(self.load_image_texture("textures/blocks/stone.png"),self.load_image_texture("textures/blocks/stone.png"))
# THE OMINI SLAB
@material(blockid=246, data=range(12), solid=True, nospawn=True)
def fcOMINIBLOCK(self, blockid, data):
faceing = (data >> 1)
#side = self.terrain_images[2]
side = self.load_image_texture("textures/blocks/stone.png")
if (data & 1) > 0:
side = self.load_image_texture("textures/blocks/wood.png")
else:
side = self.load_image_texture("textures/blocks/stone.png")
# upside down slab
delta = 0
delta2 = 0
if faceing==0 or faceing==3:
delta = 6
delta2 = 3
topx = side
if faceing==2 or faceing==3:
# cut the side texture in half
mask = side.crop((8,0,16,16))
side = Image.new(side.mode, side.size, self.bgcolor)
alpha_over(side, mask,(8,0,16,16), mask)
# plain slab
otherside = self.transform_image_side(topx).transpose(Image.FLIP_LEFT_RIGHT)
if faceing==2:
topx = self.transform_image_top(side.transpose(Image.ROTATE_270))
else:
topx = self.transform_image_top(side.transpose(Image.ROTATE_90))
side = self.transform_image_side(side)
sidealpha = side.split()[3]
side = ImageEnhance.Brightness(side).enhance(0.9)
side.putalpha(sidealpha)
othersidealpha = otherside.split()[3]
otherside = ImageEnhance.Brightness(otherside).enhance(0.8)
otherside.putalpha(othersidealpha)
img = Image.new("RGBA", (24,24))
if faceing==3:
alpha_over(img, topx, (0,0), topx)
alpha_over(img, side, (-6,3), side)
alpha_over(img, otherside, (6,3), otherside)
else:
alpha_over(img, topx, (0,0 ), topx)
alpha_over(img, side, (0,6), side)
alpha_over(img, otherside, (12,6), otherside)
else:
# cut the side texture in half
mask = side.crop((0,8,16,16))
side = Image.new(side.mode, side.size, self.bgcolor)
alpha_over(side, mask,(0,0,16,8), mask)
# plain slab
topx = self.transform_image_top(topx)
side = self.transform_image_side(side)
otherside = side.transpose(Image.FLIP_LEFT_RIGHT)
sidealpha = side.split()[3]
side = ImageEnhance.Brightness(side).enhance(0.9)
side.putalpha(sidealpha)
othersidealpha = otherside.split()[3]
otherside = ImageEnhance.Brightness(otherside).enhance(0.8)
otherside.putalpha(othersidealpha)
img = Image.new("RGBA", (24,24), self.bgcolor)
alpha_over(img, side, (0,12 - delta), side)
alpha_over(img, otherside, (12,12 - delta), otherside)
alpha_over(img, topx, (0,6 - delta), topx)
return img
##
##END BTW block
##