Jump to content

Recommended Posts

Posted

Hello there lovely people! Been messing with multiblock structures and had a few questions.

 

1: Is having a crazy amount of if statements "bad" (server-wise) when dealing with multiblocks? (i have 26x4 if statements checking, 26 for each direction the block is facing.)

 

2: How I have it now is if(multiblock == true) it makes right clicking the furnace block open the gui. Is it possible to extend it so when any of the 3x3x3 blocks are right clicked it opens the gui? Make block hitbox into 3x3x3 or something?

 

3: As image below shows, when putting a model with a texture over blocks like that, is there a way to either hide the blocks (setting them to Blocks.air?) under or make model texture dominant over block textures there somehow? At first I made the model 1 pixel longer on each side so it just got above the redstone block texture, but then the model take up half a pixel more on all sides and it looked bad.

 

Any help or tips are appriciated!

 

 

M6vDtQd.png

Posted

1. As long as they are not in per-tick calls - yes. Whenever you go into ticking stuff - always: The less, the better and if you can't - you don't do it per-tick, but per few sec at least - in critical cases ofc.

 

2. if(multiblock == true) - I hope this si pseudocode, you don't need "==" in boolean statements - meaning: if(multiblock) - is correct.

No, do not extend hitbox (which I think is impossible in "good" terms). What I'd do is make clicking other blocks (around) search for parent furnace and open it remotely by passing arguments from onBlockRightClick or whatever (just idea).

 

3. I don't get the pictured example. I probably know what you want, but still not sure, explain. You will probably want to make custom renederer, not an expert.

1.7.10 is no longer supported by forge, you are on your own.

Posted

1. As long as they are not in per-tick calls - yes. Whenever you go into ticking stuff - always: The less, the better and if you can't - you don't do it per-tick, but per few sec at least - in critical cases ofc.

 

Technically speaking, more code is not slower code.  If there's a fast way to check that something may be true (i.e. if the fast check returns a statement that provides false positives, but not false negatives, or vice versa), then if that's false, you can skip a more expensive check, its better than if you didn't check.

 

For multiblock, you shouldn't be doing checks in onUpdate anyway: the world didn't change unless you got a neighbor block update check.  Which you can then fast-check the changed block (not one of the multiblock items? No need to check for the whole structure).

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.

Posted

3. I don't get the pictured example. I probably know what you want, but still not sure, explain. You will probably want to make custom renederer, not an expert.

 

Basically when I add the model directly over the redstone blocks, the texture flickers as you move around looking at it. I'm assuming this is because there are now 2 textures fighting ontop of eachother. Trying to figure out what the best way is to only show the model texture, and hide/remove the 3x3x3 blocks under it. I can make the model bigger and 1 pixel into the sourrounding blocks, but that doesn't look right.

Posted

I had the same issue, and I solved it by overriding the

shouldSideBeRendered

method. In that method, you get the side as a parameter. Get the according ForgeDirection from it, and get the opposite from it, as we undo the offset they did, so we can get the right coordinates. Now get the TileEntity from the world, adding the opposite to the coordinates, so you should get something like this:

TileEntity tile = world.getTileEntity(x+opposite.x, y+opposite.y, z+opposite.z);

Now return false if the multiblock is formed, and true if the multiblock isn't formed.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

Basically when I add the model directly over the redstone blocks, the texture flickers as you move around looking at it. I'm assuming this is because there are now 2 textures fighting ontop of eachother. Trying to figure out what the best way is to only show the model texture, and hide/remove the 3x3x3 blocks under it. I can make the model bigger and 1 pixel into the sourrounding blocks, but that doesn't look right.

 

That is precisely what's happening.  It's called z-fighting.

 

Most mods avoid this problem by not using vanilla blocks in their structures.  Your best bet is to create an invisible (but solid) block that replaces the redstone (or whatever) so that the original block doesn't render.  But when broken, it drops the original and kills the multiblock.

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.

Posted

Basically when I add the model directly over the redstone blocks, the texture flickers as you move around looking at it. I'm assuming this is because there are now 2 textures fighting ontop of eachother. Trying to figure out what the best way is to only show the model texture, and hide/remove the 3x3x3 blocks under it. I can make the model bigger and 1 pixel into the sourrounding blocks, but that doesn't look right.

 

That is precisely what's happening.  It's called z-fighting.

 

