More work on Red Water, now it does some significant not-niceness to entities
This commit is contained in:
parent
764737a1c4
commit
19a261ce18
|
@ -1,11 +1,12 @@
|
|||
package ee3.block;
|
||||
|
||||
import ee3.lib.Reference;
|
||||
import net.minecraft.src.BlockFlowing;
|
||||
import net.minecraft.src.BlockFluid;
|
||||
import net.minecraft.src.Material;
|
||||
|
||||
public class BlockRedWaterFlowing extends BlockFluid {
|
||||
|
||||
public class BlockRedWaterFlowing extends BlockFlowing {
|
||||
|
||||
protected BlockRedWaterFlowing(int id, Material material) {
|
||||
super(id, material);
|
||||
this.blockHardness = 100F;
|
||||
|
|
|
@ -29,4 +29,9 @@ public class BlockRedWaterStill extends BlockStationary {
|
|||
return Reference.SPRITE_SHEET_LOCATION + Reference.BLOCK_SPRITE_SHEET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public class ModBlocks {
|
|||
public static void init() {
|
||||
|
||||
redWaterStill = new BlockRedWaterStill(BlockIds.RED_WATER_STILL, Material.water);
|
||||
redWaterFlowing = new BlockRedWaterFlowing(BlockIds.RED_WATER_STILL + 1, Material.water);
|
||||
redWaterFlowing = new BlockRedWaterFlowing(BlockIds.RED_WATER_STILL - 1, Material.water);
|
||||
|
||||
ModLoader.addName(redWaterStill, "Red Water (Still)");
|
||||
ModLoader.addName(redWaterFlowing, "Red Water (Flowing)");
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
package ee3.core;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import ee3.block.ModBlocks;
|
||||
import ee3.core.helper.Helper;
|
||||
import ee3.lib.Reference;
|
||||
|
||||
import net.minecraft.src.DamageSource;
|
||||
import net.minecraft.src.EntityLiving;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.Potion;
|
||||
import net.minecraft.src.PotionEffect;
|
||||
import net.minecraft.src.forge.adaptors.EntityLivingHandlerAdaptor;
|
||||
|
||||
/**
|
||||
|
@ -22,4 +30,15 @@ public class EntityLivingHandler extends EntityLivingHandlerAdaptor {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onEntityLivingUpdate(EntityLiving entity) {
|
||||
if (Helper.handleRedWaterMovement(entity)) {
|
||||
entity.addPotionEffect(new PotionEffect(Potion.weakness.id, Reference.BLOCK_RED_WATER_EFFECT_DURATION * 20, 0));
|
||||
entity.addPotionEffect(new PotionEffect(Potion.poison.id, Reference.BLOCK_RED_WATER_EFFECT_DURATION * 20, 0));
|
||||
entity.addPotionEffect(new PotionEffect(Potion.blindness.id, Reference.BLOCK_RED_WATER_EFFECT_DURATION * 20, 0));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,13 +7,18 @@ import ee3.addons.BuildCraftAddon;
|
|||
import ee3.addons.ForestryAddon;
|
||||
import ee3.addons.IndustrialCraftAddon;
|
||||
import ee3.addons.RedPowerAddon;
|
||||
import ee3.block.ModBlocks;
|
||||
import ee3.lib.Reference;
|
||||
|
||||
import net.minecraft.src.AxisAlignedBB;
|
||||
import net.minecraft.src.BaseMod;
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.EntityLiving;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.MathHelper;
|
||||
import net.minecraft.src.ModLoader;
|
||||
import net.minecraft.src.World;
|
||||
|
||||
/**
|
||||
* TODO Class Description
|
||||
|
@ -78,5 +83,29 @@ public class Helper {
|
|||
ModLoader.getLogger().finer(getLogMessage("No addons for loaded mods found"));
|
||||
}
|
||||
|
||||
public static boolean handleRedWaterMovement(EntityLiving entity) {
|
||||
return (isBlockInBB(entity.worldObj, entity.boundingBox.expand(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), ModBlocks.redWaterFlowing) || isBlockInBB(entity.worldObj, entity.boundingBox.expand(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), ModBlocks.redWaterStill));
|
||||
}
|
||||
|
||||
public static boolean isBlockInBB(World world, AxisAlignedBB par1AxisAlignedBB, Block block) {
|
||||
int var3 = MathHelper.floor_double(par1AxisAlignedBB.minX);
|
||||
int var4 = MathHelper.floor_double(par1AxisAlignedBB.maxX + 1.0D);
|
||||
int var5 = MathHelper.floor_double(par1AxisAlignedBB.minY);
|
||||
int var6 = MathHelper.floor_double(par1AxisAlignedBB.maxY + 1.0D);
|
||||
int var7 = MathHelper.floor_double(par1AxisAlignedBB.minZ);
|
||||
int var8 = MathHelper.floor_double(par1AxisAlignedBB.maxZ + 1.0D);
|
||||
|
||||
for (int var9 = var3; var9 < var4; ++var9) {
|
||||
for (int var10 = var5; var10 < var6; ++var10) {
|
||||
for (int var11 = var7; var11 < var8; ++var11) {
|
||||
Block var12 = Block.blocksList[world.getBlockId(var9, var10, var11)];
|
||||
if (var12 != null && var12.blockID == block.blockID) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,4 +31,6 @@ public class Reference {
|
|||
public static final String ITEM_NAME_MINIUM_SHARD = "item.name.minium_shard";
|
||||
public static final String ITEM_NAME_MINIUM_STONE = "item.name.minium_stone";
|
||||
public static final String ITEM_NAME_PHILOSOPHERS_STONE = "item.name.philosophers_stone";
|
||||
|
||||
public static final int BLOCK_RED_WATER_EFFECT_DURATION = 30;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue