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

[1.8] Substitution Alias Not Working


HassanS6000
 Share

Recommended Posts

Hi!

 

Basically, I want to replace snow and ice so they do not melt, and use the substitution alias system to avoid using ASM.

 

I have replaced the ItemBlock and Block here: https://gist.github.com/hsyyid/ae6e14b6128f5aee27d8 but to no avail.

 

Instead of replacing the snow and the ice, it appears that the ItemBlock does nothing when right clicked, and the snow and ice items DO NOT have textures anymore.

 

Any and all help would be greatly appreciated!  :D

Link to comment
Share on other sites

Okay. Well anyway you have to resort to standard debugging. Are you sure the method is being called? Use a console statement to confirm it.

 

After that, in the pre-init I think your registry of your blocks and items is wrong -- I don't think you can (or at least I think it is a bad idea) to set the unlocalized name to "minecraft:snow". The "minecraft:" is for vanilla items and it should really have your mod id.

 

After that, are you sure that the instances you are passing have in fact already been constructed (not null). Again use console statement to confirm it.

 

That's the only things I can think of, otherwise it looks pretty simple.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

  • 2 weeks later...

I just re-implemented, or at least attempted to, a block substitution into my mod.

 

The substitution alias does appear to be currently broken.

 

You can't place the block because ItemBlock.placeBlockAt eventually gets to ExtendedBlockStorage.get(int x, int y, int z) and it always returns air. It does that because Block.BLOCK_STATE_IDS.getByValue(#) always returns null.

 

Up until that point it appears to be working.

 

 

Here is a quick test mod if anyone wants to look into it.

With the exception of function names and imports changing, this is the same code works in 1.7

 

package net.minecraftforge.debug;

import net.minecraft.block.Block;
import net.minecraft.block.BlockTallGrass;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemColored;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.ExistingSubstitutionException;
import net.minecraftforge.fml.common.registry.GameRegistry;

@Mod(modid = "substitutionaliastest")
public class SubstitutionAliasTest
{
    private Block testBlock;

    @Mod.EventHandler
    public void onPreInit(FMLPreInitializationEvent event)
    {
        this.testBlock = new TestBlock();
        ItemBlock testItemBlock = (new ItemColored(this.testBlock, true)).setSubtypeNames(new String[] { "shrub", "grass", "fern" });

        try {
            GameRegistry.addSubstitutionAlias("minecraft:tallgrass", GameRegistry.Type.BLOCK, this.testBlock);
            GameRegistry.addSubstitutionAlias("minecraft:tallgrass", GameRegistry.Type.ITEM, testItemBlock);
        } catch (ExistingSubstitutionException e) {
            e.printStackTrace();
        }
    }

    public static class TestBlock extends BlockTallGrass
    {
        public TestBlock()
        {
            super();
            super.setUnlocalizedName("tallgrass");
            setHardness(0.0F);
            setStepSound(soundTypeGrass);
            setUnlocalizedName("tallgrass");
        }
    }
}

Link to comment
Share on other sites

it is working, cpws tested it fully. Not sure what the hell you're talking about when it comes to setting the block as you should be able to do that just fine.

BLOCK_STATE_IDS will return proper values for the current world respecting aliases.

 

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Patreon: http://www.patreon.com/lexmanos
Paypal: http://paypal.me/LexManos

BitCoin: 1Q8rWvUNMM2T1ZfDaFeeYQyVXtYoeT6tTn

Link to comment
Share on other sites

Well I've tried that test mod I posted again.

 

I've tried registering the alias in PreInit, Init, and PostInit.

Every time it the same result.

 

The block is replaced, the F3 screen shows

null

type: tall_grass

 

before replacement it shows:

minefraft:tallgrass

type: tall_grass

 

 

The original item in the creative menu has no texture and can not be placed due to failing Block.BLOCK_STATE_IDS.getByValue(#)

 

If you use pick block, you get an item with correct texture but placing it crashes the game.

java.lang.ArrayIndexOutOfBoundsException: -1

at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:151)

at net.minecraft.client.multiplayer.PlayerControllerMP.func_178890_a(PlayerControllerMP.java:442)

 

