Make Veridium Ore Create Area Effect Cloud When Melted With Laser

This commit is contained in:
TheBrokenRail 2020-07-28 18:18:54 -04:00
parent 507cd5897d
commit efd5e713a8
3 changed files with 19 additions and 3 deletions

View File

@ -4,11 +4,13 @@ import com.thebrokenrail.energonrelics.EnergonRelics;
import com.thebrokenrail.energonrelics.block.entity.forcefield.FieldProjectorBlockEntity; import com.thebrokenrail.energonrelics.block.entity.forcefield.FieldProjectorBlockEntity;
import com.thebrokenrail.energonrelics.block.forcefield.laser.IndustrialLaserProjectorBlock; import com.thebrokenrail.energonrelics.block.forcefield.laser.IndustrialLaserProjectorBlock;
import com.thebrokenrail.energonrelics.config.HardcodedConfig; import com.thebrokenrail.energonrelics.config.HardcodedConfig;
import com.thebrokenrail.energonrelics.potion.CustomPotions;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.TntBlock; import net.minecraft.block.TntBlock;
import net.minecraft.block.entity.BlockEntityType; import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.AreaEffectCloudEntity;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.particle.ParticleTypes; import net.minecraft.particle.ParticleTypes;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
@ -62,6 +64,17 @@ public class IndustrialLaserBlockEntity extends FieldProjectorBlockEntity {
Block.dropStack(getWorld(), targetPos, IndustrialLaserRegistry.get(targetState.getBlock(), getWorld().random)); Block.dropStack(getWorld(), targetPos, IndustrialLaserRegistry.get(targetState.getBlock(), getWorld().random));
getWorld().breakBlock(targetPos, false); getWorld().breakBlock(targetPos, false);
if (targetState.getBlock() == EnergonRelics.VERIDIUM_ORE_BLOCK) {
AreaEffectCloudEntity areaEffectCloudEntity = new AreaEffectCloudEntity(getWorld(), targetPos.getX() + 0.5d, targetPos.getY() + 0.5d, targetPos.getZ() + 0.5d);
areaEffectCloudEntity.setRadius(2.1f);
areaEffectCloudEntity.setRadiusOnUse(-0.5f);
areaEffectCloudEntity.setWaitTime(10);
areaEffectCloudEntity.setDuration(areaEffectCloudEntity.getDuration() / 2);
areaEffectCloudEntity.setRadiusGrowth(-areaEffectCloudEntity.getRadius() / (float) areaEffectCloudEntity.getDuration());
areaEffectCloudEntity.addEffect(CustomPotions.VERIDIUM_POISON_EFFECT.statusEffectInstance);
getWorld().spawnEntity(areaEffectCloudEntity);
}
progress = 0; progress = 0;
} else { } else {
Vec3d vec = Vec3d.ofCenter(targetPos); Vec3d vec = Vec3d.ofCenter(targetPos);

View File

@ -21,11 +21,13 @@ public class CustomPotions {
} }
public final StatusEffect statusEffect; public final StatusEffect statusEffect;
public final StatusEffectInstance statusEffectInstance;
private final Potion potion; private final Potion potion;
private final Potion longPotion; private final Potion longPotion;
private CustomPotion(StatusEffect statusEffect, Potion potion, Potion longPotion) { private CustomPotion(StatusEffect statusEffect, StatusEffectInstance statusEffectInstance, Potion potion, Potion longPotion) {
this.statusEffect = statusEffect; this.statusEffect = statusEffect;
this.statusEffectInstance = statusEffectInstance;
this.potion = potion; this.potion = potion;
this.longPotion = longPotion; this.longPotion = longPotion;
} }
@ -41,9 +43,10 @@ public class CustomPotions {
@SuppressWarnings("SameParameterValue") @SuppressWarnings("SameParameterValue")
private static CustomPotion registerEffect(String name, int color) { private static CustomPotion registerEffect(String name, int color) {
StatusEffect effect = Registry.register(Registry.STATUS_EFFECT, new Identifier(EnergonRelics.NAMESPACE, name), new CustomPotion.CustomStatusEffect(StatusEffectType.HARMFUL, color)); StatusEffect effect = Registry.register(Registry.STATUS_EFFECT, new Identifier(EnergonRelics.NAMESPACE, name), new CustomPotion.CustomStatusEffect(StatusEffectType.HARMFUL, color));
Potion potion = Registry.register(Registry.POTION, new Identifier(EnergonRelics.NAMESPACE, name), new Potion(EnergonRelics.NAMESPACE + '.' + name, new StatusEffectInstance(effect, 1800))); StatusEffectInstance statusEffectInstance = new StatusEffectInstance(effect, 1800);
Potion potion = Registry.register(Registry.POTION, new Identifier(EnergonRelics.NAMESPACE, name), new Potion(EnergonRelics.NAMESPACE + '.' + name, statusEffectInstance));
Potion longPotion = Registry.register(Registry.POTION, new Identifier(EnergonRelics.NAMESPACE, "long_" + name), new Potion(EnergonRelics.NAMESPACE + '.' + name, new StatusEffectInstance(effect, 4800))); Potion longPotion = Registry.register(Registry.POTION, new Identifier(EnergonRelics.NAMESPACE, "long_" + name), new Potion(EnergonRelics.NAMESPACE + '.' + name, new StatusEffectInstance(effect, 4800)));
return new CustomPotion(effect, potion, longPotion); return new CustomPotion(effect, statusEffectInstance, potion, longPotion);
} }
private static void registerBrewingRecipes() { private static void registerBrewingRecipes() {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 859 B

After

Width:  |  Height:  |  Size: 2.2 KiB