Jump to content

Pugz

Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by Pugz

  1. What i meant was, making the scrolls able to be combined with gear like enchanted books are. They are gonna be used to give stronger enchants than books would.
  2. Ive made custom enchanted scrolls that will be used in an anvil to make gear stronger, but i have no idea how to make them work in an anvil! Its not the same as regular recipes, im guessing theres some complicated stuff you gotta do. Any help? Maybe some githubs i can look at or tutorials?
  3. Thank you for all those tips imma try them out
  4. I need that second class because the block it changes into has different properties. (you can walk through it)
  5. Yeah I know that but I don't know how I would detect the redstone power turning off.
  6. Hello, I have made a block that, when powered, will replace itself w/ another block that you can then walk through. The only issue is that if i un-power the block, it doesn't revert back to the normal one. Here is both of the blocks code and the ModItems class: BlockSoulGlass: package com.pugz.minerealms.blocks; import com.pugz.minerealms.Main; import com.pugz.minerealms.init.ModBlocks; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import javax.annotation.Nullable; import java.util.Random; public class BlockSoulGlass extends Block { protected String name; private final boolean isOn; public BlockSoulGlass(boolean isOn, Material material, String name, SoundType soundtype) { super(material); this.name = name; this.isOn = isOn; setUnlocalizedName(name); setRegistryName(name); setSoundType(soundtype); setHardness(0.3F); setLightOpacity(3); setCreativeTab(CreativeTabs.DECORATIONS); } public void registerItemModel(ItemBlock itemBlock) { Main.proxy.registerItemRenderer(itemBlock, 0, name); } public Item createItemBlock() { return new ItemBlock(this).setRegistryName(getRegistryName()); } @Override public BlockSoulGlass setCreativeTab(CreativeTabs tab) { super.setCreativeTab(tab); return this; } @SideOnly(Side.CLIENT) public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.TRANSLUCENT; } public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { entityIn.motionX *= 0.4D; entityIn.motionZ *= 0.4D; } public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { if (!worldIn.isRemote) { if (this.isOn && !worldIn.isBlockPowered(pos)) { worldIn.setBlockState(pos, ModBlocks.soulGlassOn.getDefaultState(), 2); } else if (!this.isOn && worldIn.isBlockPowered(pos)) { worldIn.setBlockState(pos, ModBlocks.soulGlassOn.getDefaultState(), 2); } } } public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) { if (!worldIn.isRemote) { if (this.isOn && !worldIn.isBlockPowered(pos)) { worldIn.scheduleUpdate(pos, ModBlocks.soulGlass, 4); } else if (!this.isOn && worldIn.isBlockPowered(pos)) { worldIn.setBlockState(pos, ModBlocks.soulGlassOn.getDefaultState(), 2); } } } public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { if (!worldIn.isRemote) { if (this.isOn && !worldIn.isBlockPowered(pos)) { worldIn.setBlockState(pos, ModBlocks.soulGlass.getDefaultState(), 2); } } } protected ItemStack getSilkTouchDrop(IBlockState state) { return new ItemStack(ModBlocks.soulGlass); } } ModBlocks: package com.pugz.minerealms.init; import com.pugz.minerealms.blocks.BlockSoulGlass; import com.pugz.minerealms.blocks.BlockSoulGlassOn; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraftforge.registries.IForgeRegistry; public class ModBlocks { public static BlockSoulGlass soulGlass = new BlockSoulGlass(false, Material.GLASS,"soul_glass", SoundType.GLASS).setCreativeTab(CreativeTabs.DECORATIONS); public static BlockSoulGlassOn soulGlassOn = new BlockSoulGlassOn(Material.GLASS,"soul_glass_on", SoundType.GLASS); public static void register(IForgeRegistry<Block> registry) { registry.registerAll( soulGlass, soulGlassOn ); } public static void registerItemBlocks(IForgeRegistry<Item> registry) { registry.registerAll( soulGlass.createItemBlock(), soulGlassOn.createItemBlock() ); } public static void registerModels() { } } BlockSoulGlassOn (Powered): package com.pugz.minerealms.blocks; import com.pugz.minerealms.Main; import com.pugz.minerealms.init.ModBlocks; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import javax.annotation.Nullable; import java.util.Random; public class BlockSoulGlassOn extends Block { protected String name; public BlockSoulGlassOn(Material material, String name, SoundType soundtype) { super(material); this.name = name; setUnlocalizedName(name); setRegistryName(name); setSoundType(soundtype); setHardness(0.3F); setLightOpacity(3); } public void registerItemModel(ItemBlock itemBlock) { Main.proxy.registerItemRenderer(itemBlock, 0, name); } public Item createItemBlock() { return new ItemBlock(this).setRegistryName(getRegistryName()); } @Override public BlockSoulGlassOn setCreativeTab(CreativeTabs tab) { super.setCreativeTab(tab); return this; } @SideOnly(Side.CLIENT) public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.TRANSLUCENT; } @Nullable public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) { return NULL_AABB; } public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { entityIn.motionX *= 0.4D; entityIn.motionY *= 0.2D; entityIn.motionZ *= 0.4D; } protected ItemStack getSilkTouchDrop(IBlockState state) { return new ItemStack(ModBlocks.soulGlass); } } Thanks!
  7. Im gonna send my blocks code in the afternoon so you can correct it. Hopefully
  8. Ive just started making a mod, and I wanted to add a block that when it is activated, you can walk through it, otherwise its solid (you cant walk throigh it). I've tried using isCollidable() but i dont know how to use that, so Ive settled for making two blocks, one that is collidable and one that isnt. The idea is that when the block is activated, it replaces itself with the collidable block, but I have no idea how to do that. Any help?
×
×
  • Create New...

Important Information

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