Jump to content

Slab Name Issue [SOLVED]


Killjoy0593

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
    • It is an issue with quark - update it to this build: https://www.curseforge.com/minecraft/mc-mods/quark/files/3642325
    • Remove Instant Massive Structures Mod from your server     Add new crash-reports with sites like https://paste.ee/  
    • Update your drivers: https://www.amd.com/en/support/graphics/amd-radeon-r9-series/amd-radeon-r9-200-series/amd-radeon-r9-280x
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.