Jump to content

Recommended Posts

Posted

I have a furnace-like block that is supposed to change its model depending on whether or not it's cooking something. However, even when I explicitly and repeatedly tell the game to put the block state to true, as opposed  to the default of false, it only ever shows the model for false. There are no errors, no crashes. I am at my wit's end.

 

Block class

 

  Reveal hidden contents

 

 

Tile entity

 

  Reveal hidden contents

 

 

Blockstates json

 

  Reveal hidden contents

 

Posted
  On 4/17/2015 at 1:57 AM, TheGreyGhost said:

Hi

 

You might get some clues from looking at this tutorial project, which has a custom furnace which changes its model.  See MBE31.

https://github.com/TheGreyGhost/MinecraftByExample

 

If that doesn't help, let us know?

 

-TGG

 

Thank you for the resource (I wish I had thought to look up a tutorial earlier), but unfortunately it has not helped. What I see different there is that the blockstate isn't actually set anywhere, but instead there's the getActualState function in the block and the tile entity sets the bock for a forced update instead of setting its state.

 

Current block class

 

  Reveal hidden contents

 

 

Current tile entity

 

  Reveal hidden contents

 

 

EDIT: I've got to go to a class, I won't be back for an hour or so. Any help you guys can provide is appreciated! This problem has been the final obstacle for my first mod for nearly two weeks now.

Posted

Hi

 

Your initial Block might work if you implement getMetaFromState() correctly, ie  not just return 0.

 

You will also need to force a block update every time the state changes-  The render information is only updated when the blocks change, so the furnace will turn on (or off) and you won't see it without a block update.

 

From memory I tried it both ways and found getActualState was easier.  Vanilla uses two different blocks entirely instead of changing iblockstate.

 

The latest fragment you posted looks like it's pretty close; I'd suggest you get rid of private boolean isBurning though, and just retrieve or set the TileEntity isBurning every time.  Otherwise you run the risk of updating one and forgetting to update the other.

 

-TGG

 

Posted

I'm not exactly sure how to implement getMetaFromState() correctly, here's what I tried (which didn't work)

 

public int getMetaFromState(IBlockState state)

    {

        return ((Boolean)state.getValue(ISBURNING)).booleanValue() ? 1 : 0;

    }

 

 

I don't see where the state is being changed. I assume it happens whenever getActualState() is called, or perhaps when other methods are called, and that I would need to update the block after that.

 

I got rid of the private boolean isBurning, but I was only using it for the particle generator function anyways. This is what I'm using now (which still doesn't make particles when things are cooking):

 

@SideOnly(Side.CLIENT)

    public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)

    {

        boolean isBurning = ((Boolean)state.getValue(ISBURNING)).booleanValue();

        if(isBurning) {

            double d0 = (double) pos.getX() + 0.5D;

            double d1 = (double) pos.getY() + 0.4D;

            double d2 = (double) pos.getZ() + 0.5D;

 

            worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);

        }

    }

 

This in particular suggests to me that the block state isn't being changed at all.

 

I need to go to bed, but will look back here in the morning. Thanks again for your help!

Posted

I do it perhaps more simply. In my block I create a method to update the state. For example, I have a tanning rack where you can see the hide turn to a tanned hide and I do it like this:

 

In my block I have:

    public static void changeBlockBasedOnTanningStatus(int parTanningIngredient, World parWorld, BlockPos parBlockPos)
    {
        TileEntity theTileEntity = parWorld.getTileEntity(parBlockPos);

        parWorld.setBlockState(parBlockPos, BlockSmith.blockTanningRack.getDefaultState().withProperty(TANNING_INGREDIENT, parTanningIngredient), 3);
        if (theTileEntity != null)
        {
            theTileEntity.validate();
            parWorld.setTileEntity(parBlockPos, theTileEntity);
        }
    }

 

