Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 34 additions & 8 deletions java/werty/hardcoreexpanded/main/BlockAltar.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,19 @@
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import javax.annotation.Nullable;

public class BlockAltar extends Block
{
Expand All @@ -20,26 +28,44 @@ public BlockAltar(Material materialIn)
}

@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
{
if(!worldIn.isRemote)
{
NBTTagCompound nbt = NBTHelper.getPersistedPlayerTag(playerIn);
if(nbt.getBoolean("ghost") == true)
if(nbt.getBoolean("ghost"))
{
worldIn.addWeatherEffect(new EntityLightningBolt(worldIn, pos.getX(), pos.getY(), pos.getZ()));
worldIn.addWeatherEffect(new EntityLightningBolt(worldIn, pos.getX(), pos.getY(), pos.getZ(), false));
worldIn.destroyBlock(pos, false);
nbt.setBoolean("ghost", false);
playerIn.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(Config.healthStarting);
playerIn.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(Config.healthStarting);
nbt.setDouble("health", playerIn.getMaxHealth());
playerIn.addChatMessage(new ChatComponentText("You feel the altar pull you back from the dead!"));
playerIn.addChatMessage(new TextComponentString("You feel the altar pull you back from the dead!"));
}
else
{
playerIn.addChatMessage(new ChatComponentText("you can feel a strange presence"));
playerIn.addChatMessage(new TextComponentString("you can feel a strange presence"));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
playerIn.addChatMessage(new TextComponentString("you can feel a strange presence"));
playerIn.addChatMessage(new TextComponentString("You can feel a strange presence."));

}
}
return true;
}

@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer() {return BlockRenderLayer.CUTOUT;}

@Override
public boolean isOpaqueCube(IBlockState iBlockState) {
return false;
}

@Override
public boolean isFullCube(IBlockState iBlockState) {
return false;
}

@Override
public EnumBlockRenderType getRenderType(IBlockState iBlockState) {
return EnumBlockRenderType.MODEL;
}

}
21 changes: 9 additions & 12 deletions java/werty/hardcoreexpanded/main/Config.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package werty.hardcoreexpanded.main;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import net.minecraft.block.Block;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

Expand All @@ -25,7 +22,7 @@ public class Config
public static boolean ghostMode;
public static boolean checkForUpdates;
public static boolean healthEffects;
public static boolean fiilEffects;
public static boolean fillEffects;
public static boolean ghostInvisibility;
public static boolean ghostFillHeart;
public static boolean genGhostAltar;
Expand All @@ -35,33 +32,33 @@ public class Config
public static String interactableBlocks;
public static String breakableBlocks;
public static String usableItems;

public static void configInit(FMLPreInitializationEvent event)
{
Configuration config = new Configuration(new File("config/SofterHardcore.cfg"));
config.load();
healthStarting = config.get("Mechanics", "StartingHealth", 20D, "Starting health. Vanilla is 20").getDouble();
healthMax = config.get("Mechanics", "MaxHealth", 20D, "Max health. Vanilla is 20").getDouble();
sicknessTicks = config.get("Mechanics", "SicknessTicks", 12000, "How long the sickness will last 12000 = 10 minutes").getInt();
deathAmount = config.get("Mechanics", "DeathAmount", 2D, "Amount of healh taken on death").getDouble();
deathAmount = config.get("Mechanics", "DeathAmount", 2D, "Amount of health taken on death").getDouble();
damageBoost = config.get("Mechanics", "DamageBoost", 2, "Damage boost added to monsters").getInt();
healthXP = config.get("Mechanics", "ExperienceForHeart", 10, "Experience level needed to fill a heart").getInt();
ghostMode = config.get("Mechanics", "GhostMode", true, "If player will spawn with debuffs").getBoolean();
fiilEffects = config.get("Mechanics", "HeartFillEffects", true, "If player suffer temp. Debuff on filling up a heart").getBoolean();
fillEffects = config.get("Mechanics", "HeartFillEffects", true, "If player suffer temp. Debuff on filling up a heart").getBoolean();
ghostInvisibility = config.get("Mechanics", "GhostInvisibility", true, "Gain Invisibility as a ghost").getBoolean();
checkForUpdates = config.get("Mechanics", "CheckForUpdates", true, "Should mod check for updates?").getBoolean();
ghostFillHeart = config.get("Mechanics", "GhostHeartFill", false, "Can ghost players fill hearts?").getBoolean();
healthEffects = config.get("Mechanics", "HealthEffects", true, "Debuffs on thresholds at 1/2 and 1/3 health and a damage boost at full health").getBoolean();
woodenToolDamage = config.get("Mechanics", "WoodenToolDamage", false, "Should wooden tools do damage").getBoolean();

interactableBlocks = config.get("Ghost", "GhostInteractableBlocks", "modid:blockid", "Blocks ghost players can interact with using right click. Add blocks seperated with a , and using ModID:BlockID").getString();
breakableBlocks = config.get("Ghost", "GhostBreakableBlocks", "modid:blockid", "Blocks ghost players can break with. Add blocks seperated with a , and using ModID:BlockID").getString();
usableItems = config.get("Ghost", "GhostUsableItems", "modid:itemid", "Items ghost players can pick up and use. Add items seperated with a , and using ModID:itemID").getString();
interactableBlocks = config.get("Ghost", "GhostInteractableBlocks", "modid:blockid", "Blocks ghost players can interact with using right click. Add blocks separated with a , and using ModID:BlockID").getString();
breakableBlocks = config.get("Ghost", "GhostBreakableBlocks", "modid:blockid", "Blocks ghost players can break with. Add blocks separated with a , and using ModID:BlockID").getString();
usableItems = config.get("Ghost", "GhostUsableItems", "modid:itemid", "Items ghost players can pick up and use. Add items separated with a , and using ModID:itemID").getString();

genGhostAltar = config.get("World", "GenGhostAltar", true, "Should ghost altars generate?").getBoolean();
altarGenChance = config.get("World", "GhostAltarChance", 5, "Ghost altar generation chance").getInt();
altarGenChance = config.get("World", "GhostAltarChance", 10, "Ghost altar generation chance").getInt();

mobEffects = config.get("Mobs", "MobEffects", true, "Should mobs have a chance to cause debuffs? Set to fale to disable all effects under mobs").getBoolean();
mobEffects = config.get("Mobs", "MobEffects", true, "Should mobs have a chance to cause debuffs? Set to false to disable all effects under mobs").getBoolean();
zombiePoisonChance = config.get("Mobs", "ZombiePoisonChance", 20, "Zombie poison chance. Set to 0 to disable").getInt();
fallStunChance = config.get("Mobs", "FallStunChance", 15, "Chance to be stunned on fall damage. Set to 0 to disable").getInt();
config.save();
Expand Down
4 changes: 2 additions & 2 deletions java/werty/hardcoreexpanded/main/HEBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;
Expand All @@ -14,7 +14,7 @@ public class HEBlocks

public static void init()
{
ghostAltar = new BlockAltar(Material.rock).setBlockUnbreakable().setUnlocalizedName("ghost_altar").setCreativeTab(CreativeTabs.tabMisc);
ghostAltar = new BlockAltar(Material.ROCK).setBlockUnbreakable().setUnlocalizedName("ghost_altar").setCreativeTab(CreativeTabs.MISC);

register(ghostAltar);
}
Expand Down
Loading