Showing posts with label minecraft. Show all posts
Showing posts with label minecraft. Show all posts

Saturday, October 18, 2014

What's up with the big air blocks in Minecraft oceans?

If you've played Minecraft for a while and gone adventuring on the high seas, you may have noticed an unusual phenomenon in large bodies of water. Large rectangular-prism pockets of air may sometimes generate a few blocks on or under the ocean surface.

These appear when abandoned mineshafts have generated or attempted to generate under the ocean floor. The air pockets would have been filled by an "entrance" to the mineshaft had there been the right type of blocks there.

All structure generation is canceled by the presence of liquid within a component's bounding box, but the critical/initial parts do execute some generation routines. For example, the End portal room of a stronghold will generate wherever it tries to, though it might be alone if other potential components intersect standing liquids. Evidently, the block-clearance code for mineshafts executes before the liquid check, resulting in the strange air bubbles.

Friday, July 18, 2014

Resolving the Mysterious Minecraft Missing Texture Issue in Eclipse

I was doing a little bit of messing around on the Wither mod idea, and I ran into a very strange problem. I had added an item texture (than honestly looks pretty awful, but whatever) and registered it with the item, but it was not displaying in-game. Instead, I got the purple-and-black checkerboard of missing textureness. I consulted many tutorials; I had registered and placed it correctly.

No, the issue was something far more obscure. Since I had placed the PNG file manually in the src/main/resources/assets/<mod>/textures/items folder without having the package folder expanded in Eclipse, that resource was not copied into the temporary build directory. This is possibly the strangest of such systems I have ever seen from an IDE, but refreshing the Project Explorer (press F5 with it focused) fixed the problem. Yay, non-obvious and undocumented issues!

Monday, July 14, 2014

Minecraft Forge 1.7 - Setting up Networking Components (newEventDrivenChannel)

After core Minecraft changed to using Netty for its network operations, Forge's network model changed considerably. They did a great job changing it, but the full road to getting packet dispatching working is documented literally nowhere. The wiki tutorials that claim to be the new way all have a message from the Forge team telling people that they are wrong.

I think I've done a decent job figuring out what needs to happen, so I'll document it here. Yay, internet learning!

First, you'll need to register a packet channel. Unlike in the pre-1.7 days when you had to register a bunch of different channels for each packet type, we will differentiate them with a map of integers to packet subclasses. Declare an FMLEventChannel variable in your mod class, preferably static:

public static FMLEventChannel NetworkCon;

Then, in your mod's handler for FMLServerStartingEvent, register the channel and assign it to that variable, like this:

@EventHandler
public void serverLoad(FMLServerStartingEvent event) {
FMLEventChannel net = NetworkRegistry.INSTANCE.newEventDrivenChannel(MODID);
NetworkCon = net;
}

