shadowmage45 / AncientWarfare

Updated Ancient Warfare mod for Minecraft 1.5.2+
http://ancientwarfare.wikispaces.com/
Other
10 stars 8 forks source link

The battering ram can break bedrock #11

Closed TechStack closed 10 years ago

TechStack commented 10 years ago

Battering rams can break bedrock blocks

I checked the code and see in the BatteringRamVarHelper.doDamageEffects() method its setting the effected Positions to air without a checking the existing blocktype first. eg: vehicle.worldObj.setBlockToAir(pos.x, pos.y, pos.z);

Checking the block durability may be better yet in cases where someone wants to add another mod with unbreakable blocks

shadowmage45 commented 10 years ago

Yes, at some point in the future I would like to add more proper support for other mods' unbreakable blocks -- however I'm still trying to figure out a way without special-casing everything depending upon the mods installed. However, this fix should solve the immediate bedrock-breaking issue for battering rams -- I believe other ammunitions already have bedrock validation code in place.

TechStack commented 10 years ago

In my previous testing weapons like the trebuchet were not able to break bedrock.

I'm just diving into the Modding myself but I thought I read somewhere that a block durability of -1 would indicate it is unbreakable. Then again not every modder would use the same method.

shadowmage45 commented 10 years ago

You are correct in that a hardness setting of -1 == unbreakable. (in fact, calling block.setUnbreakable() merely sets the hardness to -1 for that block).

I will consider altering this in the near future to check block hardness directly -- though you are also correct that not every mod/modder would probably be using the setting (or using it correctly). Still, it sounds like the proper way of handling it (by checking the hardness).

I'm also considering hooking in to other block-protection schemes (most likely using FakePlayers), but am still a bit unsure as to the exact implementation I will need.