ItemStack.java:151 => playerIn.triggerAchievement(StatList.objectUseStats[item.getIdFromItem(this.item)]);

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

    • What on earth... Did you put all those entries there? This file should usually be empty. Are you using any antivirus software? If so: Which? Do you have any Minecraft-related software installed (third party launchers)? If so: Which?
    • I can't dm, so i'll attach it here  # Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # #      102.54.94.97     rhino.acme.com          # source server #       38.25.63.10     x.acme.com              # x client host # localhost name resolution is handled within DNS itself. #    127.0.0.1       localhost #    ::1             localhost 127.0.0.1    codeload.github.com 127.0.0.1    support.kaspersky.ru 127.0.0.1    kaspersky.ru 127.0.0.1    virusinfo.info 127.0.0.1    forum.kasperskyclub.ru 127.0.0.1    cyberforum.ru 127.0.0.1    soft-file.ru 127.0.0.1    www.360totalsecurity.com 127.0.0.1    cezurity.com 127.0.0.1    www.dropbox.com 127.0.0.1    193.228.54.23 127.0.0.1    spec-komp.com 127.0.0.1    eset.ua 127.0.0.1    panel.koronavirusfuck.xyz 127.0.0.1    360totalsecurity.com 127.0.0.1    www.esetnod32.ru 127.0.0.1    www.comss.ru 127.0.0.1    blog-pc.ru 127.0.0.1    www.securrity.ru 127.0.0.1    vellisa.ru 127.0.0.1    download-software.ru 127.0.0.1    drweb-cureit.ru 127.0.0.1    softpacket.ru 127.0.0.1    www.kaspersky.com 127.0.0.1    www.avast.ua 127.0.0.1    www.avast.ru 127.0.0.1    zillya.ua 127.0.0.1    safezone.ua 127.0.0.1    vms.drweb.ru 127.0.0.1    www.drweb.ua 127.0.0.1    free.drweb.ru 127.0.0.1    biblprog.org.ua 127.0.0.1    free-software.com.ua 127.0.0.1    free.dataprotection.com.ua 127.0.0.1    www.drweb.com 127.0.0.1    www.softportal.com 127.0.0.1    www.nashnet.ua 127.0.0.1    softlist.com.ua 127.0.0.1    it-doc.info 127.0.0.1    esetnod32.ru 127.0.0.1    blog-bridge.ru 127.0.0.1    remontka.pro 127.0.0.1    securos.org.ua 127.0.0.1    pc-helpp.com 127.0.0.1    softdroid.net 127.0.0.1    malwarebytes.com 127.0.0.1    ru.vessoft.com 127.0.0.1    AlpineFile.ru 127.0.0.1    malwarebytes-anti-malware.ru.uptodown.com 127.0.0.1    ProgramDownloadFree.com 127.0.0.1    download.cnet.com 127.0.0.1    soft.mydiv.net 127.0.0.1    spyware-ru.com 127.0.0.1    remontcompa.ru 127.0.0.1    www.hitmanpro.com 127.0.0.1    hitman-pro.ru.uptodown.com 127.0.0.1    www.bleepingcomputer.com 127.0.0.1    soft.oszone.net 127.0.0.1    krutor.org 127.0.0.1    RuTracker.org 127.0.0.1    www.greatis.com 127.0.0.1    unhackme.ru.uptodown.com 127.0.0.1    programy.com.ua 127.0.0.1    softobase.com 127.0.0.1    www.besplatnoprogrammy.ru 127.0.0.1    unhackme.en.softonic.com 127.0.0.1    unhackme.com 127.0.0.1    unhackme.ru 127.0.0.1    nnm-club.name 127.0.0.1    vgrom.com 127.0.0.1    moneropool.com 127.0.0.1    mine.moneropool.com 127.0.0.1    xmr.cryptopool.org 127.0.0.1    pool.monero.org 127.0.0.1    minexmr.com 127.0.0.1    monero.crypto-pool.fr 127.0.0.1    dwarfpool.com 127.0.0.1    disk-space.ru 127.0.0.1    file7.ru 127.0.0.1    ufille.ru 127.0.0.1    rgho.st 127.0.0.1    yadi.su 127.0.0.1    catcut.net 127.0.0.1    fsdisk.ru 127.0.0.1    rpfile.ru 127.0.0.1    cheats.file-a.ru 127.0.0.1    file-space.org 127.0.0.1    sfailo.ru 127.0.0.1    sendspace.com 127.0.0.1    www.sendspace.com 127.0.0.1    fille-7.ru 127.0.0.1    loufile.ru 127.0.0.1    file-seven.com 127.0.0.1    file-a.ru 127.0.0.1    fail-7.ru 127.0.0.1    1-kk.ru 127.0.0.1    rufile.net 127.0.0.1    filexpwx.space 127.0.0.1    sfile.net 127.0.0.1    mdiskfile.com 127.0.0.1    mega.nz 127.0.0.1    dfile.su 127.0.0.1    rgfail.ru 127.0.0.1    rudwnl.ru 127.0.0.1    dfile.info 127.0.0.1    flles.ru 127.0.0.1    pool.minexmr.to 127.0.0.1    ska4ay.pl 127.0.0.1    ska4ay.ru 127.0.0.1    ska4ay.club 127.0.0.1    ska4ay.net 127.0.0.1    ska4ay.org 127.0.0.1    ska4ay.com 127.0.0.1    ska4ay.pro 127.0.0.1    ska4ay.pw 127.0.0.1    ska4ay.online 127.0.0.1    skachaty.pl 127.0.0.1    skachaty.ru 127.0.0.1    skachaty.club 127.0.0.1    skachaty.net 127.0.0.1    skachaty.org 127.0.0.1    skachaty.com 127.0.0.1    skachaty.pro 127.0.0.1    skachaty.pw 127.0.0.1    skachaty.online 127.0.0.1    skachay.pl 127.0.0.1    skachay.ru 127.0.0.1    skachay.club 127.0.0.1    skachay.net 127.0.0.1    skachay.org 127.0.0.1    skachay.com 127.0.0.1    skachay.pro 127.0.0.1    skachay.pw 127.0.0.1    skachay.website 127.0.0.1    skachay.online 127.0.0.1    ska4aty.pl 127.0.0.1    ska4aty.ru 127.0.0.1    ska4aty.club 127.0.0.1    ska4aty.net 127.0.0.1    ska4aty.org 127.0.0.1    ska4aty.com 127.0.0.1    ska4aty.pro 127.0.0.1    ska4aty.pw 127.0.0.1    ska4aty.online 51.68.172.243 authserver.mojang.com 51.68.172.243 sessionserver.mojang.com 51.68.172.243 launchermeta.mojang.com    
    • You don't need to worry about this anymore, Forge has fixed this in the installer.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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