(Replace MODID with your mod's ID name or use a constant you defined already.) Now, create a class to hold event handlers related to networking, I'll call mine NetworkHandler.

public class NetworkHandler {
@SubscribeEvent
public void onServerPacket(ServerCustomPacketEvent e) {

}
@SubscribeEvent
public void onClientPacket(ClientCustomPacketEvent e) {

}
}


Register that class as a receiver for the channel. If you get an error on the registration later, annotate the NetworkHandler class with @Sharable. Place this in the handler for FMLServerStartingEvent:

net.register(new NetworkHandler());

It's now up to you to register your packet types, which will be in another article - or you could create your own implementation! You can send them with the obviously named methods in the channel object and handle them in the packet event handlers. On the server, you can get the player by casting e.handler to NetHandlerPlayServer and accessing playerEntity, which is not obvious at all. I have this little utility method:

private EntityPlayerMP getSendingPlayer(ServerCustomPacketEvent e) {
return ((NetHandlerPlayServer)e.handler).playerEntity;
}

Happy modding!

Sunday, July 13, 2014

The Wither Mod - v1.7.10

Today I noticed that Forge has a version for Minecraft 1.7.10, which is considerably newer than the 1.7.2 I had been developing for. So, I used the Gradle script to update to it, but then all the sounds (including vanilla's) were broken. Apparently, I need to provide an --assetsDir switch in the run configuration. After doing that, I tried to run the thing and immediately discovered that Forge had yet again changed and broken my mod (I don't know what I expected). The main issues here were that IEntityOwnable's ID system had changed from using names to UUIDs and that some things referenced by my DiscriminatingExplosion lost their nice names (went back to the obfuscated Searge names). I fixed all those things without much trouble.

Then, in an attempt to make the Wither more interesting, I did some more messing around with its AI tasks. Before, it would frequently get stuck on trees or otherwise find itself unable to get to its target. This was due to EntityAIArrowAttack exiting if the Wither's senses did not have a clear line of sight to the target. I removed that check, and owned Withers will now shoot through barriers to get to their target!

Saturday, July 12, 2014

The Wither Mod - Stronger Bond

In the three hours I had today between waking up after oversleeping and going to church, I did some more things in the Wither-taming mod which has yet to be named. (Internally, it's named "WitherWand" but that was the first thing I thought of when I needed a package ID, it will probably not be kept.) I did a lot of looking at the wolf class and some investigation of the AI task system to see how "actions" are assigned to entities and triggered.

I applied my trick of copy/pasting entire source files on a few AI classes (specifically FollowOwner, OwnerHurtByTarget, and OwnerHurtTarget) and then changing the types to work with my Wither class. Those AI tasks have been registered in my class, causing an owned Wither to follow (and teleport to, if necessary) its owner. In addition, the Wither will give attack priority to first entities that attack the owner, then entities that the owner attacks, then entities that attack the Wither, and finally whatever entities it finds around the world and decides to destroy.

There's one bug with this arrangement: as the Wither goes around attacking whatever it wants, it may leave the player's ownership range, causing it to teleport back, but then it continues trying to attack the entity. This results in a strange rubber-band effect. I will eventually fix this when the owner is allowed to give the Wither instructions (in this case, to not destroy everything).

Friday, July 11, 2014

The Wither Mod - Proof of Concept

Today, since I didn't have a lot of college work to do, I did some things on the Wither-taming mod I was thinking about making. I abandoned trying to subclass EntityWither and instead copy/pasted the whole class's code so I could have control over the private variables as well. To make that work, I had to do the same thing for the renderer and the render model, changing type names. (This will eventually have to happen for some AI tasks that take a class on a different hierarchy instead of an interface like they should.) Once it was all done, I could change things in all the methods I need to, specifically replacing EntityWitherSkull with my own DiscriminatingSkull.

With that done, I have completed the proof of concept! The resulting owned Wither will go destroy all creatures (and I mean all - I changed the selector) except its owner. If one of the skulls does hit the owner, its explosion will not damage him and a few seconds of Regeneration (instead of Wither) will be given. I also removed some checks for creature type, allowing the owned Withers to attack other Withers.

Thursday, July 10, 2014

Possibly a New Mod

I had a great idea for a Minecraft mod while trying to go to sleep last night. I personally think it would be pretty awesome to tame a Wither and have it follow you around, obeying your commands or possibly just destroying everything around while protecting you. I imagine carrying some sort of baton to point the Wither toward what needs to be destroying, feeding it some sort of arcane scroll to teach it new behaviors - maybe sacrificing its health to fill mine?

I was fairly busy with important college things today, but I started messing around with this idea. I opened up a new ForgeGradle installation and threw together some super-messy subclasses of the Wither, its skull projectile, and the explosion class. Right now, I'm just trying to get a Wither to spawn that remembers its owner and doesn't deal damage to it. This is currently not working, but I think I have a separate type of entity spawning (I really quickly made an item to produce one of these guardian Withers with the user set as the owner.) Strange Java behavior when shadowing variables has not helped debugging, and I still can't figure out why the projectiles are still damaging the owner - it did get registered correctly at the spawning.

Since this will be a very small project, it might be the first mod I actually finish!

Wednesday, July 9, 2014

Minecraft: Defeating a Rogue Wither

Everyone knows it's easy to defeat Minecraft's Wither boss if you build it in a claustrophobic space or fight it above the Nether. However, the Wither is much more of a challenge in the varied Overworld surface, where trees get in its way and passive mobs are around to get pummeled and regenerate its health. I, with my friends on the Bare Roots Server, are currently suffering major losses due to many deaths to one escaped Wither. Unfortunately, all our super-powerful gear has already been destroyed, so we need to do something different contain this guy.

I came up with a plan. It doesn't require lots of powerful diamond gear, but a decent supply of gunpowder. Here's the shopping list with recommended quantities:
  • 128 TNT
  • 27 normal bows
  • 64 arrows
  • 2 Ender pearls
  • 1 bed
  • 1 iron pick
  • 1 flint & steel
  • 2 players
  • 2 suits of iron armor
  • 1 normal iron sword
  • 1 good bow
  • 1 good sword
First, in a location somewhat far away from the Wither (it won't rage on you until you directly attack it), dig a 1x1 hole a decent way - say, 50 blocks - down and fill it with TNT. Light it, and get away. Then, at the bottom of the exploded hole, TNT out sideways, producing an artificial cavern. Optionally, light it up, but the lighting will probably get destroyed later. Set up a bed at the surface with the supply chests containing bows and the arrows. Optionally, protect it with cobble you got from the blast.

Now, for this next step, bring nothing but one bow and 2 or 3 arrows. Go shoot the Wither once or twice, just to get it following you. Jump (or Ender pearl, if you have a dispensable supply of them) down to the bottom, making sure the Wither is following. Try to lure it away from the surface opening, but you'll probably die pretty quickly. Repeat this paragraph until the Wither is underground in your artificial cave, a decent way (20 blocks?) away from the surface hole.

At this point, if you aren't confident enough to go in and fight it (or if you like to live dangerously with a Wither below you), you could seal the hole and not worry about it ever again. It will eventually break out (those blue skulls can do a lot over a period of time), but by then you'll probably be geared up.

Here, get the nice bow (optimally Power IV or above, Punch is nice too), put on the iron armor, prepare an iron sword, take some potions if you have them, and go down. Shoot the Wither as much as you can, then go in with the sword, but you're probably close to dead by now. Once you die, grab the other set of iron armor, the good sword, and a normal bow, and finish off the Wither with a sword.

Monday, July 7, 2014

Workaround for Slime Spawning Bug in Minecraft 14w21b

Minecraft 14w21b, the newest snapshot most server administrators trust to not ruin all the worlds, has one annoying bug: Slimes don't spawn. This is actually a really huge problem if you need sticky pistons, which are necessary for automation. Fortunately, using /summon to create Slimes still works.

So, you can use this fact to create an administrative contraption to simulate normal Slime spawning. Do something akin to this:

  • As a server operator, switch into Creative mode
  • Find an unobtrusive spot in a spawn chunk for a small box
  • Create a multiplicative hopper-dropper clock
  • Configure it to pulse every two hours (or whatever you'd like)
  • Hook it up to a command block with the following command:
    • /execute @e[type=Creeper] ~ ~ ~ /summon Slime ~ ~ ~
This command will spawn one Slime at each Creeper. You could change the type, but I recommend Creepers because they are only found in the Overworld and are not spawned from any spawners. So, with this device set up and operating in a spawn chunk on your server, you'll be able to hunt Slimes in a fashion similar to the non-bugged behavior.

Wednesday, May 28, 2014

Minecraft Bug MC-56023: "Server does not recognize disconnection after player entity duplicated"

I filed the following bug report on Mojang's bug tracker after losing all my stuff to its effects on the Bare Roots Server:

As is known by many, it is possible on SMP servers for the Respawn button to create multiple entities representing the player in latent connections.

Evidently, when the player disconnects, only the entity being controlled is destroyed; the other remains. However, the server does not count the player as disconnected; no "left the game" message is displayed to others.

When the player logs in again, he finds himself in the spot of the old duplicate (no matter where the controlled entity was when disconnection occurred) with an empty inventory. Other players do not receive connection notices and the player appears to have been online the whole time.
You can comment on and vote for the issue at its page.

Friday, November 29, 2013

FTB Unleashed - Tinker's Construct Smelting, Casts, and Patterns

Tinker's Construct is a remarkably well documented mod compared to most Minecraft mods, especially those in FTB. In fact, it even gives you pretty awesome in-game manuals. However, it took me forever to figure out what you actually have to do to get making custom tools.

As you probably gathered from the first in-game book, you need some workshop blocks. However, what you might not have understood is that, to start out, you just need a Stencil Table, Part Builder, and Tool Station. They're all just wood. Make a couple of spare blank patterns as well.

Shove a blank pattern in the Stencil Table and click Next and/or Previous until you find a fragment that looks useful (I recommend pickaxe head). Take it out. Shove that into a square slot in the Part Builder and some wood or cobble in the ingot-like slot. Take the new piece out. This does not work with metals. For metal, you need a Smeltery. You can do similar things using just this set-up to make pretty lame composite tools if you figure out the Tool Station. In the Tool Station, you click the type of tool you want to make on the left and then put in the components in the slots which will appear.

However, I think it's pretty easy to advance to the next stage: smelting. Gather a whole bunch of clay, sand, and gravel. Combine it into grout and smelt that into Seared Bricks. Create exactly 18 Seared Brick blocks, 1 Smeltery Controller, 1 Seared Tank, 1 Seared Faucet, 1 Smeltery Drain, and 1 Casting Table. Put a 3x3 square of the Seared Brick blocks on the ground to start. Then, up one level and not directly above the bricks, place the Controller, Tank, and Drain facing in. Complete a ring around the outside (corners unnecessary) with the rest of the bricks. Attach the Faucet to the outside of the Drain and place the Casting Table directly underneath it.

Once that's all done, grab a bucket of lava and use it on the Tank. It should light up the Controller as well. You now have a functional Smeltery! Now, find those tool parts you made earlier and right-click the Casting Table with one. It should insert itself. Pop in 2 gold ingots or 1 ore into the Controller and let it melt. Right-click the Faucet and the liquid should pour into the Table. If you've set things up correctly, it will cool after three seconds, producing a solid cast around the part. Pop both of them out, and you have a cast! I'm fairly certain you can just throw out the cheap part.

Now, it's time to make a part with metal. If your Smeltery still had liquid metal in it, break and replace the Controller. Casts must be filled with a different material than was used to make them. Put in metal of your choice (I did iron the first time). Pop the cast back into the Casting Table and, once the metal is liquid, right-click the Faucet. If it doesn't cool into the part after a few seconds, put in more metal. Once solid, pop both of them out and you have a metal part!

Once you've made enough parts for a tool, put them together in the Tool Station. You can also modify them there by adding unusual substances found in the second book you got.

Friday, September 27, 2013

Minecraft - Water Destroys End Portals

I recently and accidentally discovered that pouring a bucket of water onto the side of a block occupied by an End portal will destroy that part of the portal.  Fortunately, only source blocks can do this, but it was very terrifying to see one ninth of my access to the End erased.  I filed a bug report on Mojira, which will have the latest on this issue.

Friday, September 6, 2013

Forge - Correct Use of ResourceLocation

After Minecraft updated to version 1.6, Forge did some changes to the GUI texture loading.  Thankfully, it's considerably easier to bundle all manner of resources, but unfortunately more complicated to set up the addresses.  They reverted bindTexture to func_110577_a and changed its argument to a ResourceLocation instance.  Such an instance can be easily created with one or two strings.  Important note: You should use only the one-string constructor; the two-string one will only work when launching from Eclipse.  That string is of the format "modname:textures/gui/filename.png".  So, for my Absorber, I would create the ResourceLocation like so: "new ResourceLocation("higherpower:textures/gui/absorber.png)".  Notice that the mod ID is now required to be in all lowercase.  While developing, place your mod's assets folder under the src folder.

Tuesday, September 3, 2013

Forge - Sync Progress Bars

At the time you read this, I'll be thoroughly enjoying myself in a camp in northern Wisconsin.  Enjoy this scheduled post!

Synchronizing GUI progress bars between server and client may seem complicated at first, but it's actually very simple.  If you've set up a GUI renderer and container already, you're ready for this tutorial.

First, make sure the client-side tile entity isn't doing anything with progress bars besides having a variable for it.  Open up the container class and create some variables for the previous state of all the progress bars (like burn time and cooking progress).  Let's use ContainerFurnace to explain stuff.

public void addCraftingToCrafters(ICrafting par1ICrafting)
    {
        super.addCraftingToCrafters(par1ICrafting);
        par1ICrafting.sendProgressBarUpdate(this, 0, this.furnace.furnaceCookTime);
        par1ICrafting.sendProgressBarUpdate(this, 1, this.furnace.furnaceBurnTime);
        par1ICrafting.sendProgressBarUpdate(this, 2, this.furnace.currentItemBurnTime);
    }

The super call is necessary to sync inventory; the sendProgressBarUpdate calls are more interesting.  This is where the server tells the client what it knows about the GUI.  The numbers (0, 1, 2) are IDs of the progress bars and the final argument is the value of the progress bar as an integer (taken from the represented tile entity).

public void detectAndSendChanges()
    {
        super.detectAndSendChanges();
        for (int i = 0; i < this.crafters.size(); ++i)
        {
            ICrafting icrafting = (ICrafting)this.crafters.get(i);

            if (this.lastCookTime != this.furnace.furnaceCookTime)
            {
                icrafting.sendProgressBarUpdate(this, 0, this.furnace.furnaceCookTime);
            }

            if (this.lastBurnTime != this.furnace.furnaceBurnTime)
            {
                icrafting.sendProgressBarUpdate(this, 1, this.furnace.furnaceBurnTime);
            }

            if (this.lastItemBurnTime != this.furnace.currentItemBurnTime)
            {
                icrafting.sendProgressBarUpdate(this, 2, this.furnace.currentItemBurnTime);
            }
        }
        this.lastCookTime = this.furnace.furnaceCookTime;
        this.lastBurnTime = this.furnace.furnaceBurnTime;
        this.lastItemBurnTime = this.furnace.currentItemBurnTime;

    }

The loop iterates through all the crafters (the players viewing this container) and sends an update on any progress bars that have changed.  The calls are exactly the same as in addCraftingToCrafters.  After informing all the crafters, it updates its cache of the progress bar states from the tile entity.

@SideOnly(Side.CLIENT)
    public void updateProgressBar(int par1, int par2)
    {
        if (par1 == 0)
        {
            this.furnace.furnaceCookTime = par2;
        }
        if (par1 == 1)
        {
            this.furnace.furnaceBurnTime = par2;
        }
        if (par1 == 2)
        {
            this.furnace.currentItemBurnTime = par2;
        }

    }

This is where the client fixes its progress bars.  It receives the ID of the bar to update and the value.  With that, it decides which tile entity variable to set.

So there you go!  The GUI class does not need to be changed, it will reflect the tile entity's opinion on the progress bars, which is now in sync with the server.

Tuesday, August 27, 2013

HigherPower - Failure Reason Understood

I feel pretty silly now for spending hours on the silverfish block and the Configurable Switch.  I was trying to use these huge (well, medium-sized) numbers as metadata, but only four bits are stored in the chunk.  That definitely explains the strange failures of a few sides of the CS and the limitations of the silverfish block.  So, I guess I won't be using metadata to store complicated information.  I don't know what I'm going to do about the silverfish block (besides disable it), but I did change the CS to only be configurable on the horizontal sides; the top and bottom are inert.  Though inconvenient, it has the advantage of looking cool in the inventory.

I'm gonna save meta
Only got four bits of storage
I, I, I'm packing, trying to compact it
Why doesn't Forge fix this? ♪

Sunday, August 4, 2013

Minecraft - The SFMI Official Family-Friendly Language Pack

As of beta 1.9, Minecraft contains an item called the "enchantment table."  I recently constructed one of these in my Minecraft LP, "Search for Mushroom Island", to improve my tools.  However, I am a little bit conflicted over whether I should be using it due to the slight reference to the occult.  To remedy this situation and make the series completely family-friendly, I created a language pack that changes a few possibly objectionable texts.  I figured some parents might want to use it for their younger children, so I put up a download with some instructions to install it with Minecraft 1.6's Resource Pack system.

Download the official Search for Mushroom Island Family-Friendly Resix
Installation Instructions for Non-Technical Parents

Tuesday, July 30, 2013

YouTube Re-entry Time (Also, "How to Fix Your Snowball")

Something I did today made my Blue Snowball compatible with Windows 8!  If you are experiencing a Code 10 with your Snowball, here are some things to try:

  • Reboot the computer.  Seriously, sometimes Windows needs to do something with its drivers that is only possible at start-up.
  • Ensure that the USB plug that goes in the microphone has the USB symbol on top.  It is possible to insert the cable incorrectly into the Snowball.  (Guess how I learned that bit of trivia.)
  • Plug the other end of the USB cable into its own USB Root Hub on the computer.  Blue states that Snowball microphones draw so much power that they need their own hub.
  • If you see an Unknown Device in Device Manager, uninstall its driver and "Scan for hardware changes."  A restart may be required after a driver uninstall.
  • Download and install all Windows updates, including optional ones.  Windows Update can be accessed in Windows 8 under the Metro Control Panel.
  • Run "Update driver" on any microphone in Device Manager.  A device is considered a microphone if it contains an Audio Endpoint.  If the driver installation takes more than ten minutes, cancel it with Task Manager despite warnings.  It is likely that the installation has hung after succeeding.
Since I now have a professional-grade microphone, I will be able to easily record Minecraft again.  One of my friends has Fraps and is allowing me to share the license, an activity which is allowed for co-op partners.

Tuesday, July 16, 2013

FTB: Random Junk Factory

In my (little amount) of free time today, I constructed a factory in FTB that outputs essentially useless stuff (like from a scrapbox).  Basically, it feeds massive amounts of cobblestone from Igneous Extruders into Recyclers which produce scrap.  The scrap is then packaged into scrapboxes which are unpacked by a dispenser and sorted in a series of diamond pipes.  I know RedPower pipes can do this automatically, but I need to use my insane amount of diamonds (from the Wither Skeleton grinder) for something.

The Recyclers and Igneous Extruders (12) each

Transposers and a timer to pull the scrap out

The packager (autocrafter) and the unpacker (dispenser and obsidian pipe)

Storage line with about 40 barrels
It cost a lot of iron (more than two stacks) and wood (more logs than I care to ever see again) in addition to a few diamonds (20).  I should mention that I fed all scrap back into the autocrafter -- silly GregTech "rebalancing" making scrapboxes create scrap most of the time.  I don't think this setup will ever pay back the materials I used to make it, but it's definitely fun to run down the Hall of Miscellaneous Junk.