Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hi i'm have a problem with making custom Redstone Lamps. When i place the Lamp it shows the Active Lamp and not the inactive one and when i put a Lever on the block it disappears

 

Code for Lamp

 

package com.TMP.block;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

import java.util.Random;

import com.TMP.creativetabs.TMPCreativeTabs;
import com.TMP.lib.Strings;



import net.minecraft.block.Block;
import net.minecraft.block.BlockRedstoneLight;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

public class RedRSlamp extends BlockRedstoneLight
{
    /** Whether this lamp block is the powered version. */
    private final boolean field_150171_a;

    public RedRSlamp(boolean p_i45421_1_)
    {
        super(p_i45421_1_);
        this.field_150171_a = p_i45421_1_;
	setCreativeTab(TMPCreativeTabs.TMPBlocks);
	setBlockName("RedLamp");

        if (p_i45421_1_)
        {
            this.setLightLevel(1.0F);
        }
    }
   
public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_)
    {
        if (!p_149726_1_.isRemote)
        {
            if (this.field_150171_a && !p_149726_1_.isBlockIndirectlyGettingPowered(p_149726_2_, p_149726_3_, p_149726_4_))
            {
                p_149726_1_.scheduleBlockUpdate(p_149726_2_, p_149726_3_, p_149726_4_, this, 4);
            }
            else if (!this.field_150171_a && p_149726_1_.isBlockIndirectlyGettingPowered(p_149726_2_, p_149726_3_, p_149726_4_))
            {
                p_149726_1_.setBlock(p_149726_2_, p_149726_3_, p_149726_4_, TMPBlocks.redrsActive, 0, 2);
            }
        }
    }

public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_)
    {
        if (!p_149695_1_.isRemote)
        {
            if (this.field_150171_a && !p_149695_1_.isBlockIndirectlyGettingPowered(p_149695_2_, p_149695_3_, p_149695_4_))
            {
                p_149695_1_.scheduleBlockUpdate(p_149695_2_, p_149695_3_, p_149695_4_, this, 4);
            }
            else if (!this.field_150171_a && p_149695_1_.isBlockIndirectlyGettingPowered(p_149695_2_, p_149695_3_, p_149695_4_))
            {
                p_149695_1_.setBlock(p_149695_2_, p_149695_3_, p_149695_4_, TMPBlocks.redrsActive, 0, 2);
            }
        }
    }

public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_)
    {
        if (!p_149674_1_.isRemote && this.field_150171_a && !p_149674_1_.isBlockIndirectlyGettingPowered(p_149674_2_, p_149674_3_, p_149674_4_))
        {
            p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, TMPBlocks.redrsIdle, 0, 2);
        }
    }

}

 

Code for Blocks Class

 

package com.TMP.block;

import com.TMP.creativetabs.TMPCreativeTabs;
import com.TMP.lib.Strings;

import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRedstoneLight;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;

public class TMPBlocks {

public static void mainRegistry(){
	initialiseBlock();
	registerBlock();

}

public static Block gitaniumOre;

public static Block redrsIdle;
public static Block redrsActive;


public static void initialiseBlock(){

	redrsActive = new RedRSlamp(true).setBlockTextureName(Strings.MODID + ":RedRSActive");
	redrsIdle = new RedRSlamp(false).setBlockTextureName(Strings.MODID + ":RedRSIdle");


}

public static void registerBlock(){

	GameRegistry.registerBlock(redrsIdle, redrsIdle.getUnlocalizedName());
	GameRegistry.registerBlock(redrsActive, redrsActive.getUnlocalizedName());


}
}

 

Edit: Just found out it not just when i put a lever on it. It disappears if i just right click it with anything even empty hand

  • Author

If i remove the this.field_150171_a = p_i45421_1_;

 

from the code it lets me place the block and place levers and right click it but the lever does not turn the lamp on or off and still when i place the lamp the places it as the Active Lamp and not the Idle Lamp???

  • Author

Can anyone help with this please. been looking all over the web. and messing with the code but no luck :S

  • Author

Bump +

 

Is custom red-stone lamps even working on 1.7.2? since i tried a few different things and don't work no matter what i do. i got it 100% working in 1.6 but i lost the code due to HDD dyeing

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.