Compare commits

...

3 Commits

Author SHA1 Message Date
Forstride 1cb0e8008f Update ItemMudball.java 2016-08-11 18:03:51 -04:00
Forstride e49990e15b Merge pull request #826 from blay09/fix-trees
Fix spawning of trees on newer versions of Forge
2016-08-08 16:36:29 -04:00
Blay09 e5569f9090 Switch GeneratorStage to an EnumMap to provide forwards-compatibility (fixes spawning of trees on newer versions of Forge).
Fixes #818
2016-08-08 22:29:08 +02:00
2 changed files with 27 additions and 6 deletions

View File

@ -8,10 +8,13 @@
package biomesoplenty.api.generation;
import com.google.common.collect.Maps;
import com.google.gson.annotations.SerializedName;
import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate;
import java.util.EnumMap;
public enum GeneratorStage
{
@SerializedName("pre")
@ -66,10 +69,29 @@ public enum GeneratorStage
{
return this.decorateType;
}
private static final EnumMap<Decorate.EventType, GeneratorStage> decorateTypeMapper = Maps.newEnumMap(Decorate.EventType.class);
static
{
decorateTypeMapper.put(Decorate.EventType.BIG_SHROOM, BIG_SHROOM);
decorateTypeMapper.put(Decorate.EventType.CACTUS, CACTUS);
decorateTypeMapper.put(Decorate.EventType.CLAY, CLAY);
decorateTypeMapper.put(Decorate.EventType.DEAD_BUSH, DEAD_BUSH);
decorateTypeMapper.put(Decorate.EventType.LILYPAD, LILYPAD);
decorateTypeMapper.put(Decorate.EventType.FLOWERS, FLOWERS);
decorateTypeMapper.put(Decorate.EventType.GRASS, GRASS);
decorateTypeMapper.put(Decorate.EventType.LAKE_WATER, LAKE_WATER);
decorateTypeMapper.put(Decorate.EventType.LAKE_LAVA, LAKE_LAVA);
decorateTypeMapper.put(Decorate.EventType.PUMPKIN, PUMPKIN);
decorateTypeMapper.put(Decorate.EventType.REED, REED);
decorateTypeMapper.put(Decorate.EventType.SAND, SAND);
decorateTypeMapper.put(Decorate.EventType.SAND_PASS2, SAND_PASS2);
decorateTypeMapper.put(Decorate.EventType.SHROOM, SHROOM);
decorateTypeMapper.put(Decorate.EventType.TREE, TREE);
}
public static GeneratorStage mapDecorateType(Decorate.EventType decorateType)
{
//Somewhat of a hack, requires the ordering of our enum to be the same as the decorate event
return decorateType != Decorate.EventType.CUSTOM ? GeneratorStage.values()[decorateType.ordinal() + 1] : null;
return decorateType != Decorate.EventType.CUSTOM ? decorateTypeMapper.get(decorateType) : null;
}
}

View File

@ -41,12 +41,11 @@ public class ItemMudball extends Item
if (!world.isRemote)
{
EntityMudball mudball = new EntityMudball(world, player);
//TODO: replace this
//mudball.func_184538_a(player, player.rotationPitch, player.rotationYaw, 0.0F, 1.5F, 1.0F);
mudball.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, 0.0F, 1.5F, 1.0F);
world.spawnEntityInWorld(mudball);
}
player.addStat(StatList.getObjectUseStats(this));
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
}
}
}