Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Slab Name Issue [SOLVED]


Killjoy0593
 Share

Recommended Posts

I've Been trying to fix this a while now and nothing works, Can somebody please tell me what im doing wrong as to why the name wont show?

 

Main Class

package Adobe;

import net.minecraft.block.Block;
import net.minecraft.block.BlockHalfSlab;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSlab;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod(modid="AdobeInfo.ID", name="AdobeInfo.NAME", version="AdobeInfo.VERS")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)
public class AdobeBlock {

public final static Block AdobeClayBlock = new AdobeClayBlock(500, Material.rock).setHardness(2.0F).setResistance(10.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("AdobeBlock").setCreativeTab(CreativeTabs.tabBlock).setTextureName(AdobeInfo.NAME.toLowerCase() + ":adobe_block");
public final static Block AdobeHalfSlab = new AdobeHalfSlab(501, false, Material.rock).setHardness(2.0F).setResistance(10.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("AdobeHalfSlab").setCreativeTab(CreativeTabs.tabBlock).setTextureName(AdobeInfo.NAME.toLowerCase() + ":adobe_block");
public final static Block AdobeHalfSlabDouble = new AdobeHalfSlab(502, true, Material.rock).setHardness(2.0F).setResistance(10.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("AdobeHalfSlabDouble").setCreativeTab(CreativeTabs.tabBlock).setTextureName(AdobeInfo.NAME.toLowerCase() + ":adobe_block");
public final static Block AdobeStair = new AdobeStair(503, AdobeBlock.AdobeClayBlock, 0).setUnlocalizedName("AdobeStair");
public final static Item AdobeBrick = new AdobeBrick(504).setTextureName(AdobeInfo.NAME.toLowerCase() + ":adobe_brick");
public final static Item AdobeMixture = new AdobeMixture(505).setTextureName(AdobeInfo.NAME.toLowerCase() + ":adobe_mixture");

// The instance of your mod that Forge uses.
     @Instance("AdobeBlock")
     public static AdobeBlock instance;
    
     // Says where the client and server 'proxy' code is loaded.
     @SidedProxy(clientSide="Adobe.client.ClientProxy", serverSide="Adobe.CommonProxy")
     public static CommonProxy proxy;
    
     @EventHandler
     public void preInit(FMLPreInitializationEvent event) {
             // Stub Method
     }
    
     @EventHandler
     public void load(FMLInitializationEvent event) {
             proxy.registerRenderers();
            
             GameRegistry.registerItem(AdobeBrick, "AdobeBrick");
             LanguageRegistry.addName(AdobeBrick, "Adobe Brick");
            
             GameRegistry.registerItem(AdobeMixture, "AdobeMixture");
             LanguageRegistry.addName(AdobeMixture, "Adobe Mixture");
            
             GameRegistry.registerBlock(AdobeClayBlock, "AdobeClayBlock");
             LanguageRegistry.addName(AdobeClayBlock, "Adobe Brick");
             MinecraftForge.setBlockHarvestLevel(AdobeClayBlock, "pickaxe", 0);
            
             GameRegistry.registerBlock(AdobeHalfSlab, "AdobeHalfSlab");
             LanguageRegistry.addName(AdobeHalfSlab, "Adobe Brick Half Slab");
             MinecraftForge.setBlockHarvestLevel(AdobeHalfSlab, "pickaxe", 0);
            
             GameRegistry.registerBlock(AdobeHalfSlabDouble, "AdobeHalfSlabDouble");
             LanguageRegistry.addName(AdobeHalfSlabDouble, "Adobe Brick Double Slab");
             MinecraftForge.setBlockHarvestLevel(AdobeHalfSlabDouble, "pickaxe", 0);
            
             ItemStack DirtStack = new ItemStack(Block.dirt);
             ItemStack SandStack = new ItemStack(Block.sand);
             ItemStack WaterBucket = new ItemStack(Item.bucketWater);
             ItemStack AdobeMixtureSingle = new ItemStack(AdobeBlock.AdobeMixture);
             ItemStack AdobeMixtureStack = new ItemStack(AdobeBlock.AdobeMixture, 32);
             ItemStack AdobeBrick = new ItemStack(AdobeBlock.AdobeBrick);
             ItemStack AdobeClayBlock = new ItemStack(AdobeBlock.AdobeClayBlock);
             ItemStack AdobeHalfSlab = new ItemStack(AdobeBlock.AdobeHalfSlab);
            
             GameRegistry.addRecipe(AdobeMixtureStack, "yxx", "yzx", "yyx", 'x', DirtStack, 'y', SandStack, 'z', WaterBucket);
             GameRegistry.addRecipe(AdobeMixtureStack, "xxx", "yzx", "yyy", 'x', DirtStack, 'y', SandStack, 'z', WaterBucket);
             GameRegistry.addRecipe(AdobeMixtureStack, "xxx", "xzy", "yyy", 'x', DirtStack, 'y', SandStack, 'z', WaterBucket);
             GameRegistry.addRecipe(AdobeMixtureStack, "xxy", "xzy", "xyy", 'x', DirtStack, 'y', SandStack, 'z', WaterBucket);
             GameRegistry.addRecipe(AdobeMixtureStack, "xyy", "xzy", "xxy", 'x', DirtStack, 'y', SandStack, 'z', WaterBucket);
             GameRegistry.addRecipe(AdobeMixtureStack, "yyy", "xzy", "xxx", 'x', DirtStack, 'y', SandStack, 'z', WaterBucket);
             GameRegistry.addRecipe(AdobeMixtureStack, "yyy", "yzx", "xxx", 'x', DirtStack, 'y', SandStack, 'z', WaterBucket);
             GameRegistry.addRecipe(AdobeMixtureStack, "yyx", "yzx", "yxx", 'x', DirtStack, 'y', SandStack, 'z', WaterBucket);
            
             //Stairs
             ItemStack AdobeStairStack = new ItemStack(AdobeBlock.AdobeStair, 4);
            
             GameRegistry.registerBlock(AdobeStair, "AdobeStair");
             LanguageRegistry.addName(AdobeStair, "Adobe Brick Stairs");
             MinecraftForge.setBlockHarvestLevel(AdobeStair, "pickaxe", 0);
            
             GameRegistry.addRecipe(AdobeStairStack, " x", " xx", "xxx", 'x', AdobeClayBlock);
                            
             GameRegistry.addSmelting(AdobeBlock.AdobeMixture.itemID, AdobeBrick, 0.3F);
             GameRegistry.addRecipe(AdobeClayBlock, "xx", "xx", 'x', AdobeBrick);
            
            
            
     }
    
     @EventHandler
     public void postInit(FMLPostInitializationEvent event) {
         Item.itemsList[AdobeBlock.AdobeHalfSlab.blockID] = new ItemSlab(AdobeBlock.AdobeHalfSlab.blockID - 256, (BlockHalfSlab)AdobeBlock.AdobeHalfSlab, (BlockHalfSlab)AdobeBlock.AdobeHalfSlabDouble, false).setUnlocalizedName("AdobeHalfSlab");
         LanguageRegistry.instance().addStringLocalization(((Adobe.AdobeHalfSlab)AdobeBlock.AdobeHalfSlab).getFullSlabName(0)+".name", "AdobeHalfSlab");
     }
    
}

 

Slab Class

package Adobe;
import net.minecraft.block.BlockHalfSlab;
import net.minecraft.block.material.Material;
public class AdobeHalfSlab extends BlockHalfSlab {
public AdobeHalfSlab(int par1, boolean par2, Material par3Material) {
super(par1, par2, par3Material);
this.useNeighborBrightness[blockID] = true;
}
@Override
public String getFullSlabName(int i) {
return null;
}
}

 

Result

1051ro7.png

Link to comment
Share on other sites

take

public final static Block AdobeHalfSlab = new AdobeHalfSlab(501, false, Material.rock).setHardness(2.0F).setResistance(10.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("AdobeHalfSlab").setCreativeTab(CreativeTabs.tabBlock).setTextureName(AdobeInfo.NAME.toLowerCase() + ":adobe_block");

and change the texture name to something like (AdobeInfo.Test.toLowerCase() + ":adobe_block") and see what the name says, my guess is that the name showing is coming from that section for some reason.

Link to comment
Share on other sites

Actually I just found your problem. In your postInit, you do this:

LanguageRegistry.instance().addStringLocalization(((Adobe.AdobeHalfSlab)AdobeBlock.AdobeHalfSlab).getFullSlabName(0)+".name", "AdobeHalfSlab");

notice you do getSlabFullName, when you have that method overridden to return null. Try removing this line and see what happens.

Link to comment
Share on other sites

Thanks, This Was The Full Code When I Fixed All Issues. The Name And Not Getting The Slab When Middle Clicking.

 

package Adobe;

import net.minecraft.block.Block;
import net.minecraft.block.BlockHalfSlab;
import net.minecraft.block.material.Material;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class AdobeHalfSlab extends BlockHalfSlab {

public AdobeHalfSlab(int par1, boolean par2, Material par3Material) {
	super(par1, par2, par3Material);
	this.useNeighborBrightness[blockID] = true;
}

@Override
public String getFullSlabName(int i) {
	return (AdobeInfo.NAME.toLowerCase() + ":adobe_block");

}
@SideOnly(Side.CLIENT)
private static boolean isBlockSingleSlab(int par0)
    {
        return par0 == AdobeBlock.AdobeHalfSlab.blockID;
    }

    /**
     * Returns the slab block name with step type.
     */
    public int getDamageValue(World par1World, int par2, int par3, int par4)
    {
        return super.getDamageValue(par1World, par2, par3, par4) & 7;
    }
public int idPicked(World par1World, int par2, int par3, int par4)
    {
        return isBlockSingleSlab(this.blockID) ? this.blockID : (this.blockID == AdobeBlock.AdobeHalfSlabDouble.blockID ? AdobeBlock.AdobeHalfSlab.blockID : (this.blockID == Block.woodDoubleSlab.blockID ? Block.woodSingleSlab.blockID : Block.stoneSingleSlab.blockID));
    }

}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • i found it guys
    • So i just bought a RLcraft server for me and my friends to play on. I launched it and it is working fine but it tells me that i need to download all the mods i go to mods and press "minecraft forge" and nothing shows up that i can open files. If anyone have a suggestion i would need the help. This is the server hosting i  used 
    • i did it in 1.12.2 not walking for me can anyone help me get it pls???  
    • Got the rotation working. I had to look at LivingEntityRenderer#render and setupRotations a little more closely, and I realized that I needed to change the custom entity's yBodyRot and yBodyRotO.  private static boolean renderingCustomEntity = false; private static CustomEntity customEntity; private static void refreshCustomEntity(LocalPlayer localPlayer, LivingEntity livingEntity) { if (customEntity == null || customEntity.isRemoved()) { customEntity = ModEntities.CUSTOM_ENTITY.get().create(localPlayer.clientLevel); } if (!customEntity.level.dimension().equals(livingEntity.level.dimension())) { customEntity.discard(); } } @SubscribeEvent public static void replaceMobModel(RenderLivingEvent.Pre<LivingEntity, EntityModel<LivingEntity>> event) { LocalPlayer localPlayer = Minecraft.getInstance().player; if (localPlayer != null && event.getEntity() instanceof Mob mob) { if (/* put your own condition here */) { if (!renderingCustomEntity) { try { renderingCustomEntity = true; event.setCanceled(true); refreshCustomEntity(localPlayer, mob); // (truth be told, my custom entity does not have a "head", so these lines aren't needed) // customEntity.setYHeadRot(mob.getYHeadRot()); // customEntity.yHeadRotO = mob.yHeadRotO; customEntity.setYBodyRot(mob.yBodyRot); customEntity.yBodyRotO = mob.yBodyRotO; customEntity.setPose(mob.getPose()); Minecraft.getInstance().getEntityRenderDispatcher().getRenderer(customEntity).render( customEntity, customEntity.yBodyRot, event.getPartialTick(), event.getPoseStack(), event.getMultiBufferSource(), event.getPackedLight() ); } finally { renderingCustomEntity = false; } } } } }   As shown in my code, if the mob whose model is replaced moves to a different dimension, I unload the custom entity with Entity#discard and then reinitialize it on the next tick. I wonder if I also have to unload the custom entity when the mob it is "replacing" dies.
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.