mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
Laser length... lol
This commit is contained in:
parent
0965c430c3
commit
648ff8b771
3 changed files with 8 additions and 98 deletions
|
@ -1,62 +0,0 @@
|
|||
/*
|
||||
* This file ("LensConversionRecipe.java") is part of the Actually Additions mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2015-2017 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.api.recipe;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
Mi@Deprecated
|
||||
public class LensConversionRecipe {
|
||||
|
||||
protected final Ingredient input;
|
||||
protected final ItemStack output;
|
||||
protected final int energy;
|
||||
protected final Lens type;
|
||||
|
||||
@Deprecated
|
||||
public LensConversionRecipe(ItemStack input, ItemStack output, int energy, Lens type) {
|
||||
this(Ingredient.of(input), output, energy, type);
|
||||
}
|
||||
|
||||
public LensConversionRecipe(Ingredient input, ItemStack output, int energy, Lens type) {
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.energy = energy;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public boolean matches(ItemStack input, Lens lens) {
|
||||
return this.input.test(input) && this.type == lens;
|
||||
}
|
||||
|
||||
public Ingredient getInput() {
|
||||
return this.input;
|
||||
}
|
||||
|
||||
public ItemStack getOutput() {
|
||||
return this.output;
|
||||
}
|
||||
|
||||
public int getEnergyUsed() {
|
||||
return this.energy;
|
||||
}
|
||||
|
||||
public Lens getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void transformHook(ItemStack stack, BlockState state, BlockPos pos, IAtomicReconstructor tile) {
|
||||
}
|
||||
}
|
|
@ -21,6 +21,7 @@ import net.minecraft.client.renderer.IRenderTypeBuffer;
|
|||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.Direction;
|
||||
|
@ -41,6 +42,7 @@ public class ReconstructorRenderer extends TileEntityRenderer<TileEntityAtomicRe
|
|||
ItemStack stack = tile.inv.getStackInSlot(0);
|
||||
//default color 0x1b6dff
|
||||
int color = tile.getBeamColor();
|
||||
int length = 5;
|
||||
Direction direction = tile.getOrientation();
|
||||
float rot = 360.0f - direction.getOpposite().toYRot(); //Sigh...
|
||||
float pitch = 0;
|
||||
|
@ -49,8 +51,13 @@ public class ReconstructorRenderer extends TileEntityRenderer<TileEntityAtomicRe
|
|||
} else if (direction == Direction.DOWN) {
|
||||
pitch = -90;
|
||||
}
|
||||
|
||||
if (stack.getItem() instanceof ILensItem) {
|
||||
length = ((ILensItem) stack.getItem()).getLens().getDistance();
|
||||
}
|
||||
|
||||
if (tile.getProgress() > 0) {
|
||||
AssetUtil.renderLaser(matrices, buffer, 0, 0, 0, rot, pitch, 5, 0, color, 0.8f * tile.getProgress(), 0.2f);
|
||||
AssetUtil.renderLaser(matrices, buffer, 0, 0, 0, rot, pitch, length, 0, color, 0.8f * tile.getProgress(), 0.2f);
|
||||
tile.decTTL();
|
||||
}
|
||||
if (stack.isEmpty() || !(stack.getItem() instanceof ILensItem)) {
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.mod.recipe;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
// TODO: [port][test] check that this works
|
||||
public class EnchBookConversion extends LensConversionRecipe {
|
||||
|
||||
public EnchBookConversion() {
|
||||
super(Ingredient.of(Items.ENCHANTED_BOOK), ItemStack.EMPTY, 155000, ActuallyAdditionsAPI.lensDefaultConversion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transformHook(ItemStack stack, BlockState state, BlockPos pos, IAtomicReconstructor tile) {
|
||||
for (Map.Entry<Enchantment, Integer> e : EnchantmentHelper.getEnchantments(stack).entrySet()) {
|
||||
ItemStack book = new ItemStack(Items.ENCHANTED_BOOK);
|
||||
Map<Enchantment, Integer> ench = ImmutableMap.of(e.getKey(), e.getValue());
|
||||
EnchantmentHelper.setEnchantments(ench, book);
|
||||
Block.popResource(tile.getWorldObject(), pos, book);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue