2
0
Fork 0

Tried adding a custom block model, did not work as planned

frozen
KeyLime17 1 year ago
parent ce1da97212
commit 70379aaedc

@ -1 +1 @@
�[�i5�ï¿ßþ
�[�i5�ï¿à

@ -100,6 +100,7 @@ public class CinderLoE {
// Blocks
public static Block barricade;
public static Block cinderBlock;
public static Block ivoryBlock;
public static Block blockRedDwarfSteel;
@ -348,6 +349,11 @@ public class CinderLoE {
}
public void registerBlocks() {
// barricade
barricade = (new barricade());
GameRegistry.registerBlock(barricade, "barricade");
// Cinder Block
cinderBlock = (new CinderBlock());
GameRegistry.registerBlock(cinderBlock, "cinderBlock");
@ -924,6 +930,7 @@ public class CinderLoE {
//== Blocks==
CinderCore.registerItemFallback(Block.getIdFromBlock(cinderBlock), Block.getIdFromBlock(Blocks.netherrack), "cinder_loe", "1.0");
CinderCore.registerItemFallback(Block.getIdFromBlock(barricade), Block.getIdFromBlock(Blocks.fence), "cinder_loe", "1.0");
CinderCore.registerItemFallback(Block.getIdFromBlock(ivoryBlock), Block.getIdFromBlock(LOTRMod.boneBlock), "cinder_loe", "1.0");
CinderCore.registerItemFallback(Block.getIdFromBlock(blockRedDwarfSteel), Block.getIdFromBlock(LOTRMod.blockOreStorage), "cinder_loe", "1.0");
CinderCore.registerItemFallback(Block.getIdFromBlock(chandelierRedDwarf), Block.getIdFromBlock(LOTRMod.chandelier), "cinder_loe", "1.0");

@ -0,0 +1,60 @@
package com.zivilon.cinder_loe.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import lotr.common.LOTRCreativeTabs;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFence;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.util.IIcon;
import java.lang.reflect.Field;
import static net.minecraft.init.Blocks.fence;
public class barricade extends Block {
@SideOnly(Side.CLIENT)
private IIcon field_149950_a;
@SideOnly(Side.CLIENT)
private IIcon field_149949_b;
public barricade() {
super(Material.wood); // Choose the appropriate material
try {
Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabBlock"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to
LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null);
setCreativeTab((CreativeTabs)tab);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
setHardness(5.0F);
setResistance(15.0F);
setStepSound(Block.soundTypeWood);
setBlockTextureName("lotr:red_dwarf_steel");
setBlockName("lotr:blockRedDwarfSteel");
}
public boolean renderAsNormalBlock()
{
return false;
}
public boolean isOpaqueCube()
{
return false;
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta)
{
return side == 0 ? this.field_149949_b : (side == 1 ? this.field_149950_a : this.blockIcon);
}
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg)
{
this.blockIcon = reg.registerIcon(this.getTextureName());
}
}

@ -0,0 +1,42 @@
package com.zivilon.cinder_loe.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
/**
* cavalry_spikes - Cleric_red
* Created using Tabula 4.1.1
*/
public class barricade_post extends ModelBase {
public ModelRenderer shape1;
public ModelRenderer shape1_1;
public barricade_post() {
this.textureWidth = 64;
this.textureHeight = 32;
this.shape1_1 = new ModelRenderer(this, 0, 0);
this.shape1_1.setRotationPoint(-3.0F, 9.0F, 4.0F);
this.shape1_1.addBox(1.0F, 0.0F, 2.0F, 4, 18, 4, 0.0F);
this.setRotateAngle(shape1_1, -0.6981317007977318F, 0.0F, 0.0F);
this.shape1 = new ModelRenderer(this, 0, 0);
this.shape1.setRotationPoint(-3.0F, 13.0F, -8.5F);
this.shape1.addBox(1.0F, 0.0F, 0.0F, 4, 18, 4, 0.0F);
this.setRotateAngle(shape1, 0.6981317007977318F, 0.0F, 0.0F);
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
this.shape1_1.render(f5);
this.shape1.render(f5);
}
/**
* This is a helper function from Tabula to set the rotation of model parts
*/
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}

@ -35,4 +35,5 @@ public class CinderBow extends LOTRItemBow {
return repairItem.getItem() == CinderLoE.ingotAsh || super.getIsRepairable(itemstack, repairItem);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Loading…
Cancel
Save