More work on in world Red Water effects

This commit is contained in:
pahimar 2012-08-03 15:33:48 -04:00
parent dbad48245d
commit 2f68680f04
10 changed files with 139 additions and 15 deletions

View file

@ -0,0 +1,44 @@
package ee3.block;
import java.util.ArrayList;
import ee3.lib.Reference;
import net.minecraft.src.BlockLog;
import net.minecraft.src.IBlockAccess;
import net.minecraft.src.ItemStack;
public class BlockCorruptedLog extends BlockLog {
protected BlockCorruptedLog(int id) {
super(id);
}
public int getBlockColor() {
return Integer.parseInt(Reference.hexRedWaterCorruptionOverlayColor, 16);
}
/**
* Returns the color this block should be rendered. Used by leaves.
*/
public int getRenderColor(int par1) {
return Integer.parseInt(Reference.hexRedWaterCorruptionOverlayColor, 16);
}
/**
* Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called
* when first determining what to render.
*/
public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
return Integer.parseInt(Reference.hexRedWaterCorruptionOverlayColor, 16);
}
@Override
public void addCreativeItems(ArrayList itemList) {
itemList.add(new ItemStack(this, 1, 0));
itemList.add(new ItemStack(this, 1, 1));
itemList.add(new ItemStack(this, 1, 2));
itemList.add(new ItemStack(this, 1, 3));
}
}

View file

@ -0,0 +1,32 @@
package ee3.block;
import ee3.lib.Reference;
import net.minecraft.src.BlockSapling;
import net.minecraft.src.IBlockAccess;
public class BlockCorruptedSapling extends BlockSapling {
protected BlockCorruptedSapling(int par1) {
super(par1, 15);
}
public int getBlockColor() {
return Integer.parseInt(Reference.hexRedWaterCorruptionOverlayColor, 16);
}
/**
* Returns the color this block should be rendered. Used by leaves.
*/
public int getRenderColor(int par1) {
return Integer.parseInt(Reference.hexRedWaterCorruptionOverlayColor, 16);
}
/**
* Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called
* when first determining what to render.
*/
public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
return Integer.parseInt(Reference.hexRedWaterCorruptionOverlayColor, 16);
}
}

View file

@ -16,10 +16,15 @@ public class BlockEE extends BlockContainer {
protected BlockEE(int i) {
super(i, Material.rock);
}
@Override
public TileEntity getBlockEntity() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getBlockName() {
return "Test";
}
}

View file

@ -1,9 +1,15 @@
package ee3.block;
import java.util.ArrayList;
import java.util.Random;
import ee3.lib.Reference;
import net.minecraft.src.Block;
import net.minecraft.src.BlockFlowing;
import net.minecraft.src.BlockFluid;
import net.minecraft.src.ItemStack;
import net.minecraft.src.Material;
import net.minecraft.src.World;
public class BlockRedWaterFlowing extends BlockFlowing {
@ -18,5 +24,9 @@ public class BlockRedWaterFlowing extends BlockFlowing {
public String getTextureFile() {
return Reference.SPRITE_SHEET_LOCATION + Reference.BLOCK_SPRITE_SHEET;
}
@Override
public void addCreativeItems(ArrayList itemList) {
itemList.add(new ItemStack(this));
}
}

View file

@ -1,5 +1,7 @@
package ee3.block;
import java.util.ArrayList;
import ee3.core.helper.LocalizationHelper;
import ee3.lib.Reference;
import net.minecraft.src.BlockStationary;
@ -18,14 +20,13 @@ public class BlockRedWaterStill extends BlockStationary {
setRequiresSelfNotify();
}
@Override
public String getBlockName() {
return LocalizationHelper.instance.get("tile.redWaterStill");
}
@Override
public String getTextureFile() {
return Reference.SPRITE_SHEET_LOCATION + Reference.BLOCK_SPRITE_SHEET;
}
@Override
public void addCreativeItems(ArrayList itemList) {
itemList.add(new ItemStack(this));
}
}

View file