Most mods avoid this problem by not using vanilla blocks in their structures.  Your best bet is to create an invisible (but solid) block that replaces the redstone (or whatever) so that the original block doesn't render.  But when broken, it drops the original and kills the multiblock.

 

Thanks for the help to all of you, appriciate it.

 

So the code below is what I got so far, it's a complete mess. I want to have a multiblock that I can set to any size with different blocks everywhere, but checking that will require thousands of if statements.

 

So how I understand it is if isMultiBlock is true set the blocks to their invisible state. But then it has to know which of the blocks the player breaks and set the invisible blocks back to the solid textured ones. Also if the player breaks the main block, how do you then set the blocks from invisible to solid textured? BreakEvents?

 

I just started school learning java so that and some tips here will hopefully get me where I want. :)

 

Edit: A friend told me about an api called beefcore for making multiblocks, might try it: https://github.com/erogenousbeef/BeefCore

public boolean isMultiBlockStructure(World world, int x, int y, int z) {

	if (checkMulti(world, x, y, z)){
		world.setBlock(x + 1, y + 0, z + 0, ModBlocks.blockInvBedrock);
		world.setBlock(x + 2, y + 0, z + 0, ModBlocks.blockInvCoal);
		world.setBlock(x + 3, y + 0, z + 0, ModBlocks.blockInvDiamond);
		world.setBlock(x + 4, y + 0, z + 0, ModBlocks.blockInvGravel);
		world.setBlock(x + 5, y + 0, z + 0, ModBlocks.blockInvMelon);
		/* North */ return true;
	}    

	if (checkIfMelonIsAir(world, x, y, z)){
		world.setBlock(x + 1, y + 0, z + 0, Blocks.bedrock);
		world.setBlock(x + 2, y + 0, z + 0, Blocks.coal_block);
		world.setBlock(x + 3, y + 0, z + 0, Blocks.diamond_block);
		world.setBlock(x + 4, y + 0, z + 0, Blocks.gravel);
	//	world.setBlock(x + 5, y + 0, z + 0, Blocks.melon_block);
		/* North */ return true;
	}    

	if (checkIfGravelIsAir(world, x, y, z)){
		world.setBlock(x + 1, y + 0, z + 0, Blocks.bedrock);
		world.setBlock(x + 2, y + 0, z + 0, Blocks.coal_block);
		world.setBlock(x + 3, y + 0, z + 0, Blocks.diamond_block);
	//	world.setBlock(x + 4, y + 0, z + 0, Blocks.gravel);
		world.setBlock(x + 5, y + 0, z + 0, Blocks.melon_block);
		/* North */ return true;
	}   

	if (checkIfDiamondIsAir(world, x, y, z)){
		world.setBlock(x + 1, y + 0, z + 0, Blocks.bedrock);
		world.setBlock(x + 2, y + 0, z + 0, Blocks.coal_block);
//		world.setBlock(x + 3, y + 0, z + 0, Blocks.diamond_block);
		world.setBlock(x + 4, y + 0, z + 0, Blocks.gravel);
		world.setBlock(x + 5, y + 0, z + 0, Blocks.melon_block);
		/* North */ return true;
	}   

	if (checkIfCoalIsAir(world, x, y, z)){
		world.setBlock(x + 1, y + 0, z + 0, Blocks.bedrock);
	//	world.setBlock(x + 2, y + 0, z + 0, Blocks.coal_block);
		world.setBlock(x + 3, y + 0, z + 0, Blocks.diamond_block);
		world.setBlock(x + 4, y + 0, z + 0, Blocks.gravel);
		world.setBlock(x + 5, y + 0, z + 0, Blocks.melon_block);
		/* North */ return true;
	}   

	if (checkIfBedrockIsAir(world, x, y, z)){
	//	world.setBlock(x + 1, y + 0, z + 0, Blocks.bedrock);
		world.setBlock(x + 2, y + 0, z + 0, Blocks.coal_block);
		world.setBlock(x + 3, y + 0, z + 0, Blocks.diamond_block);
		world.setBlock(x + 4, y + 0, z + 0, Blocks.gravel);
		world.setBlock(x + 5, y + 0, z + 0, Blocks.melon_block);
		/* North */ return true;
	}  

   return false;	
}

