Skip to content

Commit

Permalink
Merge pull request #3 from GideonHead/revert-2-revert-1-staffs
Browse files Browse the repository at this point in the history
Revert "Revert "Staff magic class and restructuring""
  • Loading branch information
GideonHead authored Jul 19, 2023
2 parents fd8db3f + 65ae4ac commit dd1423f
Show file tree
Hide file tree
Showing 29 changed files with 449 additions and 142 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
- Suspicion mob effect (affected mobs will be forced away from other affected mobs)
- Uncarved Wood Variants (Polished uncarved Wood, Carved Heavy Planks, Carved Knotted Wood, Carved Planks)
- Expanded number of Minecraft/Forge item/block tags that Minestuck items/blocks are in
- Fire and Water Staffs
- Anthvil block
- Power hub block
- Fire, Water, and Wizard Staffs
- Rubik's Mace
- Fire, Water, and Wizard Staffs
- Staff Handle
- Rubik's Mace, mACE of Clubs, and Home Grown Mace Weapons.
- Anthvil block
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1756,7 +1756,6 @@
"item.minestuck.sporeo.tooltip": "Huh. Who knew fungal spores could be so delicious?",
"item.minestuck.spork": "Spork",
"item.minestuck.stack_modus_card": "Stack Modus",
"item.minestuck.staff_handle": "Staff Handle",
"item.minestuck.stale_baguette": "Stale Baguette",
"item.minestuck.star_ray": "Star Ray",
"item.minestuck.star_ray.tooltip": "The power of the sun within the palm of your hand.",
Expand Down Expand Up @@ -1852,6 +1851,7 @@
"item.minestuck.white_queens_ring": "White Queen's Ring",
"item.minestuck.white_queens_ring.tooltip": "One of a pair. Cast it into the fire!",
"item.minestuck.wiseguy": "Wise Guy",
"item.minestuck.wizard_staff": "Wizard Staff",
"item.minestuck.wooden_carrot": "Wooden Carrot",
"item.minestuck.wooden_carrot.tooltip": "It's as edible as a plank.",
"item.minestuck.wooden_lance": "Wooden Lance",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "minestuck:item/fire_staff"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "minestuck:item/rubiks_mace"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "minestuck:item/water_staff"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "minestuck:item/wizard_staff"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "minestuck:combination",
"input1": {
"item": "minestuck:staff_handle"
"item": "minestuck:wizard_staff"
},
"input2": {
"item": "minecraft:magma_cream"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "minestuck:combination",
"input1": {
"item": "minestuck:staff_handle"
"item": "minestuck:wizard_staff"
},
"input2": {
"item": "minecraft:heart_of_the_sea"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"type": "minestuck:combination",
"input1": {
"item": "minestuck:mini_wizard_statue"
},
"input2": {
"item": "minestuck:cane"
},
"mode": "and",
"output": {
"item": "minestuck:wizard_staff"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"type": "minestuck:grist_cost",
"grist_cost": {
"minestuck:build": 203532
"minestuck:amber": 116,
"minestuck:mercury": 116,
"minestuck:quartz": 5,
"minestuck:ruby": 116,
"minestuck:sulfur": 116
},
"ingredient": {
"item": "minestuck:fire_staff"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"type": "minestuck:grist_cost",
"grist_cost": {
"minestuck:build": 545
"minestuck:build": 80,
"minestuck:cobalt": 64,
"minestuck:marble": 32
},
"ingredient": {
"item": "minestuck:rubiks_mace"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"type": "minestuck:grist_cost",
"grist_cost": {
"minestuck:build": 203532
"minestuck:amethyst": 85,
"minestuck:caulk": 85,
"minestuck:garnet": 85,
"minestuck:mercury": 85,
"minestuck:quartz": 5
},
"ingredient": {
"item": "minestuck:water_staff"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"type": "minestuck:grist_cost",
"grist_cost": {
"minestuck:amber": 46,
"minestuck:build": 46,
"minestuck:caulk": 46,
"minestuck:marble": 46
},
"ingredient": {
"item": "minestuck:wizard_staff"
}
}
123 changes: 97 additions & 26 deletions src/main/java/com/mraof/minestuck/client/util/MagicEffect.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,13 @@
import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.ThrownPotion;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.alchemy.Potion;
import net.minecraft.world.item.alchemy.PotionUtils;
import net.minecraft.world.item.alchemy.Potions;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;

import java.util.List;
import java.util.function.Supplier;

import static net.minecraft.world.entity.projectile.ThrownPotion.WATER_SENSITIVE;

public class MagicEffect
{
public enum Type
public enum RangedType
{
GREEN(() -> new DustParticleOptions(new Vector3f(0F, 1F, 0F), 2F), false, false),
CRIT(() -> ParticleTypes.ENCHANTED_HIT, false, false),
Expand All @@ -46,7 +30,7 @@ public enum Type
private final boolean explosiveFinish;
private final boolean extraParticles;

Type(Supplier<ParticleOptions> particle, boolean explosiveFinish, boolean extraParticles)
RangedType(Supplier<ParticleOptions> particle, boolean explosiveFinish, boolean extraParticles)
{
this.particle = particle;
this.explosiveFinish = explosiveFinish;
Expand All @@ -58,34 +42,64 @@ public int toInt()
return ordinal();
}

public static Type fromInt(int i)
public static RangedType fromInt(int i)
{
if(i >= 0 && i < values().length)
return values()[i];
else return ENCHANT;
}
}

public static void particleEffect(Type type, ClientLevel level, Vec3 pos, Vec3 lookVector, int length, boolean collides)
public enum AOEType
{
particleEffect(type.particle.get(), type.explosiveFinish, type.extraParticles, level, pos, lookVector, length, collides);
ENCHANT(() -> ParticleTypes.ENCHANT, true, false),
WATER(() -> ParticleTypes.SPLASH, true, true),
FIRE(() -> ParticleTypes.FLAME, true, true);

private final Supplier<ParticleOptions> particle;
private final boolean perimeterParticles;
private final boolean extraParticles;

AOEType(Supplier<ParticleOptions> particle, boolean perimeterParticles, boolean extraParticles)
{
this.particle = particle;
this.perimeterParticles = perimeterParticles;
this.extraParticles = extraParticles;
}

public int toInt()
{
return ordinal();
}

public static AOEType fromInt(int i)
{
if(i >= 0 && i < values().length)
return values()[i];
else return ENCHANT;
}
}

public static void rangedParticleEffect(RangedType type, ClientLevel level, Vec3 pos, Vec3 lookVector, int length, boolean collides)
{
rangedParticleEffect(type.particle.get(), type.explosiveFinish, type.extraParticles, level, pos, lookVector, length, collides);
}

public static void particleEffect(ParticleOptions particle, boolean explosiveFinish, boolean extraParticles, ClientLevel level, Vec3 pos, Vec3 lookVector, int length, boolean collides)
public static void rangedParticleEffect(ParticleOptions particle, boolean explosiveFinish, boolean extraParticles, ClientLevel level, Vec3 pos, Vec3 lookVector, int length, boolean collides)
{
for(int step = 0; step <= length; step++)
{
pathParticles(particle, extraParticles, level, pos.add(lookVector.scale(step / 2D)), step);
rangedPathParticles(particle, extraParticles, level, pos.add(lookVector.scale(step / 2D)), step);

if(collides && step == length)
{
// uses the vector to a prior position before it was inside a block/entity so that the flash particle is not obscured and particles can fly out
collisionEffect(particle, explosiveFinish, level, pos.add(lookVector.scale((step - 1) / 2D)));
rangedCollisionEffect(particle, explosiveFinish, level, pos.add(lookVector.scale((step - 1) / 2D)));
}
}
}

private static void pathParticles(ParticleOptions particle, boolean extraParticles, ClientLevel level, Vec3 vecPos, int i)
private static void rangedPathParticles(ParticleOptions particle, boolean extraParticles, ClientLevel level, Vec3 vecPos, int i)
{
// starts creating particle trail along vector path after a few runs, its away from the players vision so they do not obscure everything
if(i >= 5)
Expand All @@ -108,7 +122,7 @@ private static void pathParticles(ParticleOptions particle, boolean extraParticl
}
}

private static void collisionEffect(ParticleOptions particle, boolean explosiveFinish, ClientLevel level, Vec3 vecPos)
private static void rangedCollisionEffect(ParticleOptions particle, boolean explosiveFinish, ClientLevel level, Vec3 vecPos)
{
int particles = 25 + level.random.nextInt(10);

Expand All @@ -126,4 +140,61 @@ private static void collisionEffect(ParticleOptions particle, boolean explosiveF
level.addParticle(ParticleTypes.CRIT, true, vecPos.x, vecPos.y, vecPos.z, level.random.nextGaussian(), level.random.nextGaussian(), level.random.nextGaussian());
}
}

public static void AOEParticleEffect(AOEType type, ClientLevel level, Vec3 minAOEBound, Vec3 maxAOEBound)
{
AOEParticleEffect(type.particle.get(), type.perimeterParticles, type.extraParticles, level, minAOEBound, maxAOEBound);
}

public static void AOEParticleEffect(ParticleOptions particle, boolean perimeterParticles, boolean extraParticles, ClientLevel level, Vec3 minAOEBound, Vec3 maxAOEBound)
{
if(!perimeterParticles)
return;

double minX = minAOEBound.x;
double minZ = minAOEBound.z;
double maxX = maxAOEBound.x;
double maxZ = maxAOEBound.z;
double y = (maxAOEBound.y + minAOEBound.y) / 2 + 4;

for(double x = minX; x < maxX; x += 0.5D)
{
level.addParticle(particle, true, x, y + randomVariation(level), minZ, 0.0D, 0.0D, 0.0D);
level.addParticle(particle, true, x, y + randomVariation(level), maxZ, 0.0D, 0.0D, 0.0D);

if(extraParticles)
{
extraParticles(particle, level, new Vec3(x, y, minZ));
extraParticles(particle, level, new Vec3(x, y, maxZ));
}
}

for(double z = minZ; z < maxZ; z += 0.5D)
{
level.addParticle(particle, true, minX, y + randomVariation(level), z, 0.0D, 0.0D, 0.0D);
level.addParticle(particle, true, maxX, y + randomVariation(level), z, 0.0D, 0.0D, 0.0D);

if(extraParticles)
{
extraParticles(particle, level, new Vec3(minX, y, z));
extraParticles(particle, level, new Vec3(maxX, y, z));
}
}
}

private static void extraParticles(ParticleOptions particle, ClientLevel level, Vec3 vecPos)
{
for(float a = 0; a < 4; a++)
{
level.addParticle(particle, true, vecPos.x, vecPos.y + randomVariation(level), vecPos.z, 0.0D, 0.0D, 0.0D);
}
}

/**
* Returns a random float between -4 and 4 for use in position offsetting
*/
private static float randomVariation(ClientLevel level)
{
return level.random.nextFloat() - .5F * 8;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,7 @@ protected void addTranslations()
addItem(MSItems.DESOLATOR_MACE, "Desolator Mace");
addItemTooltip(MSItems.DESOLATOR_MACE, "Void your enemies existence. Is the damage really that low?");
addItem(MSItems.BLAZING_GLORY, "Blazing Glory");
addItem(MSItems.RUBIKS_MACE, "Rubik's Mace");
addItem(MSItems.HORSE_HITCHER, "Cast Iron Horse Hitcher");
addItem(MSItems.ACE_OF_SPADES, "Ace of Spades");
addItemStore(MSItems.ACE_OF_SPADES, "Shovel Sigil");
Expand All @@ -926,6 +927,9 @@ protected void addTranslations()
addItem(MSItems.ACE_OF_HEARTS, "Ace of Hearts");
addItemStore(MSItems.ACE_OF_HEARTS, "Heart Sigil");
addItemStoreTooltip(MSItems.ACE_OF_HEARTS, "This thing MUST have magical love powers!");
addItem(MSItems.WIZARD_STAFF, "Wizard Staff");
addItem(MSItems.WATER_STAFF, "Water Staff");
addItem(MSItems.FIRE_STAFF, "Fire Staff");
addItem(MSItems.WHITE_KINGS_SCEPTER, "Kings Scepter");
addItemTooltip(MSItems.WHITE_KINGS_SCEPTER, "Starts the Reckoning in the capable hands of a carapacian. It would be hard to call YOU capable however...");
addItem(MSItems.BLACK_KINGS_SCEPTER, "Kings Scepter");
Expand Down Expand Up @@ -1030,10 +1034,6 @@ protected void addTranslations()
addItem(MSItems.THISTLE_OF_ZILLYWICH, "Thistle of Zillywich");
addItemTooltip(MSItems.THISTLE_OF_ZILLYWICH, "Flippety dippety doo bup bup shrubber double floppy mumblescurry noodlescoop pizzabubble pizzabubble mip mip mip mip mip mip.");
addItem(MSItems.QUILL_OF_ECHIDNA, "Quill of Echidna");
addItem(MSItems.WATER_STAFF, "Water Staff");
addItem(MSItems.FIRE_STAFF, "Fire Staff");
addItem(MSItems.RUBIKS_MACE, "Rubik's Mace");
addItem(MSItems.STAFF_HANDLE, "Staff Handle");
addItem(MSItems.SBAHJARANG, "SBaHJarang");
addItemTooltip(MSItems.SBAHJARANG, "Worst throwing weapon money can't buy");
addItem(MSItems.SHURIKEN, "Shuriken");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,16 @@ protected void registerModels()
{

handheldItemTextureName(MSItems.ACE_OF_CLUBS, "ace_clubs");


//Staffs
handheldItemTextureName(MSItems.WIZARD_STAFF, "wizard_staff");
handheldItemTextureName(MSItems.WATER_STAFF, "water_staff");
handheldItemTextureName(MSItems.FIRE_STAFF, "fire_staff");

//Clubs
handheldItem(MSItems.M_ACE_OF_CLUBS);
handheldItem(MSItems.HOME_GROWN_MACE);
handheldItemTextureName(MSItems.RUBIKS_MACE, "rubiks_mace");

//Blocks
blockItem(MSBlocks.UNCARVED_WOOD);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,6 @@ protected void buildCraftingRecipes(Consumer<FinishedRecipe> consumer)
CombinationRecipeBuilder.of(MSItems.KRAKENS_EYE.get()).input(Items.HEART_OF_THE_SEA).or().input(MSItems.CLAYMORE.get()).build(consumer);
CombinationRecipeBuilder.of(MSItems.CINNAMON_SWORD.get()).input(Items.WOODEN_SWORD).and().input(MSItems.CANDY_CORN.get()).build(consumer);
CombinationRecipeBuilder.of(MSItems.UNION_BUSTER.get()).input(MSItems.ROCKEFELLERS_WALKING_BLADECANE.get()).and().input(MSItems.NIGHTSTICK.get()).build(consumer);
CombinationRecipeBuilder.of(MSItems.STAFF_HANDLE.get()).input(MSItems.MINI_WIZARD_STATUE.get()).and().input(Items.DIAMOND).build(consumer);
CombinationRecipeBuilder.of(MSItems.WATER_STAFF.get()).input(MSItems.STAFF_HANDLE.get()).and().input(Items.HEART_OF_THE_SEA).build(consumer);
CombinationRecipeBuilder.of(MSItems.FIRE_STAFF.get()).input(MSItems.STAFF_HANDLE.get()).and().input(Items.MAGMA_CREAM).build(consumer);

CombinationRecipeBuilder.of(MSItems.DIAMOND_DAGGER.get()).input(MSItems.DAGGER.get()).and().input(Items.DIAMOND).build(consumer);
CombinationRecipeBuilder.of(MSItems.PIGLINS_PRIDE.get()).input(MSItems.DIAMOND_DAGGER.get()).and().input(Items.NETHERITE_INGOT).build(consumer);
Expand Down Expand Up @@ -550,6 +547,9 @@ protected void buildCraftingRecipes(Consumer<FinishedRecipe> consumer)
CombinationRecipeBuilder.of(MSItems.SCARLET_ZILLYHOO.get()).input(MSItems.ZILLYHOO_HAMMER.get()).and().input(MSItems.FROG.get()).build(consumer);
CombinationRecipeBuilder.of(MSItems.MWRTHWL.get()).input(MSItems.REGI_HAMMER.get()).or().input(MSItems.CUEBALL.get()).build(consumer);

CombinationRecipeBuilder.of(MSItems.WIZARD_STAFF.get()).input(MSItems.MINI_WIZARD_STATUE.get()).and().input(MSItems.CANE.get()).build(consumer);
CombinationRecipeBuilder.of(MSItems.WATER_STAFF.get()).input(MSItems.WIZARD_STAFF.get()).and().input(Items.HEART_OF_THE_SEA).build(consumer);
CombinationRecipeBuilder.of(MSItems.FIRE_STAFF.get()).input(MSItems.WIZARD_STAFF.get()).and().input(Items.MAGMA_CREAM).build(consumer);
CombinationRecipeBuilder.of(MSItems.PRIME_STAFF.get()).input(MSItems.BLACK_KINGS_SCEPTER.get()).and().input(MSItems.SBAHJ_POSTER.get()).build(consumer);

CombinationRecipeBuilder.of(MSItems.VAUDEVILLE_HOOK.get()).namedInput(MSItems.CANE.get()).and().input(Items.FISHING_ROD).build(consumer);
Expand Down
Loading

0 comments on commit dd1423f

Please sign in to comment.