JoppeGames1 Posted December 27, 2020 Posted December 27, 2020 how do I make a redstone lamp block I know the part with the two separate blocks but I don't know how to code the event of the redstone powering I use Intellij to code the mod. looked at mcreator code to see what they did for it but that code doesn't work in intellij what mcreator did: package net.mcreator.tvstudio.procedures; import net.minecraft.world.IWorld; import net.minecraft.util.math.BlockPos; import net.minecraft.state.IProperty; import net.minecraft.block.BlockState; import net.mcreator.tvstudio.block.YellowStudioLightOffBlock; import net.mcreator.tvstudio.block.YellowStudioLightBlock; import net.mcreator.tvstudio.block.WhiteStudioLightOffBlock; import net.mcreator.tvstudio.block.WhiteStudioLightBlock; import net.mcreator.tvstudio.block.StudioLightBlock; import net.mcreator.tvstudio.block.RedStudioLightOffBlock; import net.mcreator.tvstudio.block.RedStudioLightBlock; import net.mcreator.tvstudio.block.PurpleStudioLightOffBlock; import net.mcreator.tvstudio.block.PurpleStudioLightBlock; import net.mcreator.tvstudio.block.PinkStudioLightOffBlock; import net.mcreator.tvstudio.block.PinkStudioLightBlock; import net.mcreator.tvstudio.block.OrangeStudioLightOffBlock; import net.mcreator.tvstudio.block.OrangeStudioLightBlock; import net.mcreator.tvstudio.block.MagentaStudioLightOffBlock; import net.mcreator.tvstudio.block.MagentaStudioLightBlock; import net.mcreator.tvstudio.block.LimeStudioLightOffBlock; import net.mcreator.tvstudio.block.LimeCyanStudioLightBlock; import net.mcreator.tvstudio.block.LightGrayStudioLightOffBlock; import net.mcreator.tvstudio.block.LightGrayStudioLightBlock; import net.mcreator.tvstudio.block.LightBlueStudioLightOffBlock; import net.mcreator.tvstudio.block.LightBlueStudioLightBlock; import net.mcreator.tvstudio.block.GreenWhiteStudioLightBlock; import net.mcreator.tvstudio.block.GreenStudioLightOffBlock; import net.mcreator.tvstudio.block.GrayStudioLightOffBlock; import net.mcreator.tvstudio.block.GrayStudioLightBlock; import net.mcreator.tvstudio.block.CyanStudioLightOffBlock; import net.mcreator.tvstudio.block.CyanStudioLightBlock; import net.mcreator.tvstudio.block.BrownStudioLightOffBlock; import net.mcreator.tvstudio.block.BrownStudioLightBlock; import net.mcreator.tvstudio.block.BlueStudioLightOffBlock; import net.mcreator.tvstudio.block.BlueStudioLightBlock; import net.mcreator.tvstudio.block.BlackStudioLightOffBlock; import net.mcreator.tvstudio.TvstudioModElements; import java.util.Map; @TvstudioModElements.ModElement.Tag public class StudioLightsRedstoneProcedure extends TvstudioModElements.ModElement { public StudioLightsRedstoneProcedure(TvstudioModElements instance) { super(instance, 187); }.d= public static void executeProcedure(Map<String, Object> dependencies) { if (dependencies.get("x") == null) { if (!dependencies.containsKey("x")) System.err.println("Failed to load dependency x for procedure StudioLightsRedstone!"); return; } if (dependencies.get("y") == null) { if (!dependencies.containsKey("y")) System.err.println("Failed to load dependency y for procedure StudioLightsRedstone!"); return; } if (dependencies.get("z") == null) { if (!dependencies.containsKey("z")) System.err.println("Failed to load dependency z for procedure StudioLightsRedstone!"); return; } if (dependencies.get("world") == null) { if (!dependencies.containsKey("world")) System.err.println("Failed to load dependency world for procedure StudioLightsRedstone!"); return; } double x = dependencies.get("x") instanceof Integer ? (int) dependencies.get("x") : (double) dependencies.get("x"); double y = dependencies.get("y") instanceof Integer ? (int) dependencies.get("y") : (double) dependencies.get("y"); double z = dependencies.get("z") instanceof Integer ? (int) dependencies.get("z") : (double) dependencies.get("z"); IWorld world = (IWorld) dependencies.get("world"); if (((world.getBlockState(new BlockPos((int) x, (int) y, (int) z))).getBlock() == MagentaStudioLightBlock.block.getDefaultState() .getBlock())) { { BlockPos _bp = new BlockPos((int) x, (int) y, (int) z); BlockState _bs = MagentaStudioLightOffBlock.block.getDefaultState(); BlockState _bso = world.getBlockState(_bp); for (Map.Entry<IProperty<?>, Comparable<?>> entry : _bso.getValues().entrySet()) { IProperty _property = _bs.getBlock().getStateContainer().getProperty(entry.getKey().getName()); if (_bs.has(_property)) _bs = _bs.with(_property, (Comparable) entry.getValue()); } world.setBlockState(_bp, _bs, 3); } } else { if (((world.getBlockState(new BlockPos((int) x, (int) y, (int) z))).getBlock() == BlueStudioLightBlock.block.getDefaultState() .getBlock())) { { BlockPos _bp = new BlockPos((int) x, (int) y, (int) z); BlockState _bs = BlueStudioLightOffBlock.block.getDefaultState(); BlockState _bso = world.getBlockState(_bp); for (Map.Entry<IProperty<?>, Comparable<?>> entry : _bso.getValues().entrySet()) { IProperty _property = _bs.getBlock().getStateContainer().getProperty(entry.getKey().getName()); if (_bs.has(_property)) _bs = _bs.with(_property, (Comparable) entry.getValue()); } world.setBlockState(_bp, _bs, 3); } } else { if (((world.getBlockState(new BlockPos((int) x, (int) y, (int) z))).getBlock() == CyanStudioLightBlock.block.getDefaultState() .getBlock())) { { BlockPos _bp = new BlockPos((int) x, (int) y, (int) z); BlockState _bs = CyanStudioLightOffBlock.block.getDefaultState(); BlockState _bso = world.getBlockState(_bp); for (Map.Entry<IProperty<?>, Comparable<?>> entry : _bso.getValues().entrySet()) { IProperty _property = _bs.getBlock().getStateContainer().getProperty(entry.getKey().getName()); if (_bs.has(_property)) _bs = _bs.with(_property, (Comparable) entry.getValue()); } world.setBlockState(_bp, _bs, 3); } } else { if (((world.getBlockState(new BlockPos((int) x, (int) y, (int) z))).getBlock() == LimeCyanStudioLightBlock.block.getDefaultState() .getBlock())) { { BlockPos _bp = new BlockPos((int) x, (int) y, (int) z); BlockState _bs = LimeStudioLightOffBlock.block.getDefaultState(); BlockState _bso = world.getBlockState(_bp); for (Map.Entry<IProperty<?>, Comparable<?>> entry : _bso.getValues().entrySet()) { IProperty _property = _bs.getBlock().getStateContainer().getProperty(entry.getKey().getName()); if (_bs.has(_property)) _bs = _bs.with(_property, (Comparable) entry.getValue()); } world.setBlockState(_bp, _bs, 3); } } else { if (((world.getBlockState(new BlockPos((int) x, (int) y, (int) z))).getBlock() == BrownStudioLightBlock.block .getDefaultState().getBlock())) { { BlockPos _bp = new BlockPos((int) x, (int) y, (int) z); BlockState _bs = BrownStudioLightOffBlock.block.getDefaultState(); BlockState _bso = world.getBlockState(_bp); for (Map.Entry<IProperty<?>, Comparable<?>> entry : _bso.getValues().entrySet()) { IProperty _property = _bs.getBlock().getStateContainer().getProperty(entry.getKey().getName()); if (_bs.has(_property)) _bs = _bs.with(_property, (Comparable) entry.getValue()); } world.setBlockState(_bp, _bs, 3); } } else { if (((world.getBlockState(new BlockPos((int) x, (int) y, (int) z))).getBlock() == GrayStudioLightBlock.block .getDefaultState().getBlock())) { { BlockPos _bp = new BlockPos((int) x, (int) y, (int) z); BlockState _bs = GrayStudioLightOffBlock.block.getDefaultState(); BlockState _bso = world.getBlockState(_bp); for (Map.Entry<IProperty<?>, Comparable<?>> entry : _bso.getValues().entrySet()) { IProperty _property = _bs.getBlock().getStateContainer().getProperty(entry.getKey().getName()); if (_bs.has(_property)) _bs = _bs.with(_property, (Comparable) entry.getValue()); } world.setBlockState(_bp, _bs, 3); } } else { if (((world.getBlockState(new BlockPos((int) x, (int) y, (int) z))).getBlock() == WhiteStudioLightBlock.block .getDefaultState().getBlock())) { { BlockPos _bp = new BlockPos((int) x, (int) y, (int) z); BlockState _bs = WhiteStudioLightOffBlock.block.getDefaultState(); BlockState _bso = world.getBlockState(_bp); for (Map.Entry<IProperty<?>, Comparable<?>> entry : _bso.getValues().entrySet()) { IProperty _property = _bs.getBlock().getStateContainer().getProperty(entry.getKey().getName()); if (_bs.has(_property)) _bs = _bs.with(_property, (Comparable) entry.getValue()); } world.setBlockState(_bp, _bs, 3); } } else { if (((world.getBlockState(new BlockPos((int) x, (int) y, (int) z))).getBlock() == GreenWhiteStudioLightBlock.block .getDefaultState().getBlock())) { { BlockPos _bp = new BlockPos((int) x, (int) y, (int) z); BlockState _bs = GreenStudioLightOffBlock.block.getDefaultState(); BlockState _bso = world.getBlockState(_bp); for (Map.Entry<IProperty<?>, Comparable<?>> entry : _bso.getValues().entrySet()) { IProperty _property = _bs.getBlock().getStateContainer().getProperty(entry.getKey().getName()); if (_bs.has(_property)) _bs = _bs.with(_property, (Comparable) entry.getValue()); } world.setBlockState(_bp, _bs, 3); } } else { if (((world.getBlockState(new BlockPos((int) x, (int) y, (int) z))).getBlock() == PurpleStudioLightBlock.block .getDefaultState().getBlock())) { { BlockPos _bp = new BlockPos((int) x, (int) y, (int) z); BlockState _bs = PurpleStudioLightOffBlock.block.getDefaultState(); BlockState _bso = world.getBlockState(_bp); for (Map.Entry<IProperty<?>, Comparable<?>> entry : _bso.getValues().entrySet()) { IProperty _property = _bs.getBlock().getStateContainer().getProperty(entry.getKey().getName()); if (_bs.has(_property)) _bs = _bs.with(_property, (Comparable) entry.getValue()); } world.setBlockState(_bp, _bs, 3); } } else { if (((world.getBlockState(new BlockPos((int) x, (int) y, (int) z))) .getBlock() == PinkStudioLightBlock.block.getDefaultState().getBlock())) { { BlockPos _bp = new BlockPos((int) x, (int) y, (int) z); BlockState _bs = PinkStudioLightOffBlock.block.getDefaultState(); BlockState _bso = world.getBlockState(_bp); for (Map.Entry<IProperty<?>, Comparable<?>> entry : _bso.getValues().entrySet()) { IProperty _property = _bs.getBlock().getStateContainer() .getProperty(entry.getKey().getName()); if (_bs.has(_property)) _bs = _bs.with(_property, (Comparable) entry.getValue()); } world.setBlockState(_bp, _bs, 3); } } else { if (((world.getBlockState(new BlockPos((int) x, (int) y, (int) z))) .getBlock() == YellowStudioLightBlock.block.getDefaultState().getBlock())) { { BlockPos _bp = new BlockPos((int) x, (int) y, (int) z); BlockState _bs = YellowStudioLightOffBlock.block.getDefaultState(); BlockState _bso = world.getBlockState(_bp); for (Map.Entry<IProperty<?>, Comparable<?>> entry : _bso.getValues().entrySet()) { IProperty _property = _bs.getBlock().getStateContainer() .getProperty(entry.getKey().getName()); if (_bs.has(_property)) _bs = _bs.with(_property, (Comparable) entry.getValue()); } world.setBlockState(_bp, _bs, 3); } } else { if (((world.getBlockState(new BlockPos((int) x, (int) y, (int) z))) .getBlock() == LightGrayStudioLightBlock.block.getDefaultState().getBlock())) { { BlockPos _bp = new BlockPos((int) x, (int) y, (int) z); BlockState _bs = LightGrayStudioLightOffBlock.block.getDefaultState(); BlockState _bso = world.getBlockState(_bp); for (Map.Entry<IProperty<?>, Comparable<?>> entry : _bso.getValues().entrySet()) { IProperty _property = _bs.getBlock().getStateContainer() .getProperty(entry.getKey().getName()); if (_bs.has(_property)) _bs = _bs.with(_property, (Comparable) entry.getValue()); } world.setBlockState(_bp, _bs, 3); } } else { if (((world.getBlockState(new BlockPos((int) x, (int) y, (int) z))) .getBlock() == LightBlueStudioLightBlock.block.getDefaultState().getBlock())) { { BlockPos _bp = new BlockPos((int) x, (int) y, (int) z); BlockState _bs = LightBlueStudioLightOffBlock.block.getDefaultState(); BlockState _bso = world.getBlockState(_bp); for (Map.Entry<IProperty<?>, Comparable<?>> entry : _bso.getValues().entrySet()) { IProperty _property = _bs.getBlock().getStateContainer() .getProperty(entry.getKey().getName()); if (_bs.has(_property)) _bs = _bs.with(_property, (Comparable) entry.getValue()); } world.setBlockState(_bp, _bs, 3); } } else { if (((world.getBlockState(new BlockPos((int) x, (int) y, (int) z))) .getBlock() == RedStudioLightBlock.block.getDefaultState().getBlock())) { { BlockPos _bp = new BlockPos((int) x, (int) y, (int) z); BlockState _bs = RedStudioLightOffBlock.block.getDefaultState(); BlockState _bso = world.getBlockState(_bp); for (Map.Entry<IProperty<?>, Comparable<?>> entry : _bso.getValues().entrySet()) { IProperty _property = _bs.getBlock().getStateContainer() .getProperty(entry.getKey().getName()); if (_bs.has(_property)) _bs = _bs.with(_property, (Comparable) entry.getValue()); } world.setBlockState(_bp, _bs, 3); } } else { if (((world.getBlockState(new BlockPos((int) x, (int) y, (int) z))) .getBlock() == OrangeStudioLightBlock.block.getDefaultState().getBlock())) { { BlockPos _bp = new BlockPos((int) x, (int) y, (int) z); BlockState _bs = OrangeStudioLightOffBlock.block.getDefaultState(); BlockState _bso = world.getBlockState(_bp); for (Map.Entry<IProperty<?>, Comparable<?>> entry : _bso.getValues() .entrySet()) { IProperty _property = _bs.getBlock().getStateContainer() .getProperty(entry.getKey().getName()); if (_bs.has(_property)) _bs = _bs.with(_property, (Comparable) entry.getValue()); } world.setBlockState(_bp, _bs, 3); } } else { if (((world.getBlockState(new BlockPos((int) x, (int) y, (int) z))) .getBlock() == StudioLightBlock.block.getDefaultState().getBlock())) { { BlockPos _bp = new BlockPos((int) x, (int) y, (int) z); BlockState _bs = BlackStudioLightOffBlock.block.getDefaultState(); BlockState _bso = world.getBlockState(_bp); for (Map.Entry<IProperty<?>, Comparable<?>> entry : _bso.getValues() .entrySet()) { IProperty _property = _bs.getBlock().getStateContainer() .getProperty(entry.getKey().getName()); if (_bs.has(_property)) _bs = _bs.with(_property, (Comparable) entry.getValue()); } world.setBlockState(_bp, _bs, 3); } } } } } } } } } } } } } } } } } } } this doesn't work already at this part: Quote
loordgek Posted December 27, 2020 Posted December 27, 2020 if only there was a redstone lamp in minecraft that i can look at 1 Quote
JoppeGames3 Posted December 28, 2020 Posted December 28, 2020 (edited) Yeah, I looked at the Redstone lamp class but this: [removed vanilla code] doesn't help me with creating my own Redstone lamp Edited December 28, 2020 by diesieben07 Quote
Draco18s Posted December 28, 2020 Posted December 28, 2020 On 12/28/2020 at 12:26 AM, JoppeGames3 said: doesn't help me with creating my own Redstone lamp Expand Why not? Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
JoppeGames3 Posted December 28, 2020 Posted December 28, 2020 well, the LIT part confuses me, the rest I can understand Quote
Beethoven92 Posted December 28, 2020 Posted December 28, 2020 What is confusing you about the LIT property? Quote Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port
JoppeGames3 Posted December 28, 2020 Posted December 28, 2020 how to add my own on and off model there? Quote
Beethoven92 Posted December 28, 2020 Posted December 28, 2020 You have to create your own blockstate json which specifies which models the game has to choose (in this case by checking the value of the LIT property) Quote Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port
Recommended Posts
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.