This is called from the TileEntity's update() method when the condition for the change is met. In my case I do it when there is leather in the output slot. So my code looks like this (in the update() method of the TileEntity):

            // if leather result is in output slot display it
            if (tanningRackItemStackArray[slotEnum.OUTPUT_SLOT.ordinal()] != null)
            {
                 BlockTanningRack.changeBlockBasedOnTanningStatus(6, worldObj, pos);
            }
            else // display what is in input slot
            {
            	if (tanningRackItemStackArray[slotEnum.INPUT_SLOT.ordinal()] != null)
            {
            		Item inputItem = tanningRackItemStackArray[slotEnum.INPUT_SLOT.ordinal()].getItem();
            		
            	if (inputItem == BlockSmith.cowHide)
            	{
                	BlockTanningRack.changeBlockBasedOnTanningStatus(1, worldObj, pos);
            	}
            	else if (inputItem == BlockSmith.sheepSkin)
            	{
                	BlockTanningRack.changeBlockBasedOnTanningStatus(2, worldObj, pos);
            	}
            	else if (inputItem == BlockSmith.pigSkin)
            	{
                	BlockTanningRack.changeBlockBasedOnTanningStatus(3, worldObj, pos);
            	}
            	else if (inputItem == BlockSmith.horseHide)
            	{
                	BlockTanningRack.changeBlockBasedOnTanningStatus(4, worldObj, pos);
            	}
            	else if (inputItem == Items.rabbit_hide)
            	{
                	BlockTanningRack.changeBlockBasedOnTanningStatus(5, worldObj, pos);
            	}
            	}
            	else
            	{
                	BlockTanningRack.changeBlockBasedOnTanningStatus(0, worldObj, pos);
            	}
            }

 

I should probably enumerate the tanning ingredients, but basically this shows an easy way to create complex logic that controls the model.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Thank you Jabelar, for my first hint of success! I implemented basically what you showed, and now my particle method is making particles when things are cooking! THE BLOCK STATE HAS CHANGED! HUZZAH!

 

Unfortunately the model is still the same. So why would the model be the same even though I KNOW the blockstate has changed?

Posted
  On 4/17/2015 at 2:27 PM, TheRedMezek said:

Thank you Jabelar, for my first hint of success! I implemented basically what you showed, and now my particle method is making particles when things are cooking! THE BLOCK STATE HAS CHANGED! HUZZAH!

 

Unfortunately the model is still the same. So why would the model be the same even though I KNOW the blockstate has changed?

 

What do your model JSONs look like?

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Both of them are currently being used by other blocks and work just fine there.

 

bigbrazier

 

  Reveal hidden contents

 

 

raisedbrazier

 

  Reveal hidden contents

 

Posted

Hi

 

Try this:

turn the furnace on so that your particles are coming out.  Then place another block (eg dirt) right next to the furnace so it is touching.  Does your block model suddenly change to a lit furnace?

 

-TGG

Posted
  On 4/17/2015 at 3:22 PM, TheGreyGhost said:

Hi

 

Try this:

turn the furnace on so that your particles are coming out.  Then place another block (eg dirt) right next to the furnace so it is touching.  Does your block model suddenly change to a lit furnace?

 

-TGG

Nope

Posted
  On 4/17/2015 at 3:47 PM, TheGreyGhost said:

Hi

 

show your blockstates json, your Block code, your TileEntity code, and any relevant errors in the console?

 

-TGG

No relevant errors in the console as far as I can see

 

  Reveal hidden contents

 

 

Blockstate json

 

  Reveal hidden contents

 

 

Block code

 

  Reveal hidden contents

 

 

Tile entity

 

  Reveal hidden contents

 

Posted

Hi

 

Your bigbrazier and raisedbrazier jsons appear to be both lit (use "fire" texture)?

 

Your

    public IBlockState getStateFromMeta(int meta)

    {

        return this.getDefaultState();

        //return this.getDefaultState().withProperty(ISBURNING, Boolean.valueOf(isBurning));

    }

 

should be something like

return this.getDefaultState().withProperty(ISBURNING, meta == 1);

 

Apart from that I don't see anything, sorry...

 

-TGG

Posted
  On 4/17/2015 at 4:08 PM, TheGreyGhost said:

Hi

 

Your bigbrazier and raisedbrazier jsons appear to be both lit (use "fire" texture)?

 

Your

    public IBlockState getStateFromMeta(int meta)

    {

        return this.getDefaultState();

        //return this.getDefaultState().withProperty(ISBURNING, Boolean.valueOf(isBurning));

    }

 

should be something like

return this.getDefaultState().withProperty(ISBURNING, meta == 1);

 

Apart from that I don't see anything, sorry...

 

-TGG

 

I changed getStateFromMeta() as you suggested, I don't see any change.

 

