Added a few more upgrades to the Living Armour
... Wait, was I supposed to put something in here?
This commit is contained in:
parent
507c541d5b
commit
953bac9298
23 changed files with 493 additions and 23 deletions
|
@ -51,6 +51,7 @@ import wayoftime.bloodmagic.common.registries.BloodMagicEntityTypes;
|
|||
import wayoftime.bloodmagic.common.registries.BloodMagicRecipeSerializers;
|
||||
import wayoftime.bloodmagic.core.LivingArmorRegistrar;
|
||||
import wayoftime.bloodmagic.core.recipe.IngredientBloodOrb;
|
||||
import wayoftime.bloodmagic.core.registry.AlchemyArrayRegistry;
|
||||
import wayoftime.bloodmagic.core.registry.OrbRegistry;
|
||||
import wayoftime.bloodmagic.impl.BloodMagicAPI;
|
||||
import wayoftime.bloodmagic.impl.BloodMagicCorePlugin;
|
||||
|
@ -168,6 +169,7 @@ public class BloodMagic
|
|||
RITUAL_MANAGER.discover();
|
||||
ModRituals.initHarvestHandlers();
|
||||
LivingArmorRegistrar.register();
|
||||
AlchemyArrayRegistry.registerBaseArrays();
|
||||
}
|
||||
|
||||
public void registerTileEntityTypes(RegistryEvent.Register<TileEntityType<?>> event)
|
||||
|
|
|
@ -21,6 +21,7 @@ import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
|||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.api.compat.IMultiWillTool;
|
||||
import wayoftime.bloodmagic.client.model.MimicColor;
|
||||
import wayoftime.bloodmagic.client.render.alchemyarray.StaticAlchemyCircleRenderer;
|
||||
import wayoftime.bloodmagic.client.render.block.RenderAlchemyArray;
|
||||
import wayoftime.bloodmagic.client.render.block.RenderAltar;
|
||||
import wayoftime.bloodmagic.client.render.block.RenderDemonCrucible;
|
||||
|
@ -35,6 +36,7 @@ import wayoftime.bloodmagic.common.item.ItemSacrificialDagger;
|
|||
import wayoftime.bloodmagic.common.item.sigil.ItemSigilToggleable;
|
||||
import wayoftime.bloodmagic.common.item.soul.ItemSentientSword;
|
||||
import wayoftime.bloodmagic.common.registries.BloodMagicEntityTypes;
|
||||
import wayoftime.bloodmagic.core.registry.AlchemyArrayRendererRegistry;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemyArray;
|
||||
import wayoftime.bloodmagic.tile.TileAltar;
|
||||
import wayoftime.bloodmagic.tile.TileDemonCrucible;
|
||||
|
@ -99,6 +101,7 @@ public class ClientEvents
|
|||
RenderTypeLookup.setRenderLayer(BloodMagicBlocks.MIMIC.get(), (RenderType) -> true);
|
||||
});
|
||||
|
||||
AlchemyArrayRendererRegistry.registerRenderer(BloodMagic.rl("array/movement"), new StaticAlchemyCircleRenderer(BloodMagic.rl("textures/models/alchemyarrays/movementarray.png")));
|
||||
}
|
||||
|
||||
public static void registerItemModelProperties(FMLClientSetupEvent event)
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.mojang.blaze3d.vertex.IVertexBuilder;
|
|||
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.vector.Quaternion;
|
||||
|
@ -105,7 +106,7 @@ public class AlchemyArrayRenderer
|
|||
|
||||
matrixStack.scale(size, size, size);
|
||||
|
||||
RenderResizableQuadrilateral.INSTANCE.renderSquare(arrayModel, matrixStack, twoDBuffer, 0xFFFFFFFF, combinedLightIn, combinedOverlayIn);
|
||||
RenderResizableQuadrilateral.INSTANCE.renderSquare(arrayModel, matrixStack, twoDBuffer, 0xFFFFFFFF, 0x00F000F0, OverlayTexture.NO_OVERLAY);
|
||||
|
||||
matrixStack.pop();
|
||||
matrixStack.pop();
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
package wayoftime.bloodmagic.client.render.alchemyarray;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.vector.Quaternion;
|
||||
import wayoftime.bloodmagic.client.render.BloodMagicRenderer;
|
||||
import wayoftime.bloodmagic.client.render.BloodMagicRenderer.Model2D;
|
||||
import wayoftime.bloodmagic.client.render.RenderResizableQuadrilateral;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemyArray;
|
||||
|
||||
public class StaticAlchemyCircleRenderer extends AlchemyArrayRenderer
|
||||
{
|
||||
public StaticAlchemyCircleRenderer(ResourceLocation arrayResource)
|
||||
{
|
||||
super(arrayResource);
|
||||
}
|
||||
|
||||
public float getRotation(float craftTime)
|
||||
{
|
||||
float offset = 50;
|
||||
if (craftTime >= offset)
|
||||
{
|
||||
float modifier = (float) (craftTime - offset) * 5f;
|
||||
return modifier * 1f;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public float getSecondaryRotation(float craftTime)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public float getSizeModifier(float craftTime)
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
// public float getVerticalOffset(float craftTime)
|
||||
// {
|
||||
// if (craftTime >= 5)
|
||||
// {
|
||||
// if (craftTime <= 40)
|
||||
// {
|
||||
// return (float) (-0.4 + (0.4) * Math.pow((craftTime - 5) / 35f, 3));
|
||||
// } else
|
||||
// {
|
||||
// return 0;
|
||||
// }
|
||||
// }
|
||||
// return -0.4f;
|
||||
// }
|
||||
|
||||
public void renderAt(TileAlchemyArray tileArray, double x, double y, double z, float craftTime, MatrixStack matrixStack, IRenderTypeBuffer renderer, int combinedLightIn, int combinedOverlayIn)
|
||||
{
|
||||
matrixStack.push();
|
||||
|
||||
matrixStack.translate(0.5, 0.5, 0.5);
|
||||
|
||||
float rot = getRotation(craftTime);
|
||||
float secondaryRot = getSecondaryRotation(craftTime);
|
||||
|
||||
float size = 1.0F * getSizeModifier(craftTime);
|
||||
Direction rotation = tileArray.getRotation();
|
||||
|
||||
matrixStack.push();
|
||||
matrixStack.translate(0, getVerticalOffset(craftTime), 0);
|
||||
matrixStack.rotate(new Quaternion(Direction.UP.toVector3f(), -rotation.getHorizontalAngle(), true));
|
||||
|
||||
matrixStack.push();
|
||||
|
||||
matrixStack.rotate(new Quaternion(Direction.NORTH.toVector3f(), rot, true));
|
||||
// matrixStack.rotate(new Quaternion(Direction.NORTH.toVector3f(), secondaryRot, true));
|
||||
// matrixStack.rotate(new Quaternion(Direction.EAST.toVector3f(), secondaryRot * 0.45812f, true));
|
||||
|
||||
IVertexBuilder twoDBuffer = renderer.getBuffer(RenderType.getEntityTranslucent(arrayResource));
|
||||
Model2D arrayModel = new BloodMagicRenderer.Model2D();
|
||||
arrayModel.minX = -0.5;
|
||||
arrayModel.maxX = +0.5;
|
||||
arrayModel.minY = -0.5;
|
||||
arrayModel.maxY = +0.5;
|
||||
arrayModel.resource = arrayResource;
|
||||
|
||||
matrixStack.scale(size, size, size);
|
||||
|
||||
RenderResizableQuadrilateral.INSTANCE.renderSquare(arrayModel, matrixStack, twoDBuffer, 0xFFFFFFFF, 0x00F000F0, OverlayTexture.NO_OVERLAY);
|
||||
|
||||
matrixStack.pop();
|
||||
matrixStack.pop();
|
||||
matrixStack.pop();
|
||||
}
|
||||
}
|
|
@ -1,6 +1,10 @@
|
|||
package wayoftime.bloodmagic.common.alchemyarray;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemyArray;
|
||||
|
||||
public abstract class AlchemyArrayEffect
|
||||
|
@ -12,4 +16,8 @@ public abstract class AlchemyArrayEffect
|
|||
public abstract void writeToNBT(CompoundNBT compound);
|
||||
|
||||
public abstract boolean update(TileAlchemyArray array, int activeCounter);
|
||||
|
||||
public void onEntityCollidedWithBlock(TileAlchemyArray tileAlchemyArray, World world, BlockPos pos, BlockState state, Entity entity)
|
||||
{
|
||||
};
|
||||
}
|
||||
|
|
|
@ -44,7 +44,6 @@ public class AlchemyArrayEffectBinding extends AlchemyArrayEffectCrafting
|
|||
ItemEntity outputEntity = new ItemEntity(tile.getWorld(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, output);
|
||||
|
||||
tile.getWorld().addEntity(outputEntity);
|
||||
// tile.getWorld().spawnEntity(outputEntity);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
package wayoftime.bloodmagic.common.alchemyarray;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemyArray;
|
||||
|
||||
public class AlchemyArrayEffectMovement extends AlchemyArrayEffect
|
||||
{
|
||||
public AlchemyArrayEffectMovement()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(TileAlchemyArray tile, int ticksActive)
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(TileAlchemyArray array, World world, BlockPos pos, BlockState state, Entity entity)
|
||||
{
|
||||
double motionY = 0.5;
|
||||
double motionYGlowstoneMod = 0.05;
|
||||
double speed = 1.5;
|
||||
double speedRedstoneMod = 0.15;
|
||||
|
||||
Direction direction = array.getRotation();
|
||||
TileAlchemyArray tileArray = (TileAlchemyArray) array;
|
||||
|
||||
motionY += motionYGlowstoneMod * (tileArray.getStackInSlot(0).getCount() - 1);
|
||||
speed += speedRedstoneMod * (tileArray.getStackInSlot(1).getCount() - 1);
|
||||
|
||||
// entity.getMotion().y = motionY;
|
||||
entity.fallDistance = 0;
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case NORTH:
|
||||
// entity.motionX = 0;
|
||||
// entity.motionY = motionY;
|
||||
// entity.motionZ = -speed;
|
||||
entity.setMotion(new Vector3d(0, motionY, -speed));
|
||||
break;
|
||||
|
||||
case SOUTH:
|
||||
// entity.motionX = 0;
|
||||
// entity.motionY = motionY;
|
||||
// entity.motionZ = speed;
|
||||
entity.setMotion(new Vector3d(0, motionY, speed));
|
||||
break;
|
||||
|
||||
case WEST:
|
||||
// entity.motionX = -speed;
|
||||
// entity.motionY = motionY;
|
||||
// entity.motionZ = 0;
|
||||
entity.setMotion(new Vector3d(-speed, motionY, 0));
|
||||
break;
|
||||
|
||||
case EAST:
|
||||
// entity.motionX = speed;
|
||||
// entity.motionY = motionY;
|
||||
// entity.motionZ = 0;
|
||||
entity.setMotion(new Vector3d(speed, motionY, 0));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlchemyArrayEffect getNewCopy()
|
||||
{
|
||||
return new AlchemyArrayEffectMovement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(CompoundNBT compound)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(CompoundNBT compound)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -52,6 +53,16 @@ public class BlockAlchemyArray extends Block
|
|||
return BlockRenderType.ENTITYBLOCK_ANIMATED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileAlchemyArray)
|
||||
{
|
||||
((TileAlchemyArray) tile).onEntityCollidedWithBlock(state, entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult blockRayTraceResult)
|
||||
{
|
||||
|
|
|
@ -6,6 +6,7 @@ import net.minecraft.data.IFinishedRecipe;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.common.data.recipe.builder.AlchemyArrayRecipeBuilder;
|
||||
import wayoftime.bloodmagic.common.item.BloodMagicItems;
|
||||
|
@ -35,6 +36,7 @@ public class AlchemyArrayRecipeProvider implements ISubRecipeProvider
|
|||
AlchemyArrayRecipeBuilder.array(AlchemyArrayRegistry.BINDING_ARRAY, Ingredient.fromItems(BloodMagicItems.REAGENT_BINDING.get()), Ingredient.fromItems(Items.IRON_LEGGINGS), new ItemStack(BloodMagicItems.LIVING_LEGGINGS.get())).build(consumer, BloodMagic.rl(basePath + "living_leggings"));
|
||||
AlchemyArrayRecipeBuilder.array(AlchemyArrayRegistry.BINDING_ARRAY, Ingredient.fromItems(BloodMagicItems.REAGENT_BINDING.get()), Ingredient.fromItems(Items.IRON_BOOTS), new ItemStack(BloodMagicItems.LIVING_BOOTS.get())).build(consumer, BloodMagic.rl(basePath + "living_boots"));
|
||||
|
||||
AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/movementarray.png"), Ingredient.fromItems(Items.FEATHER), Ingredient.fromTag(Tags.Items.DUSTS_REDSTONE), ItemStack.EMPTY).build(consumer, BloodMagic.rl(basePath + "movement"));
|
||||
// AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/fastminersigil.png"),
|
||||
// Ingredient.fromItems(BloodMagicItems.REAGENT_FAST_MINER.get()),
|
||||
// Ingredient.fromItems(BloodMagicItems.REINFORCED_SLATE.get()), new
|
||||
|
|
|
@ -40,12 +40,20 @@ public class LivingArmorRegistrar
|
|||
def.put("arrow_protect", BloodMagic.rl("arrow_protect"));
|
||||
def.put("arrow_shot", BloodMagic.rl("arrow_shot"));
|
||||
def.put("critical_strike", BloodMagic.rl("critical_strike"));
|
||||
def.put("jump", BloodMagic.rl("jump"));
|
||||
def.put("health", BloodMagic.rl("health"));
|
||||
def.put("digging", BloodMagic.rl("digging"));
|
||||
def.put("experience", BloodMagic.rl("experienced"));
|
||||
def.put("fall_protect", BloodMagic.rl("fall_protect"));
|
||||
def.put("fire_resist", BloodMagic.rl("fire_resist"));
|
||||
def.put("grave_digger", BloodMagic.rl("grave_digger"));
|
||||
def.put("health", BloodMagic.rl("health"));
|
||||
def.put("jump", BloodMagic.rl("jump"));
|
||||
def.put("knockback_resist", BloodMagic.rl("knockback_resist"));
|
||||
def.put("melee_damage", BloodMagic.rl("melee_damage"));
|
||||
def.put("physical_protect", BloodMagic.rl("physical_protect"));
|
||||
def.put("poison_resist", BloodMagic.rl("poison_resist"));
|
||||
def.put("sprint_attack", BloodMagic.rl("sprint_attack"));
|
||||
def.put("self_sacrifice", BloodMagic.rl("self_sacrifice"));
|
||||
def.put("speed", BloodMagic.rl("speed"));
|
||||
def.put("self_sacrifice", BloodMagic.rl("self_sacrifice"));
|
||||
return def;
|
||||
}).get();
|
||||
// private static final Map<String, Path> DEFINITIONS =
|
||||
|
@ -83,7 +91,11 @@ public class LivingArmorRegistrar
|
|||
return 0;
|
||||
}));
|
||||
public static final LivingUpgradeRegistryObject<LivingUpgrade> UPGRADE_SELF_SACRIFICE = UPGRADES.register("self_sacrifice", () -> parseDefinition("self_sacrifice"));
|
||||
public static final LivingUpgradeRegistryObject<LivingUpgrade> UPGRADE_SPEED = UPGRADES.register("speed", () -> parseDefinition("speed"));
|
||||
public static final LivingUpgradeRegistryObject<LivingUpgrade> UPGRADE_SPEED = UPGRADES.register("speed", () -> parseDefinition("speed").withAttributeProvider((stats, attributeMap, uuid, upgrade, level) -> {
|
||||
attributeMap.put(Attributes.MOVEMENT_SPEED, new AttributeModifier(uuid, "Movement Modifier 2", upgrade.getBonusValue("speed_modifier", level).doubleValue(), AttributeModifier.Operation.MULTIPLY_BASE));
|
||||
}));
|
||||
public static final LivingUpgradeRegistryObject<LivingUpgrade> UPGRADE_POISON_RESIST = UPGRADES.register("poison_resist", () -> parseDefinition("poison_resist"));
|
||||
public static final LivingUpgradeRegistryObject<LivingUpgrade> UPGRADE_DIGGING = UPGRADES.register("digging", () -> parseDefinition("digging"));
|
||||
|
||||
// public static final LivingUpgrade UPGRADE_ARROW_PROTECT = parseDefinition("arrow_protect").withArmorProvider((player, stats, source, upgrade, level) -> {
|
||||
// if (source.isProjectile())
|
||||
|
@ -108,6 +120,8 @@ public class LivingArmorRegistrar
|
|||
registerUpgrade(UPGRADE_SPRINT_ATTACK.get());
|
||||
registerUpgrade(UPGRADE_SELF_SACRIFICE.get());
|
||||
registerUpgrade(UPGRADE_SPEED.get());
|
||||
registerUpgrade(UPGRADE_POISON_RESIST.get());
|
||||
registerUpgrade(UPGRADE_DIGGING.get());
|
||||
// Registry.register(UPGRADES, UPGRADE_ARROW_PROTECT.getKey(), UPGRADE_ARROW_PROTECT);
|
||||
// Registry.register(UPGRADES, UPGRADE_ARROW_SHOT.getKey(), UPGRADE_ARROW_SHOT);
|
||||
// Registry.register(UPGRADES, UPGRADE_CRITICAL_STRIKE.getKey(), UPGRADE_CRITICAL_STRIKE);
|
||||
|
|
|
@ -42,7 +42,7 @@ public class LivingStats
|
|||
LivingUpgrade upgrade = LivingArmorRegistrar.UPGRADE_MAP.getOrDefault(key, LivingUpgrade.DUMMY);
|
||||
double current = upgrades.getOrDefault(upgrade, 0d);
|
||||
|
||||
System.out.println("Upgrade: " + upgrade);
|
||||
// System.out.println("Upgrade: " + upgrade);
|
||||
|
||||
if (upgrade.getNextRequirement((int) current) == 0)
|
||||
return this;
|
||||
|
|
|
@ -71,7 +71,7 @@ public class LivingUtil
|
|||
player.sendStatusMessage(new TranslationTextComponent("chat.bloodmagic.living_upgrade_level_increase", new TranslationTextComponent(upgrade.getTranslationKey()), newLevel), true);
|
||||
}
|
||||
|
||||
System.out.println("Adding experience!");
|
||||
// System.out.println("Adding experience! Total experience is: " + currentExperience);
|
||||
|
||||
stats.addExperience(upgrade.getKey(), experience);
|
||||
LivingStats.toPlayer(player, stats);
|
||||
|
|
|
@ -12,6 +12,7 @@ import wayoftime.bloodmagic.BloodMagic;
|
|||
import wayoftime.bloodmagic.common.alchemyarray.AlchemyArrayEffect;
|
||||
import wayoftime.bloodmagic.common.alchemyarray.AlchemyArrayEffectBinding;
|
||||
import wayoftime.bloodmagic.common.alchemyarray.AlchemyArrayEffectCrafting;
|
||||
import wayoftime.bloodmagic.common.alchemyarray.AlchemyArrayEffectMovement;
|
||||
import wayoftime.bloodmagic.impl.BloodMagicAPI;
|
||||
import wayoftime.bloodmagic.recipe.RecipeAlchemyArray;
|
||||
|
||||
|
@ -29,6 +30,11 @@ public class AlchemyArrayRegistry
|
|||
return hadKey;
|
||||
}
|
||||
|
||||
public static void registerBaseArrays()
|
||||
{
|
||||
registerEffect(BloodMagic.rl("array/movement"), new AlchemyArrayEffectMovement());
|
||||
}
|
||||
|
||||
public static AlchemyArrayEffect getEffect(World world, ResourceLocation rl, RecipeAlchemyArray recipe)
|
||||
{
|
||||
if (effectMap.containsKey(rl))
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package wayoftime.bloodmagic.tile;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
|
@ -36,6 +38,14 @@ public class TileAlchemyArray extends TileInventory implements ITickableTileEnti
|
|||
this(TYPE);
|
||||
}
|
||||
|
||||
public void onEntityCollidedWithBlock(BlockState state, Entity entity)
|
||||
{
|
||||
if (arrayEffect != null)
|
||||
{
|
||||
arrayEffect.onEntityCollidedWithBlock(this, getWorld(), pos, state, entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(CompoundNBT tagCompound)
|
||||
{
|
||||
|
@ -108,6 +118,7 @@ public class TileAlchemyArray extends TileInventory implements ITickableTileEnti
|
|||
} else
|
||||
{
|
||||
AlchemyArrayEffect effect = AlchemyArrayRegistry.getEffect(world, this.getStackInSlot(0), this.getStackInSlot(1));
|
||||
System.out.println("Effect: " + effect);
|
||||
if (effect == null)
|
||||
{
|
||||
// key = effect.i
|
||||
|
|
|
@ -16,7 +16,6 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.potion.EffectInstance;
|
||||
import net.minecraft.potion.Effects;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
@ -25,8 +24,10 @@ import net.minecraftforge.event.entity.living.LivingEvent;
|
|||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingHealEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerXpEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent.BlockToolInteractEvent;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
@ -334,7 +335,8 @@ public class GenericHandler
|
|||
if (LivingUtil.hasFullSet(player))
|
||||
{
|
||||
LivingStats stats = LivingStats.fromPlayer(player);
|
||||
percentIncrease += LivingArmorRegistrar.UPGRADE_SPEED.get().getBonusValue("speed_modifier", stats.getLevel(LivingArmorRegistrar.UPGRADE_SPEED.get().getKey())).doubleValue();
|
||||
ItemStack chestStack = player.getItemStackFromSlot(EquipmentSlotType.CHEST);
|
||||
// percentIncrease += LivingArmorRegistrar.UPGRADE_SPEED.get().getBonusValue("speed_modifier", stats.getLevel(LivingArmorRegistrar.UPGRADE_SPEED.get().getKey())).doubleValue();
|
||||
if (player.isSprinting())
|
||||
{
|
||||
int speedTime = LivingArmorRegistrar.UPGRADE_SPEED.get().getBonusValue("speed_time", stats.getLevel(LivingArmorRegistrar.UPGRADE_SPEED.get().getKey())).intValue();
|
||||
|
@ -358,16 +360,80 @@ public class GenericHandler
|
|||
distance *= (1 + percentIncrease);
|
||||
LivingUtil.applyNewExperience(player, LivingArmorRegistrar.UPGRADE_SPEED.get(), distance);
|
||||
}
|
||||
|
||||
int poisonLevel = stats.getLevel(LivingArmorRegistrar.UPGRADE_POISON_RESIST.get().getKey());
|
||||
if (player.isPotionActive(Effects.POISON))
|
||||
{
|
||||
LivingUtil.applyNewExperience(player, LivingArmorRegistrar.UPGRADE_POISON_RESIST.get(), 1);
|
||||
}
|
||||
if (poisonLevel > 0)
|
||||
{
|
||||
boolean hasChanged = false;
|
||||
int poisonCooldown = chestStack.getTag().getInt("poison_cooldown");
|
||||
if (poisonCooldown > 0)
|
||||
{
|
||||
poisonCooldown--;
|
||||
hasChanged = true;
|
||||
}
|
||||
|
||||
// System.out.println("Cooldown: " + poisonCooldown);
|
||||
// System.out.println(LivingArmorRegistrar.UPGRADE_POISON_RESIST.get().getBonusValue("max_cure", poisonLevel).intValue());
|
||||
|
||||
if (player.isPotionActive(Effects.POISON) && poisonCooldown <= 0 && LivingArmorRegistrar.UPGRADE_POISON_RESIST.get().getBonusValue("max_cure", poisonLevel).intValue() >= player.getActivePotionEffect(Effects.POISON).getAmplifier())
|
||||
{
|
||||
poisonCooldown = LivingArmorRegistrar.UPGRADE_POISON_RESIST.get().getBonusValue("cooldown", poisonLevel).intValue();
|
||||
player.removePotionEffect(Effects.POISON);
|
||||
hasChanged = true;
|
||||
}
|
||||
|
||||
if (hasChanged)
|
||||
{
|
||||
chestStack.getTag().putInt("poison_cooldown", poisonCooldown);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (percentIncrease > 0 && (player.isOnGround()) && (Math.abs(player.moveForward) > 0 || Math.abs(player.moveStrafing) > 0))
|
||||
{
|
||||
player.travel(new Vector3d(player.moveStrafing * percentIncrease, 0, player.moveForward * percentIncrease));
|
||||
}
|
||||
// if (percentIncrease > 0 && (player.isOnGround()) && (Math.abs(player.moveForward) > 0 || Math.abs(player.moveStrafing) > 0))
|
||||
// {
|
||||
// player.travel(new Vector3d(player.moveStrafing * percentIncrease, 0, player.moveForward * percentIncrease));
|
||||
// }
|
||||
|
||||
posXMap.put(player.getUniqueID(), player.getPosX());
|
||||
posZMap.put(player.getUniqueID(), player.getPosZ());
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMiningSpeedCheck(PlayerEvent.BreakSpeed event)
|
||||
{
|
||||
PlayerEntity player = event.getPlayer();
|
||||
float percentIncrease = 0;
|
||||
|
||||
if (LivingUtil.hasFullSet(player))
|
||||
{
|
||||
LivingStats stats = LivingStats.fromPlayer(player);
|
||||
percentIncrease += LivingArmorRegistrar.UPGRADE_DIGGING.get().getBonusValue("speed_modifier", stats.getLevel(LivingArmorRegistrar.UPGRADE_DIGGING.get().getKey())).doubleValue();
|
||||
}
|
||||
|
||||
event.setNewSpeed((1 + percentIncrease) * event.getNewSpeed());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBreakBlock(BlockEvent.BreakEvent event)
|
||||
{
|
||||
PlayerEntity player = event.getPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
if (LivingUtil.hasFullSet(player))
|
||||
{
|
||||
LivingStats stats = LivingStats.fromPlayer(player);
|
||||
LivingUtil.applyNewExperience(player, LivingArmorRegistrar.UPGRADE_DIGGING.get(), 1);
|
||||
int mineTime = LivingArmorRegistrar.UPGRADE_DIGGING.get().getBonusValue("speed_time", stats.getLevel(LivingArmorRegistrar.UPGRADE_DIGGING.get().getKey())).intValue();
|
||||
if (mineTime > 0)
|
||||
{
|
||||
player.addPotionEffect(new EffectInstance(Effects.HASTE, mineTime, LivingArmorRegistrar.UPGRADE_DIGGING.get().getBonusValue("speed_level", stats.getLevel(LivingArmorRegistrar.UPGRADE_DIGGING.get().getKey())).intValue(), true, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue