Added Day and Night alchemy arrays
- Added new alchemy arrays: - Two arrays, which changes the current daylight cycle to day and night. - Fixed the JEI so that it no longer ouputs an error when loading Alchemy Array recipes without a crafting output.
This commit is contained in:
parent
a0b756240f
commit
dac93b7ec4
23 changed files with 781 additions and 23 deletions
|
@ -1,11 +1,18 @@
|
|||
package wayoftime.bloodmagic.common.alchemyarray;
|
||||
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.effect.LightningBoltEntity;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemyArray;
|
||||
|
||||
public class AlchemyArrayEffectDay extends AlchemyArrayEffect
|
||||
{
|
||||
private long startingTime = 0;
|
||||
|
||||
public AlchemyArrayEffectDay()
|
||||
{
|
||||
|
||||
|
@ -14,21 +21,58 @@ public class AlchemyArrayEffectDay extends AlchemyArrayEffect
|
|||
@Override
|
||||
public boolean update(TileAlchemyArray tile, int ticksActive)
|
||||
{
|
||||
// TODO: Add recipe rechecking to verify nothing screwy is going on.
|
||||
if (tile.getWorld().isRemote)
|
||||
// if (ticksActive < 200)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
World world = tile.getWorld();
|
||||
|
||||
if (ticksActive == 100)
|
||||
{
|
||||
startingTime = world.getDayTime();
|
||||
tile.doDropIngredients(false);
|
||||
}
|
||||
|
||||
if (ticksActive <= 100)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tile.getWorld() instanceof ServerWorld)
|
||||
// TODO: Add recipe rechecking to verify nothing screwy is going on.
|
||||
if (world.isRemote && world instanceof ClientWorld)
|
||||
{
|
||||
long time = (tile.getWorld().getGameTime() / 24000) * 24000;
|
||||
for (ServerWorld serverworld : tile.getWorld().getServer().getWorlds())
|
||||
long finalTime = ((world.getDayTime() + 24000) / 24000) * 24000;
|
||||
long time = (finalTime - startingTime) * (ticksActive - 100) / 100 + startingTime;
|
||||
|
||||
((ClientWorld) world).getWorldInfo().setDayTime(time);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (world instanceof ServerWorld)
|
||||
{
|
||||
// world.getDayTime()
|
||||
long finalTime = ((world.getDayTime() + 24000) / 24000) * 24000;
|
||||
long time = (finalTime - startingTime) * (ticksActive - 100) / 100 + startingTime;
|
||||
for (ServerWorld serverworld : world.getServer().getWorlds())
|
||||
{
|
||||
serverworld.func_241114_a_((long) time);
|
||||
}
|
||||
|
||||
return true;
|
||||
if (ticksActive >= 200)
|
||||
{
|
||||
BlockPos pos = tile.getPos();
|
||||
LightningBoltEntity lightningboltentity = EntityType.LIGHTNING_BOLT.create(world);
|
||||
// LightningBoltEntity lightning = new LightningBoltEntity(world, pos.getX() + dispX, pos.getY(), pos.getZ() + dispZ);
|
||||
lightningboltentity.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
|
||||
lightningboltentity.setEffectOnly(true);
|
||||
world.addEntity(lightningboltentity);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
package wayoftime.bloodmagic.common.alchemyarray;
|
||||
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.effect.LightningBoltEntity;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemyArray;
|
||||
|
||||
public class AlchemyArrayEffectNight extends AlchemyArrayEffect
|
||||
{
|
||||
private long startingTime = 0;
|
||||
|
||||
public AlchemyArrayEffectNight()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(TileAlchemyArray tile, int ticksActive)
|
||||
{
|
||||
// if (ticksActive < 200)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
World world = tile.getWorld();
|
||||
if (ticksActive == 100)
|
||||
{
|
||||
startingTime = world.getDayTime();
|
||||
tile.doDropIngredients(false);
|
||||
}
|
||||
|
||||
if (ticksActive <= 100)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: Add recipe rechecking to verify nothing screwy is going on.
|
||||
|
||||
if (world.isRemote && world instanceof ClientWorld)
|
||||
{
|
||||
long finalTime = ((world.getDayTime() + 11000) / 24000) * 24000 + 13000;
|
||||
long time = (finalTime - startingTime) * (ticksActive - 100) / 100 + startingTime;
|
||||
|
||||
((ClientWorld) world).getWorldInfo().setDayTime(time);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (world instanceof ServerWorld)
|
||||
{
|
||||
// world.getDayTime()
|
||||
long finalTime = ((world.getDayTime() + 11000) / 24000) * 24000 + 13000;
|
||||
long time = (finalTime - startingTime) * (ticksActive - 100) / 100 + startingTime;
|
||||
for (ServerWorld serverworld : world.getServer().getWorlds())
|
||||
{
|
||||
serverworld.func_241114_a_((long) time);
|
||||
}
|
||||
|
||||
if (ticksActive >= 200)
|
||||
{
|
||||
BlockPos pos = tile.getPos();
|
||||
LightningBoltEntity lightningboltentity = EntityType.LIGHTNING_BOLT.create(world);
|
||||
// LightningBoltEntity lightning = new LightningBoltEntity(world, pos.getX() + dispX, pos.getY(), pos.getZ() + dispZ);
|
||||
lightningboltentity.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
|
||||
lightningboltentity.setEffectOnly(true);
|
||||
world.addEntity(lightningboltentity);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(CompoundNBT tag)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(CompoundNBT tag)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlchemyArrayEffect getNewCopy()
|
||||
{
|
||||
return new AlchemyArrayEffectNight();
|
||||
}
|
||||
}
|
|
@ -39,7 +39,8 @@ public class AlchemyArrayRecipeProvider implements ISubRecipeProvider
|
|||
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/updraftarray.png"), Ingredient.fromItems(Items.FEATHER), Ingredient.fromTag(Tags.Items.DUSTS_GLOWSTONE), ItemStack.EMPTY).build(consumer, BloodMagic.rl(basePath + "updraft"));
|
||||
AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/spikearray.png"), Ingredient.fromItems(Items.COBBLESTONE), Ingredient.fromTag(Tags.Items.INGOTS_IRON), ItemStack.EMPTY).build(consumer, BloodMagic.rl(basePath + "spike"));
|
||||
AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/spikearray.png"), Ingredient.fromItems(Items.COAL), Ingredient.fromItems(Items.COAL), ItemStack.EMPTY).build(consumer, BloodMagic.rl(basePath + "day"));
|
||||
AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/sunarray.png"), Ingredient.fromItems(Items.COAL), Ingredient.fromItems(Items.COAL), ItemStack.EMPTY).build(consumer, BloodMagic.rl(basePath + "day"));
|
||||
AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/moonarray.png"), Ingredient.fromItems(Items.LAPIS_LAZULI), Ingredient.fromItems(Items.LAPIS_LAZULI), ItemStack.EMPTY).build(consumer, BloodMagic.rl(basePath + "night"));
|
||||
// AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/fastminersigil.png"),
|
||||
// Ingredient.fromItems(BloodMagicItems.REAGENT_FAST_MINER.get()),
|
||||
// Ingredient.fromItems(BloodMagicItems.REINFORCED_SLATE.get()), new
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue