Jump to content

coding a redstone lamp


JoppeGames1

Recommended Posts

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:

1647900426_Screenshot2020-12-27at14_42_41.thumb.png.9bfc1e872a42529e99fafcc92f7a1d6f.png

Link to comment
Share on other sites

12 minutes ago, JoppeGames3 said:

doesn't help me with creating my own Redstone lamp

Why not?

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.

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



×
×
  • Create New...

Important Information

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