Add permafrost spell and fix dry frosted ice not being very icy

This commit is contained in:
Electroblob77
2020-10-23 01:22:28 +01:00
parent e530695f54
commit 29617451d8
14 changed files with 209 additions and 7 deletions
@@ -1,6 +1,8 @@
package electroblob.wizardry.block;
import net.minecraft.block.BlockFrostedIce;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
@@ -12,6 +14,17 @@ import java.util.Random;
* disappears instead of turning to water. */
public class BlockDryFrostedIce extends BlockFrostedIce {
public BlockDryFrostedIce(){
super();
setDefaultSlipperiness(0.98f); // For some strange reason BlockFrostedIce overrides BlockIce's icy-ness...
setSoundType(SoundType.GLASS);
}
@Override
public Material getMaterial(IBlockState state){
return Material.ICE; // For goodness sake
}
@Override
protected void turnIntoWater(World world, BlockPos pos){
world.destroyBlock(pos, false);
@@ -1,22 +1,57 @@
package electroblob.wizardry.block;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import electroblob.wizardry.registry.Spells;
import electroblob.wizardry.registry.WizardryPotions;
import electroblob.wizardry.spell.Spell;
import electroblob.wizardry.util.EntityUtils;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nullable;
public class BlockPermafrost extends Block {
public class BlockPermafrost extends BlockDryFrostedIce {
public BlockPermafrost(){
super(Material.ICE);
protected static final AxisAlignedBB BOUNDING_BOX = new AxisAlignedBB(0, 0, 0, 1, 0, 1);
protected static final AxisAlignedBB SELECTION_BOUNDING_BOX = new AxisAlignedBB(0, 0, 0, 1, 0.125, 1);
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
return BOUNDING_BOX;
}
@Override
public float getSlipperiness(IBlockState state, IBlockAccess world, BlockPos pos, @Nullable Entity entity){
return super.getSlipperiness(state, world, pos, entity);
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos){
return SELECTION_BOUNDING_BOX;
}
@Nullable
@Override
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos){
return super.getCollisionBoundingBox(blockState, worldIn, pos);
}
@Override
public boolean isFullCube(IBlockState state){
return false;
}
@Override
public void onEntityCollision(World world, BlockPos pos, IBlockState state, Entity entity){
if(EntityUtils.isLiving(entity) && entity.ticksExisted % 30 == 0){
// Can't make it player damage unless we make this block a tile entity, but there will be too many for that
entity.attackEntityFrom(DamageSource.MAGIC, Spells.permafrost.getProperty(Spell.DAMAGE).floatValue());
int duration = Spells.permafrost.getProperty(Spell.EFFECT_DURATION).intValue();
int amplifier = Spells.permafrost.getProperty(Spell.EFFECT_STRENGTH).intValue();
((EntityLivingBase)entity).addPotionEffect(new PotionEffect(WizardryPotions.frost, duration, amplifier));
}
}
}
@@ -245,6 +245,7 @@ public final class Spells {
public static final Spell enrage = placeholder();
public static final Spell mark_sacrifice = placeholder();
public static final Spell permafrost = placeholder();
public static final Spell stormcloud = placeholder();
public static final Spell withering_totem = placeholder();
public static final Spell fangs = placeholder();
@@ -464,6 +465,7 @@ public final class Spells {
registry.register(new Enrage());
registry.register(new MarkSacrifice());
registry.register(new Permafrost());
registry.register(new Stormcloud());
registry.register(new WitheringTotem());
registry.register(new Fangs());
@@ -56,6 +56,7 @@ public final class WizardryBlocks {
public static final Block obsidian_crust = placeholder();
public static final Block dry_frosted_ice = placeholder();
public static final Block crystal_flower_pot = placeholder();
public static final Block permafrost = placeholder();
public static final Block runestone = placeholder();
public static final Block runestone_pedestal = placeholder();
@@ -120,6 +121,7 @@ public final class WizardryBlocks {
registerBlock(registry, "obsidian_crust", new BlockObsidianCrust());
registerBlock(registry, "dry_frosted_ice", new BlockDryFrostedIce());
registerBlock(registry, "crystal_flower_pot", new BlockCrystalFlowerPot());
registerBlock(registry, "permafrost", new BlockPermafrost());
registerBlock(registry, "runestone", new BlockRunestone(Material.ROCK));
registerBlock(registry, "runestone_pedestal", new BlockPedestal(Material.ROCK));
@@ -0,0 +1,65 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryBlocks;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.BlockUtils;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
import electroblob.wizardry.util.SpellModifiers;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
public class Permafrost extends SpellRay {
public Permafrost(){
super("permafrost", SpellActions.POINT, true);
this.particleVelocity(1);
this.particleSpacing(0.5);
soundValues(0.5f, 1, 0);
addProperties(DURATION, DAMAGE, EFFECT_DURATION, EFFECT_STRENGTH);
this.ignoreLivingEntities(true);
}
@Override
protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivingBase caster, Vec3d origin, int ticksInUse, SpellModifiers modifiers){
return false;
}
@Override
protected boolean onBlockHit(World world, BlockPos pos, EnumFacing side, Vec3d hit, EntityLivingBase caster, Vec3d origin, int ticksInUse, SpellModifiers modifiers){
if(side == EnumFacing.UP && world.getBlockState(pos).isSideSolid(world, pos, EnumFacing.UP)
&& BlockUtils.canBlockBeReplaced(world, pos.up())){
int duration = (int)(getProperty(DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade));
if(!world.isRemote && BlockUtils.canPlaceBlock(caster, world, pos.up())){
world.setBlockState(pos.up(), WizardryBlocks.permafrost.getDefaultState());
world.scheduleUpdate(pos.up().toImmutable(), WizardryBlocks.permafrost, duration);
}
return true;
}
return false;
}
@Override
protected boolean onMiss(World world, EntityLivingBase caster, Vec3d origin, Vec3d direction, int ticksInUse, SpellModifiers modifiers){
return true;
}
@Override
protected void spawnParticle(World world, double x, double y, double z, double vx, double vy, double vz){
float brightness = world.rand.nextFloat();
ParticleBuilder.create(Type.DUST).pos(x, y, z).vel(vx, vy, vz).time(8 + world.rand.nextInt(12))
.clr(0.4f + 0.6f * brightness, 0.6f + 0.4f*brightness, 1).spawn(world);
ParticleBuilder.create(Type.SNOW).pos(x, y, z).vel(vx, vy, vz).time(8 + world.rand.nextInt(12)).spawn(world);
}
}
@@ -0,0 +1,9 @@
{
"forge_marker": 1,
"variants": {
"age=0": { "model": "ebwizardry:permafrost_0" },
"age=1": { "model": "ebwizardry:permafrost_1" },
"age=2": { "model": "ebwizardry:permafrost_2" },
"age=3": { "model": "ebwizardry:permafrost_3" }
}
}
@@ -17,6 +17,7 @@ tile.ebwizardry\:thorns.name=Thorns
tile.ebwizardry\:obsidian_crust.name=Obsidian Crust
tile.ebwizardry\:dry_frosted_ice.name=Dry Frosted Ice
tile.ebwizardry\:crystal_flower_pot.name=Flower Pot
tile.ebwizardry\:permafrost.name=Permafrost
tile.ebwizardry\:magic_crystal_block.name=Block of Crystal
tile.ebwizardry\:fire_crystal_block.name=Block of Fiery Crystal
@@ -899,6 +900,7 @@ spell.ebwizardry\:muffle=Muffle
spell.ebwizardry\:none=[Empty Slot]
spell.ebwizardry\:oakflesh=Oakflesh
spell.ebwizardry\:paralysis=Paralysis
spell.ebwizardry\:permafrost=Permafrost
spell.ebwizardry\:petrify=Petrify
spell.ebwizardry\:phase_step=Phase Step
spell.ebwizardry\:plague_of_darkness=Plague of Darkness
@@ -1088,6 +1090,7 @@ spell.ebwizardry\:muffle.desc=Silences any sounds made by the caster for 30 seco
spell.ebwizardry\:none.desc=To get a spell book with the /give command, use id\: /give [player] ebwizardry\:spell_book 1 [spell id] (if you found this book in a chest, some other mod has messed things up).
spell.ebwizardry\:oakflesh.desc=Improves the caster's damage resistance for 30 seconds.
spell.ebwizardry\:paralysis.desc=Delivers a powerful lightning bolt that paralyses targets for 5 seconds. Paralysed creatures cannot move and will still take damage - but too much will snap the creature out of paralysis.
spell.ebwizardry\:permafrost.desc=Spreads a layer of slippery ice on the ground where you are pointing, the extreme cold of which causes creatures to slowly take damage.
spell.ebwizardry\:petrify.desc=Turns the target to stone until broken out, with a chance for it to break out when it is dark. The target cannot move or do anything while petrified but is also impervious to all damage.
spell.ebwizardry\:phase_step.desc=Teleports the caster a short distance in front of them, including through walls. Range upgrades will increase the wall thickness you can teleport through.
spell.ebwizardry\:plague_of_darkness.desc=The darkness will consume them all...
@@ -17,6 +17,7 @@ tile.ebwizardry\:thorns.name=Thorns
tile.ebwizardry\:obsidian_crust.name=Obsidian Crust
tile.ebwizardry\:dry_frosted_ice.name=Dry Frosted Ice
tile.ebwizardry\:crystal_flower_pot.name=Flower Pot
tile.ebwizardry\:permafrost.name=Permafrost
tile.ebwizardry\:magic_crystal_block.name=Block of Crystal
tile.ebwizardry\:fire_crystal_block.name=Block of Fiery Crystal
@@ -899,6 +900,7 @@ spell.ebwizardry\:muffle=Muffle
spell.ebwizardry\:none=[Empty Slot]
spell.ebwizardry\:oakflesh=Oakflesh
spell.ebwizardry\:paralysis=Paralysis
spell.ebwizardry\:permafrost=Permafrost
spell.ebwizardry\:petrify=Petrify
spell.ebwizardry\:phase_step=Phase Step
spell.ebwizardry\:plague_of_darkness=Plague of Darkness
@@ -1088,6 +1090,7 @@ spell.ebwizardry\:muffle.desc=Silences any sounds made by the caster for 30 seco
spell.ebwizardry\:none.desc=To get a spell book with the /give command, use id\: /give [player] ebwizardry\:spell_book 1 [spell id] (if you found this book in a chest, some other mod has messed things up).
spell.ebwizardry\:oakflesh.desc=Improves the caster's damage resistance for 30 seconds.
spell.ebwizardry\:paralysis.desc=Delivers a powerful lightning bolt that paralyses targets for 5 seconds. Paralysed creatures cannot move and will still take damage - but too much will snap the creature out of paralysis.
spell.ebwizardry\:permafrost.desc=Spreads a layer of slippery ice on the ground where you are pointing, the extreme cold of which causes creatures to slowly take damage.
spell.ebwizardry\:petrify.desc=Turns the target to stone until broken out, with a chance for it to break out when it is dark. The target cannot move or do anything while petrified but is also impervious to all damage.
spell.ebwizardry\:phase_step.desc=Teleports the caster a short distance in front of them, including through walls. Range upgrades will increase the wall thickness you can teleport through.
spell.ebwizardry\:plague_of_darkness.desc=The darkness will consume them all...
@@ -0,0 +1,20 @@
{
"parent": "block/thin_block",
"textures": {
"particle": "blocks/frosted_ice_0",
"texture": "blocks/frosted_ice_0"
},
"elements": [
{ "from": [ 0, 0, 0 ],
"to": [ 16, 1, 16 ],
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "cullface": "down" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture" },
"north": { "uv": [ 0, 15, 16, 16 ], "texture": "#texture", "cullface": "north" },
"south": { "uv": [ 0, 15, 16, 16 ], "texture": "#texture", "cullface": "south" },
"west": { "uv": [ 0, 15, 16, 16 ], "texture": "#texture", "cullface": "west" },
"east": { "uv": [ 0, 15, 16, 16 ], "texture": "#texture", "cullface": "east" }
}
}
]
}
@@ -0,0 +1,7 @@
{
"parent": "ebwizardry:block/permafrost_0",
"textures": {
"particle": "blocks/frosted_ice_1",
"texture": "blocks/frosted_ice_1"
}
}
@@ -0,0 +1,7 @@
{
"parent": "ebwizardry:block/permafrost_0",
"textures": {
"particle": "blocks/frosted_ice_2",
"texture": "blocks/frosted_ice_2"
}
}
@@ -0,0 +1,7 @@
{
"parent": "ebwizardry:block/permafrost_0",
"textures": {
"particle": "blocks/frosted_ice_3",
"texture": "blocks/frosted_ice_3"
}
}
@@ -277,6 +277,9 @@
"spell.none": {"category": "spells", "sounds": []},
"spell.oakflesh": {"category": "spells", "sounds": ["ebwizardry:buff"]},
"spell.paralysis": {"category": "spells", "sounds": ["ebwizardry:shockwave"]},
"spell.permafrost.start": {"category": "spells", "sounds": ["ebwizardry:frost_start"]},
"spell.permafrost.loop": {"category": "spells", "sounds": ["ebwizardry:frost_loop"]},
"spell.permafrost.end": {"category": "spells", "sounds": ["ebwizardry:frost_end"]},
"spell.petrify": {"category": "spells", "sounds": ["mob/wither/spawn"]},
"spell.phase_step": {"category": "spells", "sounds": ["mob/endermen/portal", "mob/endermen/portal2"]},
"spell.plague_of_darkness": {"category": "spells", "sounds": ["mob/wither/death"]},
@@ -0,0 +1,26 @@
{
"enabled": {
"book": true,
"scroll": true,
"wands": true,
"npcs": true,
"dispensers": true,
"commands": true,
"treasure": true,
"trades": true,
"looting": true
},
"tier": "advanced",
"element": "ice",
"type": "alteration",
"cost": 10,
"chargeup": 10,
"cooldown": 40,
"base_properties": {
"range": 10,
"duration": 600,
"damage": 3,
"effect_duration": 100,
"effect_strength": 0
}
}