Jump to content

Recommended Posts

Posted

You can, but the better question is why?

(Usually people want to know how to prevent the drops)

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

I have a block which replaces a selection of blocks and stores the path to a file with the saved selections on its tile entity. In survival, the player picks up the block after breaking and puts it in his inventory to place it at some other time and place and restore the original blocks from file. I would like the same behavior in creative

Posted

First, you need to check whether the player is in creative mode with an of statement. Next, you need to get the item id of the item you broke (I think there's a method called onBlockBreak for that). Finally, return the block id in the onBlockBreak method. I'm just trying to make simple solutions, so if this doesn't work, tell me and I'll spend some time thinking of a more concrete way to solve this

Posted

Thanks for the reply :)

 

Not sure what you mean by " item id of the item you broke".

 

I am breaking a Block. My understanding is that once it is in the player's inventory it is an ItemBlock.

 

Method onBlockBreak is on which class?

Posted

I re read what you were doing, and I was completely wrong ;-; disregard all of the above. How are you getting and saving the selection of blocks? Post your code please :P

 

I made a mistake and assumed you were doing something less complicated, my bad. Just post the class. Honestly, the way I'm thinking of is really simple (if what you're trying to do is what I think)

Posted

My mod is on GitHub, repository is mo-jo. The Block is named BlockSaved. Please have a look if you are interested.

 

But this is really a generic problem. How do you make a block, any block, drop in creative?

Posted

Try overriding

Block#removedByPlayer

to call

Block#harvestBlock

if the player that destroyed the block is in creative mode.

  • Like 1

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Thanks!

 

@Override
public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
	if (willHarvest) {
		// Delay deletion of the block until after getDrops
		return true;
	}
	if (player.capabilities.isCreativeMode) {
		harvestBlock(world, player, pos, this.getDefaultState(), null);
	}
	return super.removedByPlayer(world, pos, player, willHarvest);
}

  • Like 1
Posted

You should pass the actual state (

World#getBlockState

) rather than the default state (

Block#getDefaultState

) to

harvestBlock

. At the time of

removedByPlayer

being called, the

Block

is still in the world.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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

    • Unlock an Instant $100 OFF with the Exclusive Temu Coupon Code ALF401700! Whether you're a first-time shopper or a loyal returning customer, this verified Temu promo code ALF401700 is your gateway to incredible savings on thousands of products. By applying code ALF401700 at checkout, youโ€™ll receive a guaranteed $100 discount on your purchase, plus enjoy additional savings of up to 50% OFF on selected items. This special coupon is designed to maximize your discounts, making your shopping experience at Temu more affordable than ever. Why Choose Temu Coupon Code ALF401700 in 2025? First-Time Shoppers: Score a massive 50% off your first order plus a flat $100 OFF using promo code ALF401700. Returning Customers: Donโ€™t miss out! Use ALF401700 to claim a generous $100 OFF on your next purchase. Massive Clearance Sales: With Temuโ€™s ongoing 2025 clearance events, this code unlocks up to 90% OFF on select deals. Global Reach: Whether you shop from the USA, Canada, Europe, Asia, or beyond, Temu coupon ALF401700 works worldwide. 2025โ€™s Top Temu Discounts Powered by ALF401700: Temu $100 OFF New User Promo โ€” ALF401700 Temu Exclusive Discount for Returning Shoppers โ€” ALF401700 Memorial Day Special: $100 OFF Using ALF401700 Country-Specific Offers: USA, Japan, Mexico, Chile, Colombia, Malaysia, Philippines, South Korea, Saudi Arabia, Qatar, Germany, France, Israel โ€” all accept code ALF401700 Free Gift Unlocks โ€” Apply ALF401700 Without Referrals Stackable Bundles: Combine ALF401700 for $100 OFF with up to 50% sitewide discounts 100% OFF Flash Deals during Temu Events with ALF401700 How to Redeem Your Temu Coupon Code ALF401700: Visit the official Temu website or open the Temu app. Select your favorite products and add them to your cart. Enter the promo code ALF401700 in the discount code field at checkout. Watch your total instantly drop by $100 and enjoy any additional percentage discounts automatically applied. Complete your order and enjoy huge savings! Key Benefits of Using ALF401700 Temu Promo Code: Verified and Tested: This code is active and guaranteed to work for 2025. Applicable for All Users: New or existing customers get to enjoy the perks. Works Across Multiple Countries: Perfect for international shoppers. No Minimum Purchase Required: Use it anytime to save $100. Perfect for Big and Small Orders: Whether buying essentials or splurging, save big with ALF401700. Temu Coupon Code ALF401700 by Region: ๐Ÿ‡บ๐Ÿ‡ธ United States โ€” Save $100 OFF ๐Ÿ‡จ๐Ÿ‡ฆ Canada โ€” Instant $100 Discount ๐Ÿ‡ฌ๐Ÿ‡ง United Kingdom โ€” Exclusive $100 OFF ๐Ÿ‡ฏ๐Ÿ‡ต Japan โ€” Hot $100 OFF Deal ๐Ÿ‡ฒ๐Ÿ‡ฝ Mexico โ€” Get $100 OFF ๐Ÿ‡จ๐Ÿ‡ฑ Chile โ€” 2025 Special Discount ๐Ÿ‡ฐ๐Ÿ‡ท South Korea โ€” Massive Savings ๐Ÿ‡ต๐Ÿ‡ญ Philippines โ€” Extra $100 OFF ๐Ÿ‡ธ๐Ÿ‡ฆ Saudi Arabia โ€” Verified Promo ๐Ÿ‡ถ๐Ÿ‡ฆ Qatar โ€” Top Discount ๐Ÿ‡ฉ๐Ÿ‡ช Germany โ€” Exclusive Savings ๐Ÿ‡ซ๐Ÿ‡ท France โ€” Coupon Works ๐Ÿ‡ฎ๐Ÿ‡ฑ Israel โ€” Huge Discount Final Words: Make 2025 your year of unbeatable savings with the Temu coupon code ALF401700. Act now to claim your $100 OFF plus unlock additional discounts on thousands of products. Whether shopping for fashion, electronics, home essentials, or gifts, this is the best Temu promo code to maximize your budget. Download the Temu app today, enter ALF401700 at checkout, and watch the savings roll in!
    • 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
  • Topics

ร—
ร—
  • Create New...

Important Information

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