private static boolean checkMulti(World world, int x, int y, int z) {
	if (world.getBlock(x + 1, y + 0, z + 0) == Blocks.bedrock || world.getBlock(x + 1, y + 0, z + 0) == ModBlocks.blockInvBedrock){
		if (world.getBlock(x + 2, y + 0, z + 0) == Blocks.coal_block || world.getBlock(x + 2, y + 0, z + 0) == ModBlocks.blockInvCoal) {
			if (world.getBlock(x + 3, y + 0, z + 0) == Blocks.diamond_block || world.getBlock(x + 3, y + 0, z + 0) == ModBlocks.blockInvDiamond) {
				if (world.getBlock(x + 4, y + 0, z + 0) == Blocks.gravel || world.getBlock(x + 4, y + 0, z + 0) == ModBlocks.blockInvGravel) {
					if (world.getBlock(x + 5, y + 0, z + 0) == Blocks.melon_block || world.getBlock(x + 5, y + 0, z + 0) == ModBlocks.blockInvMelon) {
                                                    return true;
					}
				}
			}
		}
	}
	return false;
}

private static boolean checkIfMelonIsAir(World world, int x, int y, int z) {
	if (world.getBlock(x + 1, y + 0, z + 0) == ModBlocks.blockInvBedock){
		if (world.getBlock(x + 2, y + 0, z + 0) == ModBlocks.blockInvCoal) {
			if (world.getBlock(x + 3, y + 0, z + 0) == ModBlocks.blockInvDiamond) {
				if (world.getBlock(x + 4, y + 0, z + 0) == ModBlocks.blockInvGravel) {
					if (world.getBlock(x + 5, y + 0, z + 0) == Blocks.air) {
                                                    return true;
					}
				}
			}
		}
	}
	return false;
}

private static boolean checkIfGravelIsAir(World world, int x, int y, int z) {
	if (world.getBlock(x + 1, y + 0, z + 0) == ModBlocks.blockInvBedrock){
		if (world.getBlock(x + 2, y + 0, z + 0) == ModBlocks.blockInvCoal) {
			if (world.getBlock(x + 3, y + 0, z + 0) == ModBlocks.blockInvDiamond) {
				if (world.getBlock(x + 4, y + 0, z + 0) == Blocks.air) {
					if (world.getBlock(x + 5, y + 0, z + 0) == ModBlocks.blockInvMelon) {
                                                    return true;
					}
				}
			}
		}
	}
	return false;
}

private static boolean checkIfDiamondIsAir(World world, int x, int y, int z) {
	if (world.getBlock(x + 1, y + 0, z + 0) == ModBlocks.blockInvbedrock){
		if (world.getBlock(x + 2, y + 0, z + 0) == ModBlocks.blockInvCoal) {
			if (world.getBlock(x + 3, y + 0, z + 0) == Blocks.air) {
				if (world.getBlock(x + 4, y + 0, z + 0) == ModBlocks.blockInvGravel) {
					if (world.getBlock(x + 5, y + 0, z + 0) == ModBlocks.blockInvMelon) {
                                                    return true;
					}
				}
			}
		}
	}
	return false;
}

private static boolean checkIfCoalIsAir(World world, int x, int y, int z) {
	if (world.getBlock(x + 1, y + 0, z + 0) == ModBlocks.blockInvbedrock){
		if (world.getBlock(x + 2, y + 0, z + 0) == Blocks.air) {
			if (world.getBlock(x + 3, y + 0, z + 0) == ModBlocks.blockInvDiamond) {
				if (world.getBlock(x + 4, y + 0, z + 0) == ModBlocks.blockInvGravel) {
					if (world.getBlock(x + 5, y + 0, z + 0) == ModBlocks.blockInvMelon) {
                                                    return true;
					}
				}
			}
		}
	}
	return false;
}

