Added the Vinculotus.

This commit is contained in:
Vasco Lavos committed 2014-07-15 17:46:30 +01:00
1 parent b49cf36228
commit 47d0f29ea0
6 files changed
+92 -2

No files matched your search

@@ -86,7 +86,8 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
LibBlockNames.SUBTILE_POLLIDISIAC,
LibBlockNames.SUBTILE_CLAYCONIA,
LibBlockNames.SUBTILE_LOONIUM,
LibBlockNames.SUBTILE_DAFFOMILL
LibBlockNames.SUBTILE_DAFFOMILL,
LibBlockNames.SUBTILE_VINCULOTUS
}));
}
@@ -66,6 +66,7 @@ import vazkii.botania.common.block.subtile.functional.SubTilePollidisiac;
import vazkii.botania.common.block.subtile.functional.SubTileRannuncarpus;
import vazkii.botania.common.block.subtile.functional.SubTileTangleberrie;
import vazkii.botania.common.block.subtile.functional.SubTileTigerseye;
import vazkii.botania.common.block.subtile.functional.SubTileVinculotus;
import vazkii.botania.common.block.subtile.functional.SubtileOrechid;
import vazkii.botania.common.block.subtile.generating.SubTileArcaneRose;
import vazkii.botania.common.block.subtile.generating.SubTileDaybloom;
@@ -396,6 +397,7 @@ public final class ModBlocks {
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_CLAYCONIA, SubTileClayconia.class);
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_LOONIUM, SubTileLoonuim.class);
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_DAFFOMILL, SubTileDaffomill.class);
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_VINCULOTUS, SubTileVinculotus.class);
}
private static void registerTile(Class<? extends TileEntity> clazz, String key) {
@@ -0,0 +1,85 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Jul 15, 2014, 4:30:08 PM (GMT)]
*/
package vazkii.botania.common.block.subtile.functional;
import java.util.Collections;
import java.util.Set;
import java.util.WeakHashMap;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
import vazkii.botania.api.subtile.SubTileFunctional;
import vazkii.botania.common.core.helper.MathHelper;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class SubTileVinculotus extends SubTileFunctional {
public static Set<SubTileVinculotus> existingFlowers = Collections.newSetFromMap(new WeakHashMap());
private static boolean registered = false;
@Override
public void onUpdate() {
super.onUpdate();
if(!existingFlowers.contains(this)) {
existingFlowers.add(this);
if(!registered) {
MinecraftForge.EVENT_BUS.register(new EndermanIntercepter());
registered = true;
}
}
}
@Override
public int getColor() {
return 0x0A6051;
}
@Override
public int getMaxMana() {
return 500;
}
public static class EndermanIntercepter {
@SubscribeEvent
public void onEndermanTeleport(EnderTeleportEvent event) {
if(event.entity.worldObj.isRemote)
return;
int cost = 50;
int range = 64;
if(event.entity instanceof EntityEnderman) {
for(SubTileVinculotus flower : existingFlowers) {
if(flower.mana <= cost)
continue;
double x = flower.supertile.xCoord + 0.5;
double y = flower.supertile.yCoord + 1.5;
double z = flower.supertile.zCoord + 0.5;
if(MathHelper.pointDistanceSpace(x, y, z, event.targetX, event.targetY, event.targetZ) < range) {
event.targetX = x + Math.random() * 3 - 1;
event.targetY = y;
event.targetZ = z + Math.random() * 3 - 1;
flower.mana -= cost;
flower.sync();
}
}
}
}
}
}
@@ -32,5 +32,4 @@ public final class ChestGenHandler {
ChestGenHooks.addItem(c, new WeightedRandomChestContent(new ItemStack(ModItems.manaBottle), 1, 1, 5));
}
}
@@ -82,6 +82,7 @@ public final class LibBlockNames {
public static final String SUBTILE_CLAYCONIA = "clayconia";
public static final String SUBTILE_LOONIUM = "loonium";
public static final String SUBTILE_DAFFOMILL = "daffomill";
public static final String SUBTILE_VINCULOTUS = "vinculotus";
public static final String QUARTZ_DARK = "Dark";
public static final String QUARTZ_MANA = "Mana";
+2
View File
@@ -415,6 +415,8 @@ tile.botania:flower.loonium.name=Loonium
tile.botania:flower.loonium.reference=Hold it up above your head
tile.botania:flower.daffomill.name=Daffomill
tile.botania:flower.daffomill.reference=Cook's Assistant
tile.botania:flower.vinculotus.name=Vinculotus
tile.botania:flower.vinculotus.reference=Totally an Extra Utils ripoff
# ITEM NAMES
item.botania:lexicon.name=Lexica Botania