Update hull to 1.10.2

- glass transparency
- colors in item form
- stairs and tiled variants
This commit is contained in:
LemADEC 2017-11-15 23:23:57 +01:00
parent 0189fb02c1
commit a42fdcb0a7
5 changed files with 113 additions and 4 deletions

View file

@ -20,6 +20,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
@ -100,6 +101,13 @@ public class BlockHullGlass extends BlockColored implements IBlockBase, IDamageR
return false;
}
@Nonnull
@SideOnly(Side.CLIENT)
@Override
public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.TRANSLUCENT; // .CUTOUT;
}
@SuppressWarnings("deprecation")
@SideOnly(Side.CLIENT)
@Override

View file

@ -16,7 +16,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class ItemBlockHull extends ItemBlockAbstractBase {
ItemBlockHull(Block block) {
ItemBlockHull(final Block block) {
super(block);
setMaxDamage(0);
setHasSubtypes(true);
@ -27,12 +27,17 @@ public class ItemBlockHull extends ItemBlockAbstractBase {
@Override
@SideOnly(Side.CLIENT)
public ModelResourceLocation getModelResourceLocation(ItemStack itemStack) {
int damage = itemStack.getItemDamage();
final int damage = itemStack.getItemDamage();
if (damage < 0 || damage > 15) {
throw new IllegalArgumentException(String.format("Invalid damage %d for %s", damage, itemStack.getItem()));
}
ResourceLocation resourceLocation = getRegistryName();
String variant = String.format("color=%s", EnumDyeColor.byDyeDamage( itemStack.getItemDamage() ).getUnlocalizedName());
final ResourceLocation resourceLocation = getRegistryName();
final String variant;
if (block instanceof BlockHullStairs) {
variant = "facing=east,half=bottom,shape=straight";
} else {
variant = String.format("color=%s", EnumDyeColor.byMetadata(itemStack.getItemDamage()).getName());
}
return new ModelResourceLocation(resourceLocation, variant);
}

View file

@ -0,0 +1,32 @@
{
"forge_marker": 1,
"defaults": {
"model": "minecraft:cube_all",
"textures": {
"all": "warpdrive:blocks/hull/plain-black"
},
"transform": "forge:default-block"
},
"variants": {
"normal": [{}],
"inventory": [{}],
"color": {
"black" : { "textures": { "all": "warpdrive:blocks/hull/tiled-black" } },
"blue" : { "textures": { "all": "warpdrive:blocks/hull/tiled-blue" } },
"brown" : { "textures": { "all": "warpdrive:blocks/hull/tiled-brown" } },
"cyan" : { "textures": { "all": "warpdrive:blocks/hull/tiled-cyan" } },
"gray" : { "textures": { "all": "warpdrive:blocks/hull/tiled-gray" } },
"green" : { "textures": { "all": "warpdrive:blocks/hull/tiled-green" } },
"light_blue": { "textures": { "all": "warpdrive:blocks/hull/tiled-light_blue" } },
"lime" : { "textures": { "all": "warpdrive:blocks/hull/tiled-lime" } },
"magenta" : { "textures": { "all": "warpdrive:blocks/hull/tiled-magenta" } },
"orange" : { "textures": { "all": "warpdrive:blocks/hull/tiled-orange" } },
"pink" : { "textures": { "all": "warpdrive:blocks/hull/tiled-pink" } },
"purple" : { "textures": { "all": "warpdrive:blocks/hull/tiled-purple" } },
"red" : { "textures": { "all": "warpdrive:blocks/hull/tiled-red" } },
"silver" : { "textures": { "all": "warpdrive:blocks/hull/tiled-silver" } },
"white" : { "textures": { "all": "warpdrive:blocks/hull/tiled-white" } },
"yellow" : { "textures": { "all": "warpdrive:blocks/hull/tiled-yellow" } }
}
}
}

View file

@ -0,0 +1,32 @@
{
"forge_marker": 1,
"defaults": {
"model": "minecraft:cube_all",
"textures": {
"all": "warpdrive:blocks/hull/plain-black"
},
"transform": "forge:default-block"
},
"variants": {
"normal": [{}],
"inventory": [{}],
"color": {
"black" : { "textures": { "all": "warpdrive:blocks/hull/tiled-black" } },
"blue" : { "textures": { "all": "warpdrive:blocks/hull/tiled-blue" } },
"brown" : { "textures": { "all": "warpdrive:blocks/hull/tiled-brown" } },
"cyan" : { "textures": { "all": "warpdrive:blocks/hull/tiled-cyan" } },
"gray" : { "textures": { "all": "warpdrive:blocks/hull/tiled-gray" } },
"green" : { "textures": { "all": "warpdrive:blocks/hull/tiled-green" } },
"light_blue": { "textures": { "all": "warpdrive:blocks/hull/tiled-light_blue" } },
"lime" : { "textures": { "all": "warpdrive:blocks/hull/tiled-lime" } },
"magenta" : { "textures": { "all": "warpdrive:blocks/hull/tiled-magenta" } },
"orange" : { "textures": { "all": "warpdrive:blocks/hull/tiled-orange" } },
"pink" : { "textures": { "all": "warpdrive:blocks/hull/tiled-pink" } },
"purple" : { "textures": { "all": "warpdrive:blocks/hull/tiled-purple" } },
"red" : { "textures": { "all": "warpdrive:blocks/hull/tiled-red" } },
"silver" : { "textures": { "all": "warpdrive:blocks/hull/tiled-silver" } },
"white" : { "textures": { "all": "warpdrive:blocks/hull/tiled-white" } },
"yellow" : { "textures": { "all": "warpdrive:blocks/hull/tiled-yellow" } }
}
}
}

View file

@ -0,0 +1,32 @@
{
"forge_marker": 1,
"defaults": {
"model": "minecraft:cube_all",
"textures": {
"all": "warpdrive:blocks/hull/plain-black"
},
"transform": "forge:default-block"
},
"variants": {
"normal": [{}],
"inventory": [{}],
"color": {
"black" : { "textures": { "all": "warpdrive:blocks/hull/tiled-black" } },
"blue" : { "textures": { "all": "warpdrive:blocks/hull/tiled-blue" } },
"brown" : { "textures": { "all": "warpdrive:blocks/hull/tiled-brown" } },
"cyan" : { "textures": { "all": "warpdrive:blocks/hull/tiled-cyan" } },
"gray" : { "textures": { "all": "warpdrive:blocks/hull/tiled-gray" } },
"green" : { "textures": { "all": "warpdrive:blocks/hull/tiled-green" } },
"light_blue": { "textures": { "all": "warpdrive:blocks/hull/tiled-light_blue" } },
"lime" : { "textures": { "all": "warpdrive:blocks/hull/tiled-lime" } },
"magenta" : { "textures": { "all": "warpdrive:blocks/hull/tiled-magenta" } },
"orange" : { "textures": { "all": "warpdrive:blocks/hull/tiled-orange" } },
"pink" : { "textures": { "all": "warpdrive:blocks/hull/tiled-pink" } },
"purple" : { "textures": { "all": "warpdrive:blocks/hull/tiled-purple" } },
"red" : { "textures": { "all": "warpdrive:blocks/hull/tiled-red" } },
"silver" : { "textures": { "all": "warpdrive:blocks/hull/tiled-silver" } },
"white" : { "textures": { "all": "warpdrive:blocks/hull/tiled-white" } },
"yellow" : { "textures": { "all": "warpdrive:blocks/hull/tiled-yellow" } }
}
}
}