private static boolean checkIfBedrockIsAir(World world, int x, int y, int z) {
	if (world.getBlock(x + 1, y + 0, z + 0) == Blocks.air){
		if (world.getBlock(x + 2, y + 0, z + 0) == ModBlocks.blockInvCoal) {
			if (world.getBlock(x + 3, y + 0, z + 0) == ModBlocks.blockInvDiamond) {
				if (world.getBlock(x + 4, y + 0, z + 0) == ModBlocks.blockInvGravel) {
					if (world.getBlock(x + 5, y + 0, z + 0) == ModBlocks.blockInvMelon) {
                                                    return true;
					}
				}
			}
		}
	}
	return false;
}

 

 

 

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Verified users can now unlock a $100 OFF Temu Coupon Code using the verified promo code [ALF401700]. This Temu $100 OFF code works for both new and existing customers and can be used to redeem up to 50% off your next order. Our exclusive Temu coupon code [ALF401700] delivers a flat $100 OFF on top of existing deals. First-time customers using code ALF401700 can save an extra 100% off select items. Returning users also qualify for an automatic $100 OFF discount just by applying this code at checkout. But wait—there’s more. With our Temu coupon codes for 2025, users can score up to 90% OFF on clearance items. Whether you’re shopping in the USA, Canada, UK, or elsewhere, Temu promo code ALF401700 unlocks extra discounts tailored to your account. Some users are saving 100% on items using this 2025 Temu promo code. 🔥 Temu Coupon Highlights Using Code [ALF401700]: Temu new user code – ALF401700: Save 50% off your first order + $100 OFF. Temu promo for existing customers – ALF401700: Enjoy flat $100 OFF instantly. Global availability: Works in the USA, UK, Canada, Germany, France, Japan, Chile, Colombia, Malaysia, Mexico, South Korea, Philippines, Saudi Arabia, Qatar, Pakistan, and more. Top 2025 Coupon Deal: Get $200 OFF plus 100% bonus discounts using code ALF401700. Top-Ranked Temu Deals for 2025 (Coupon Code: ALF401700): ✅ Temu $100 OFF Memorial Day Sale — Use ALF401700 ✅ Temu First Order Coupon — Use ALF401700 for 50% + $100 OFF ✅ Temu USA Coupon Code — Save $100 instantly with ALF401700 ✅ Temu Japan, Germany, Chile Codes — All support ALF401700 ✅ Temu Reddit Discount – $100 OFF: Valid for both new and old users ✅ Temu Coupon Bundle 2025 — $100 OFF + up to 50% slash ✅ 100% OFF Free Gift Code — Use ALF401700, no invite needed ✅ Temu Sign-Up Bonus Promo — Get a welcome $100 OFF instantly ✅ Free Temu Code for New Users — Use ALF401700, no referral required  Temu Clearance Codes 2025 — Use ALF401700 for 85–100% discounts Why ALF401700 is the Best Temu Code in 2025 Using Temu code ALF401700 is your ticket to massive savings, free shipping, first-order discounts, and stackable coupon bundles. Whether you're browsing electronics, fashion, home goods, or beauty products, this verified Temu discount code offers real savings—up to 90% OFF + $100 OFF on qualified orders. 💡 Pro Tip: Apply ALF401700 during checkout in the Temu app or website to activate your instant $100 discount, even if you’re not a new user. Temu $100 OFF Code by Country (All Use ALF401700): 🇺🇸 Temu USA – ALF401700 🇯🇵 Temu Japan – ALF401700 🇲🇽 Temu Mexico – ALF401700 🇨🇱 Temu Chile – ALF401700 🇨🇴 Temu Colombia – ALF401700 🇲🇾 Temu Malaysia – ALF401700 🇵🇭 Temu Philippines – ALF401700 🇰🇷 Temu Korea – ALF401700 🇵🇰 Temu Pakistan – ALF401700 🇫🇮 Temu Finland – ALF401700 🇸🇦 Temu Saudi Arabia – ALF401700 🇶🇦 Temu Qatar – ALF401700 🇫🇷 Temu France – ALF401700 🇩🇪 Temu Germany – ALF401700 🇮🇱 Temu Israel – ALF401700 Temu Coupon Code [ALF401700] Summary for SEO: Temu $100 OFF Code  Temu First Order Discount Code 2025  Temu Verified Promo Code ALF401700  Temu 50% OFF + $100 Bonus  Temu 100% OFF Code 2025  Temu App Promo ALF401700  Temu Working Discount Code 2025 
    • Hey there, nothing to do with the code, I am just suggesting you use Intelij IDEA. Trust me, it is the best.
    • Hey there, nothing to do with the code, I am just suggesting you use Intelij IDEA. Trust me, it is the best.
    • You can check the config of Geckolib and Mowzie's Mobs - maybe there is a way to disable some render features
    • You can use the .requires() function  the server also has a permission level of 4, which is the highest permission level.
  • Topics

×
×
  • Create New...

Important Information

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