The models aren't the actual models I plan to use for this block (since I haven't made those yet), they're just placeholders. raisedbrazier is two or three times as many  pixels high as bigbrazier, so when the model changes it will be quite obvious.

 

God help me, TheGreyGhost is stumped.

Posted

At this point I think you should just do standard debug process. Trace the variables' behavior to ensure it is following your expectations. You can use debug mode of your IDE or just put a bunch of System.out.println() console statements.

 

Also I want to point out that logically it is possible that the particles work and the models don't if there are multiple places where the block's state is updated. For example, during the random tick you directly read the is burning and act on it, so you know it will be good at that point. But maybe something else comes along and changes it before the renderer gets chance to start processing the model.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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

    • Crash Report: https://mclo.gs/cqfHEI7 Latest.log: https://mclo.gs/1OLLfBs
    • I never thought I’d fall for it but I did. It all started with what seemed like a promising crypto investment opportunity I found through a popular social media platform. The project looked legitimate, with a sleek website, professional looking team profiles, and glowing testimonials. After doing what I thought was enough due diligence, I invested. First $5,000. Then $10,000. Over the next few months, I put in a total of $153,000. The returns were amazing on paper. My account showed massive gains, and I was told I could “withdraw soon.” But when I tried to cash out, I was hit with endless delays, excuses, and requests for additional “verification fees.” That’s when the panic set in: I realized I’d been scammed. I felt sick. Devastated. Embarrassed. After days of searching online, I came across Malice Cyber Recovery, a firm that specialized in tracing and recovering lost digital assets. I was skeptical at first I’d already lost so much, and I wasn’t ready to be taken advantage of again. But their team was incredibly professional and transparent from the start. They explained the recovery process in detail and didn’t make any unrealistic promises. They began with a full investigation, tracing the blockchain transactions and identifying the wallet addresses involved. Within a week, they had compiled enough evidence to begin their recovery strategy. It wasn’t easy and it wasn’t overnight but within a matter of weeks, I received the news I never thought I’d hear They had recovered my $153,000. I cried. Not just because I got my money back but because someone actually cared enough to help me. If you’ve fallen victim to a crypto scam, don’t suffer in silence. Malice Cyber Recovery gave me my life back and they just might be able to do the same for you  
    • Maximizing savings on  Temu  has never been easier! With the exclusive 70% Off Coupon Code [acu729640], you can enjoy unparalleled discounts on a vast array of trending products. This offer, coupled with fast delivery and free shipping across 67 countries, ensures that shoppers receive high-quality items at remarkably reduced prices. Exclusive  Temu  Coupon Codes for Maximum Savings Enhance your shopping experience by applying these verified Coupon Codes: acu729640 – Enjoy a 70% discount on your order. acu729640 – Receive an extra 30% off on select items. acu729640 – Benefit from free shipping on all purchases. acu729640 – Save $10 on orders exceeding $50. acu729640 – Unlock special discounts on newly launched products. What is the  Temu  70% Off Coupon Code [acu729640]? The 70% Off Coupon Code [acu729640] is a premier promotional tool that significantly reduces the cost of various products across  Temu 's extensive marketplace. Whether you are a first-time buyer or a returning customer, applying this Code at checkout guarantees exceptional discounts on categories such as apparel, electronics, home essentials, and more. How Does the 70% Off Coupon Code [acu729640] Work on  Temu ? Leveraging the 70% Off Coupon Code [acu729640] is effortless: Browse  Temu ’s diverse product range. Select and add desired items to your shopping cart. Enter [acu729640] at checkout. Instantly receive a 70% discount. Complete your transaction and enjoy expedited, reliable shipping. Is the  Temu  70% Off Coupon Code [acu729640] Legitimate? Absolutely! The  Temu  70% Off Coupon Code [acu729640] is an authentic and verified discount, actively used by thousands of savvy shoppers. Unlike misleading online offers, this Coupon is officially endorsed by  Temu , ensuring its seamless functionality across multiple product categories. Latest  Temu  Coupon Code 70% Off [acu729640] + Additional 30% Discount  Temu  continually updates its promotional lineup. In addition to the 70% Off Coupon Code [acu729640], customers can utilize to obtain an extra 30% discount on selected items. These stacked savings empower users to optimize their purchases and maximize financial benefits.  Temu  Coupon Code 70% Off United States [acu729640] For 2025 For customers residing in the United States, the  Temu  Coupon Code 70% Off [acu729640] remains a top-tier deal in 2025. Coupled with nationwide free shipping, this offer presents an unparalleled opportunity to secure premium products at a fraction of their original cost.  Temu  70% Off Coupon Code [acu729640] + Free Shipping In addition to receiving 70% off, users also enjoy complimentary shipping when applying the  Temu  70% Off Coupon Code [acu729640]. This combination of discounts and free shipping eliminates hidden costs, reinforcing  Temu ’s dedication to customer satisfaction and affordability. More Exclusive  Temu  Coupon Codes for Additional Savings Maximize your savings with these additional discount Codes: acu729640 – Unlock a 70% discount instantly. acu729640 – Avail extra savings for new users. acu729640 – Get free shipping on all orders. acu729640 – Enjoy bulk purchase discounts. acu729640 – Access exclusive markdowns on premium collections. Why Should You Use the  Temu  70% Off Coupon Code [acu729640]? Substantial savings across multiple product categories. Exclusive discounts for new and returning customers. Verified and legitimate Coupon Codes with immediate application. Complimentary shipping available across 67 countries. Expedited delivery and a seamless shopping experience. Final Note: Use The Latest  Temu  Coupon Code [acu729640] 70% Off The  Temu  Coupon Code [acu729640] 70% off offers an unparalleled opportunity to save significantly on high-quality products. Secure this deal now to maximize your benefits in July 2025. With the  Temu  Coupon 70% off, you can access exceptional discounts and unbeatable pricing. Apply the Code today and transform your shopping experience. Summary:  Temu  Coupon Code 70% Off  Temu  70% Off Coupon Code acu729640 70% Off Coupon Code acu729640  Temu   Temu  Coupon Code 70% Off United States 2025 Latest  Temu  Coupon Code 70% Off acu729640  Temu  70% Off Coupon Code legit How to use  Temu  70% Off Coupon Code Temu  70% Off Coupon Code free shipping Best  Temu  discount Codes 2025  Temu  promo Codes July 2025 FAQs About the  Temu  70% Off Coupon What is the 70% Off Coupon Code [acu729640] on  Temu ? The 70% Off Coupon Code [acu729640] is a promotional tool enabling shoppers to secure up to 70% savings on a vast selection of  Temu  products. How can I apply the  Temu  70% Off Coupon Code [acu729640]? To redeem the Coupon, simply add your chosen items to the cart, enter [acu729640] at checkout, and enjoy the automatic discount. Is the  Temu  70% Off Coupon Code [acu729640] available for all users? Yes! Both first-time and returning customers can leverage the 70% Off Coupon Code [acu729640] to access incredible savings. Does the 70% Off Coupon Code [acu729640] include free shipping? Yes! Applying [acu729640] at checkout not only provides a 70% discount but also ensures free shipping across applicable regions. Can the  Temu  70% Off Coupon Code [acu729640] be used multiple times? The validity and frequency of Coupon usage are subject to  Temu ’s promotional policies. Many users report success in applying the Coupon across multiple transactions, maximizing their overall savings potential.  
    • Temu Gutscheincode 100 € RABATT → [acu729640] für die USA im Juli  Spare riesig mit dem Temu Gutscheincode 100 € RABATT → [acu729640] im Juli 2025 Im Juli 2025 bringt Temu unglaubliche Rabatte für seine treuen Kunden mit einem exklusiven Gutscheincode (acu729640), der dir beeindruckende 100 € Rabatt auf deinen Einkauf gewährt. Egal, ob du Neukunde oder Stammkunde bist – du kannst bei einer riesigen Auswahl an Artikeln sparen, darunter Elektronik, Mode, Haushaltswaren und vieles mehr! Jetzt ist der perfekte Zeitpunkt, um satte Rabatte zu genießen und zu erleben, warum Temu eine der führenden globalen E-Commerce-Plattformen ist. Was macht Temu so besonders? Temu ist bekannt für eine riesige Auswahl an trendigen Produkten zu unschlagbaren Preisen. Von den neuesten Technik-Gadgets bis zu stylischer Kleidung und Haushaltsbedarf – hier findest du alles. Außerdem bietet Temu kostenlosen Versand in über 67 Länder, schnelle Lieferung und Rabatte von bis zu 90 % auf ausgewählte Produkte. Mit dem Gutscheincode (acu729640) erhältst du zusätzliche Rabatte! So verwendest du den Temu Gutscheincode (acu729640) im Juli 2025 So nutzt du das 100 €-Angebot mit dem Temu Gutscheincode (acu729640): Registrieren oder Einloggen bei Temu: Ob neu oder bereits Kunde – du musst dich anmelden oder ein Konto erstellen, um den Gutscheincode einzulösen. Durchstöbere die große Temu-Auswahl: Entdecke Temus umfangreiches Produktsortiment – von Haushaltsartikeln, Beauty-Produkten, Mode bis hin zu Hightech-Gadgets. Gutscheincode eingeben (acu729640): Gib den Code im Feld "Promo Code" beim Checkout ein, um die 100 € sofort abzuziehen. Zusätzliche Rabatte sichern: Neben den 100 € Rabatt gibt es bis zu 40 % Rabatt auf ausgewählte Artikel oder kombinierbare Gutscheinpakete. Bestellung abschließen: Überprüfe deinen Warenkorb und schließe die Bestellung ab – inklusive kostenlosem Versand in über 67 Länder! Warum du den Temu Gutscheincode (acu729640) verwenden solltest Der Temu Gutscheincode (acu729640) bietet viele Vorteile – egal ob Neukunde oder Bestandskunde: 100 € Rabatt für Neukunden: Spare 100 € bei deiner ersten Bestellung. 100 € Rabatt für Bestandskunden: Auch wiederkehrende Kunden profitieren mit acu729640 von 100 € Rabatt. 40 % zusätzlicher Rabatt: Auf ausgewählte Produkte gibt es bis zu 40 % zusätzlich. Gratisgeschenk für Neukunden: Neukunden erhalten ein kostenloses Geschenk beim Einsatz des Gutscheins. 100 € Gutscheinpaket: Spare noch mehr mit gebündelten Gutscheinen für Technik, Mode, Haushaltswaren und mehr. Temu Neukunden-Rabatte & Angebote Perfekt für Neueinsteiger! Als Neukunde bekommst du: 100 € Rabatt auf die erste Bestellung mit dem Code (acu729640). Kostenloser Versand in über 67 Länder. Exklusive Promo-Codes je nach Produktkategorie. Zusätzliche Temu Gutscheine speziell für Neukunden im Juli 2025. Temu Gutscheine für Bestandskunden Auch bestehende Kunden gehen nicht leer aus: 100 € Rabatt mit acu729640 auf die nächste Bestellung. 40 % Rabatt auf ausgewählte Produkte in vielen Kategorien. Gutscheinpaket für Bestandskunden, ideal für größere Einkäufe. Weitere Rabattcodes für beliebte Produkte und Aktionen. Neue Temu-Angebote im Juli 2025 Temu überrascht immer wieder mit frischen Angeboten. Im Juli 2025 gibt es: 100 € Rabatt für Neu- und Bestandskunden mit dem Code acu729640. Bis zu 40 % Rabatt auf Elektronik, Beauty, Deko und mehr. Neukunden-Coupons inklusive Gratisgeschenk und Sonderaktionen. Laufend neue Angebote den ganzen Juli über – regelmäßig reinschauen lohnt sich! Spare in verschiedenen Ländern & Kategorien mit Temu Gutscheinen Beispiele, wie Temu-Codes weltweit funktionieren: USA: 100 € Rabatt mit acu729640 auf Bestellungen in den USA. Kanada: Kanadier erhalten 100 € Rabatt bei Erst- oder Folgebestellung. UK: Auch britische Kunden sparen 100 € mit dem Code. Japan: Japanische Kunden erhalten 100 € Rabatt plus Sonderaktionen. Mexiko, Brasilien, Spanien, Deutschland: Bis zu 40 % Rabatt auf ausgewählte Artikel mit acu729640. Fazit Ob neu oder treu – der Temu Gutscheincode (acu729640) bringt dir im Juli 2025 satte Rabatte:  100 € sparen, 40 % auf ausgewählte Artikel und kostenloser Versand weltweit. Temu bietet großartige Preise, eine riesige Auswahl und jede Menge Aktionen. Jetzt zuschlagen: Code acu729640 im Warenkorb eingeben und sparen!  
  • Topics

×
×
  • Create New...

Important Information

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