@ -1,6 +1,8 @@
package ee3.block;
import net.minecraft.src.Block;
import net.minecraft.src.Item;
import net.minecraft.src.ItemMetadata;
import net.minecraft.src.ItemStack;
import net.minecraft.src.Material;
import net.minecraft.src.ModLoader;
@ -16,20 +18,32 @@ public class ModBlocks {
public static BlockRedWaterStill redWaterStill;
public static BlockRedWaterFlowing redWaterFlowing;
public static BlockCorruptedLog corruptedLog;
public static BlockCorruptedSapling corruptedSapling;
public static void init() {
redWaterStill = new BlockRedWaterStill(BlockIds.RED_WATER_STILL, Material.water);
redWaterFlowing = new BlockRedWaterFlowing(BlockIds.RED_WATER_STILL - 1, Material.water);
corruptedLog = new BlockCorruptedLog(250);
corruptedSapling = new BlockCorruptedSapling(251);
redWaterStill.setBlockName("redWaterStill");
redWaterFlowing.setBlockName("redWaterFlowing");
corruptedLog.setBlockName("corruptedLog");
corruptedSapling.setBlockName("corruptedSapling");
ModLoader.addName(redWaterStill, "Red Water (Still)");
ModLoader.addName(redWaterFlowing, "Red Water (Flowing)");
ModLoader.addName(corruptedLog, "Corrupted Wood");
ModLoader.addName(corruptedSapling, "Corrupted Sapling");
ModLoader.registerBlock(redWaterStill);
ModLoader.registerBlock(redWaterFlowing);
ModLoader.registerBlock(corruptedLog);
ModLoader.registerBlock(corruptedSapling);
ModLoader.addShapelessRecipe(new ItemStack(redWaterStill), Block.cobblestone);
ModLoader.addShapelessRecipe(new ItemStack(redWaterFlowing), Block.cobblestone, Block.cobblestone);
Item.itemsList[corruptedLog.blockID] = (new ItemMetadata(corruptedLog.blockID - 256, corruptedLog)).setItemName("log");
}
}

View file

@ -36,12 +36,10 @@ public class EntityLivingHandler extends EntityLivingHandlerAdaptor {
public boolean onEntityLivingUpdate(EntityLiving entity) {
if (entity.worldObj.getWorldTime() % 4 == 0) {
if (Helper.handleRedWaterDetection(entity)) {
if (entity instanceof EntityPlayer) {
entity.addPotionEffect(new PotionEffect(Potion.weakness.id, Reference.BLOCK_RED_WATER_EFFECT_DURATION_MODIFIER * Reference.BLOCK_RED_WATER_EFFECT_DURATION_BASE * Reference.SECOND_IN_TICKS, 0));
entity.addPotionEffect(new PotionEffect(Potion.poison.id, Reference.BLOCK_RED_WATER_EFFECT_DURATION_MODIFIER * Reference.BLOCK_RED_WATER_EFFECT_DURATION_BASE * Reference.SECOND_IN_TICKS, 0));
entity.addPotionEffect(new PotionEffect(Potion.blindness.id, Reference.BLOCK_RED_WATER_EFFECT_DURATION_MODIFIER * Reference.BLOCK_RED_WATER_EFFECT_DURATION_BASE * Reference.SECOND_IN_TICKS, 0));
entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, Reference.BLOCK_RED_WATER_EFFECT_DURATION_MODIFIER * Reference.BLOCK_RED_WATER_EFFECT_DURATION_BASE * Reference.SECOND_IN_TICKS, 0));
}
entity.addPotionEffect(new PotionEffect(Potion.weakness.id, Reference.BLOCK_RED_WATER_EFFECT_DURATION_MODIFIER * Reference.BLOCK_RED_WATER_EFFECT_DURATION_BASE * Reference.SECOND_IN_TICKS, 0));
entity.addPotionEffect(new PotionEffect(Potion.poison.id, Reference.BLOCK_RED_WATER_EFFECT_DURATION_MODIFIER * Reference.BLOCK_RED_WATER_EFFECT_DURATION_BASE * Reference.SECOND_IN_TICKS, 0));
entity.addPotionEffect(new PotionEffect(Potion.blindness.id, Reference.BLOCK_RED_WATER_EFFECT_DURATION_MODIFIER * Reference.BLOCK_RED_WATER_EFFECT_DURATION_BASE * Reference.SECOND_IN_TICKS, 0));
entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, Reference.BLOCK_RED_WATER_EFFECT_DURATION_MODIFIER * Reference.BLOCK_RED_WATER_EFFECT_DURATION_BASE * Reference.SECOND_IN_TICKS, 0));
}
}
return false;

View file

@ -0,0 +1,15 @@
package ee3.item;
import net.minecraft.src.ItemSapling;
public class ItemCorruptedSapling extends ItemSapling {
public ItemCorruptedSapling(int par1) {
super(par1);
}
public int getColorFromDamage(int par1, int par2) {
return Integer.parseInt("A5162E", 16);
}
}

View file

@ -3,6 +3,7 @@ package ee3.item;
import ee3.lib.ItemIds;
import net.minecraft.src.Block;
import net.minecraft.src.Item;
import net.minecraft.src.ItemSapling;
import net.minecraft.src.ItemStack;
import net.minecraft.src.ModLoader;
@ -27,5 +28,7 @@ public class ModItems {
ModLoader.addShapelessRecipe(new ItemStack(miniumStone), Block.dirt);
ModLoader.addShapelessRecipe(new ItemStack(philStone), Block.dirt, Block.dirt);
}
}

View file

@ -27,6 +27,8 @@ public class Reference {
public static final int SECOND_IN_TICKS = 20;
public static final String hexRedWaterCorruptionOverlayColor = "A5162E";
public static final int MINIUM_STONE_DURABILITY = 1531;
public static final int MINIUM_STONE_TRANSMUTE_COST = 4;