mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +01:00
Empowerer go brrrr
This commit is contained in:
parent
b0c1e8e8cc
commit
db00cb34d4
7 changed files with 54 additions and 16 deletions
|
@ -731,7 +731,7 @@ c1db85574a99e9e45e1ca2dd1703cc53d4699469 data/actuallyadditions/recipes/empowere
|
||||||
539b7277fb268425ac6302a0ab9c53076f4b3096 data/actuallyadditions/recipes/empowering/diamatine_block.json
|
539b7277fb268425ac6302a0ab9c53076f4b3096 data/actuallyadditions/recipes/empowering/diamatine_block.json
|
||||||
466bb9c977d91a7a43fdb77589a7618a727e86a7 data/actuallyadditions/recipes/empowering/emeradic.json
|
466bb9c977d91a7a43fdb77589a7618a727e86a7 data/actuallyadditions/recipes/empowering/emeradic.json
|
||||||
1228197667cccd15d8e35fadac0ac7582decbae5 data/actuallyadditions/recipes/empowering/emeradic_block.json
|
1228197667cccd15d8e35fadac0ac7582decbae5 data/actuallyadditions/recipes/empowering/emeradic_block.json
|
||||||
0fa5a05c622d7e6541368e8c0d1d8f7d8c0aed5e data/actuallyadditions/recipes/empowering/empowered_canola.json
|
ecbc0d8107b656ce571c0f9114f4e7d310dd4ffe data/actuallyadditions/recipes/empowering/empowered_canola.json
|
||||||
213cd0104647e820a59001c970e0e529fc8aeb0a data/actuallyadditions/recipes/empowering/enori.json
|
213cd0104647e820a59001c970e0e529fc8aeb0a data/actuallyadditions/recipes/empowering/enori.json
|
||||||
b857d3d08f386b2f39bfe0d0f859ed09e626f617 data/actuallyadditions/recipes/empowering/enori_block.json
|
b857d3d08f386b2f39bfe0d0f859ed09e626f617 data/actuallyadditions/recipes/empowering/enori_block.json
|
||||||
27f284d2e2d0121468d73dd60ffa5f25e8858920 data/actuallyadditions/recipes/empowering/palis.json
|
27f284d2e2d0121468d73dd60ffa5f25e8858920 data/actuallyadditions/recipes/empowering/palis.json
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
],
|
],
|
||||||
"energy": 1000,
|
"energy": 1000,
|
||||||
"time": 30,
|
"time": 30,
|
||||||
"color": 88908,
|
"color": 16735052,
|
||||||
"result": {
|
"result": {
|
||||||
"item": "actuallyadditions:empowered_canola_seed"
|
"item": "actuallyadditions:empowered_canola_seed"
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class EmpoweringRecipeGenerator extends RecipeProvider {
|
||||||
.addModifier(ItemTags.SAPLINGS)
|
.addModifier(ItemTags.SAPLINGS)
|
||||||
.addModifier(Tags.Items.SLIMEBALLS).save(consumer, "emeradic_block");
|
.addModifier(Tags.Items.SLIMEBALLS).save(consumer, "emeradic_block");
|
||||||
|
|
||||||
EmpoweringBuilder.builder(ActuallyItems.EMPOWERED_CANOLA_SEED.get(), ActuallyItems.CRYSTALLIZED_CANOLA_SEED.get(), 1000, 30, 0x015b4c)
|
EmpoweringBuilder.builder(ActuallyItems.EMPOWERED_CANOLA_SEED.get(), ActuallyItems.CRYSTALLIZED_CANOLA_SEED.get(), 1000, 30, 0xFF5B4C)
|
||||||
.addModifier(ActuallyItems.CANOLA_SEEDS.get())
|
.addModifier(ActuallyItems.CANOLA_SEEDS.get())
|
||||||
.addModifier(ActuallyItems.CANOLA_SEEDS.get())
|
.addModifier(ActuallyItems.CANOLA_SEEDS.get())
|
||||||
.addModifier(ActuallyItems.CANOLA_SEEDS.get())
|
.addModifier(ActuallyItems.CANOLA_SEEDS.get())
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class BlockDisplayStand extends BlockContainerBase {
|
||||||
return ActionResultType.FAIL;
|
return ActionResultType.FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ActionResultType.PASS;
|
return ActionResultType.CONSUME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -26,6 +26,7 @@ import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Util;
|
import net.minecraft.util.Util;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.vector.Quaternion;
|
import net.minecraft.util.math.vector.Quaternion;
|
||||||
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
import net.minecraft.util.math.vector.Vector3f;
|
import net.minecraft.util.math.vector.Vector3f;
|
||||||
|
|
||||||
public class RenderEmpowerer extends TileEntityRenderer<TileEntityEmpowerer> {
|
public class RenderEmpowerer extends TileEntityRenderer<TileEntityEmpowerer> {
|
||||||
|
@ -72,5 +73,14 @@ public class RenderEmpowerer extends TileEntityRenderer<TileEntityEmpowerer> {
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
if (tile.getCurrentRecipe() != null) {
|
||||||
|
EmpowererRecipe recipe = tile.getCurrentRecipe();
|
||||||
|
for (int i = 0; i <= 3; i++) {
|
||||||
|
Direction facing = Direction.from2DDataValue(i);
|
||||||
|
BlockPos offset = new BlockPos(0,0,0).relative(facing, 3);
|
||||||
|
|
||||||
|
AssetUtil.renderLaser(matrices, buffer, new Vector3d(0.0d, 0.0d, 0.0d), new Vector3d(offset.getX(), offset.getY() + 0.45, offset.getZ()), 80, recipe.getParticleColors(), 1.0f ,0.1F);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes;
|
import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe;
|
import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.crafting.SolidFuelRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
|
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover;
|
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
|
@ -22,6 +23,7 @@ import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.particles.ParticleTypes;
|
import net.minecraft.particles.ParticleTypes;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.server.ServerWorld;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
|
|
||||||
|
@ -34,8 +36,12 @@ import net.minecraftforge.fml.server.ServerLifecycleHooks;
|
||||||
public class TileEntityEmpowerer extends TileEntityInventoryBase {
|
public class TileEntityEmpowerer extends TileEntityInventoryBase {
|
||||||
|
|
||||||
public int processTime;
|
public int processTime;
|
||||||
public int recipeForRenderIndex = -1;
|
private EmpowererRecipe currentRecipe = null;
|
||||||
private int lastRecipe;
|
private EmpowererRecipe lastRecipe = null;
|
||||||
|
|
||||||
|
public EmpowererRecipe getCurrentRecipe(){
|
||||||
|
return this.currentRecipe;
|
||||||
|
}
|
||||||
|
|
||||||
public TileEntityEmpowerer() {
|
public TileEntityEmpowerer() {
|
||||||
super(ActuallyBlocks.EMPOWERER.getTileEntityType(), 1);
|
super(ActuallyBlocks.EMPOWERER.getTileEntityType(), 1);
|
||||||
|
@ -69,7 +75,7 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase {
|
||||||
if (stands != null) {
|
if (stands != null) {
|
||||||
EmpowererRecipe recipe = findMatchingRecipe(this.inv.getStackInSlot(0), stands[0].getStack(), stands[1].getStack(), stands[2].getStack(), stands[3].getStack());
|
EmpowererRecipe recipe = findMatchingRecipe(this.inv.getStackInSlot(0), stands[0].getStack(), stands[1].getStack(), stands[2].getStack(), stands[3].getStack());
|
||||||
if (recipe != null) {
|
if (recipe != null) {
|
||||||
//this.recipeForRenderIndex = ActuallyAdditionsAPI.EMPOWERER_RECIPES.indexOf(recipe); //TODO whats this?
|
currentRecipe = recipe;
|
||||||
|
|
||||||
boolean hasPower = true;
|
boolean hasPower = true;
|
||||||
|
|
||||||
|
@ -104,16 +110,16 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase {
|
||||||
this.setChanged();
|
this.setChanged();
|
||||||
|
|
||||||
this.processTime = 0;
|
this.processTime = 0;
|
||||||
this.recipeForRenderIndex = -1;
|
this.currentRecipe = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.processTime = 0;
|
this.processTime = 0;
|
||||||
this.recipeForRenderIndex = -1;
|
this.currentRecipe = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.lastRecipe != this.recipeForRenderIndex) {
|
if (this.lastRecipe != this.currentRecipe) {
|
||||||
this.lastRecipe = this.recipeForRenderIndex;
|
this.lastRecipe = this.currentRecipe;
|
||||||
this.sendUpdate();
|
this.sendUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,8 +129,7 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase {
|
||||||
private TileEntityDisplayStand[] getNearbyStands() {
|
private TileEntityDisplayStand[] getNearbyStands() {
|
||||||
TileEntityDisplayStand[] stands = new TileEntityDisplayStand[4];
|
TileEntityDisplayStand[] stands = new TileEntityDisplayStand[4];
|
||||||
|
|
||||||
// TODO: [port] validate this
|
for (int i = 0; i <= 3; i++) {
|
||||||
for (int i = 0; i < 3; i++) {
|
|
||||||
Direction facing = Direction.from2DDataValue(i);
|
Direction facing = Direction.from2DDataValue(i);
|
||||||
BlockPos offset = this.worldPosition.relative(facing, 3);
|
BlockPos offset = this.worldPosition.relative(facing, 3);
|
||||||
TileEntity tile = this.level.getBlockEntity(offset);
|
TileEntity tile = this.level.getBlockEntity(offset);
|
||||||
|
@ -145,7 +150,10 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase {
|
||||||
compound.putInt("ProcessTime", this.processTime);
|
compound.putInt("ProcessTime", this.processTime);
|
||||||
}
|
}
|
||||||
if (type == NBTType.SYNC) {
|
if (type == NBTType.SYNC) {
|
||||||
compound.putInt("RenderIndex", this.recipeForRenderIndex);
|
if (this.currentRecipe != null)
|
||||||
|
compound.putString("CurrentRecipe", this.currentRecipe.getId().toString());
|
||||||
|
else
|
||||||
|
compound.putString("CurrentRecipe", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,8 +163,18 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase {
|
||||||
if (type == NBTType.SAVE_TILE) {
|
if (type == NBTType.SAVE_TILE) {
|
||||||
this.processTime = compound.getInt("ProcessTime");
|
this.processTime = compound.getInt("ProcessTime");
|
||||||
}
|
}
|
||||||
if (type == NBTType.SYNC) {
|
if (type == NBTType.SYNC && compound.contains("CurrentRecipe")) {
|
||||||
this.recipeForRenderIndex = compound.getInt("RenderIndex");
|
if (!compound.getString("CurrentRecipe").equals("")) {
|
||||||
|
ResourceLocation id = new ResourceLocation(compound.getString("CurrentRecipe"));
|
||||||
|
for (EmpowererRecipe empowererRecipe : ActuallyAdditionsAPI.EMPOWERER_RECIPES) {
|
||||||
|
if (empowererRecipe.getId().equals(id)) {
|
||||||
|
this.currentRecipe = empowererRecipe;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
this.currentRecipe = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -303,6 +303,16 @@ public final class AssetUtil {
|
||||||
matrixStack.popPose();
|
matrixStack.popPose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void renderLaser(MatrixStack matrixStack, IRenderTypeBuffer buffer, Vector3d startOffset, Vector3d endOffset, float rotationTime, int color, float alpha, float beamWidth) {
|
||||||
|
Vector3d combined = endOffset.subtract(startOffset);
|
||||||
|
|
||||||
|
double pitch = Math.toDegrees(Math.atan2(combined.y, Math.sqrt(combined.x * combined.x + combined.z * combined.z)));
|
||||||
|
double yaw = Math.toDegrees(Math.atan2(-combined.z, combined.x));
|
||||||
|
double length = combined.length();
|
||||||
|
|
||||||
|
renderLaser(matrixStack, buffer, (float) startOffset.x, (float) startOffset.y, (float) startOffset.z, (float) yaw, (float) pitch, (float) length, rotationTime, color, alpha, beamWidth);
|
||||||
|
}
|
||||||
|
|
||||||
//Thanks to feldim2425 for this.
|
//Thanks to feldim2425 for this.
|
||||||
//I can't do rendering code. Ever.
|
//I can't do rendering code. Ever.
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
|
Loading…
Reference in a new issue