mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
So much porting...
This commit is contained in:
parent
a6b359e1a7
commit
d3780c5011
36 changed files with 453 additions and 1536 deletions
|
@ -37,11 +37,6 @@ public interface IPhantomTile {
|
|||
*/
|
||||
void setBoundPosition(BlockPos pos);
|
||||
|
||||
/**
|
||||
* @return The ID of the GUI it opens, -1 if none
|
||||
*/
|
||||
int getGuiID();
|
||||
|
||||
/**
|
||||
* @return The range the tile currently has
|
||||
*/
|
||||
|
|
|
@ -132,35 +132,35 @@ public class EmpoweringRecipeGenerator extends RecipeProvider {
|
|||
|
||||
public EmpoweringBuilder addModifier(IItemProvider input) {
|
||||
if (modifiers.size() >= 4)
|
||||
throw new InvalidStateException("too many modifiers for empowering recipe, input: " + input.asItem().getRegistryName());
|
||||
throw new IllegalStateException("too many modifiers for empowering recipe, input: " + input.asItem().getRegistryName());
|
||||
modifiers.add(Ingredient.of(input));
|
||||
return this;
|
||||
}
|
||||
|
||||
public EmpoweringBuilder addModifier(ItemStack input) {
|
||||
if (modifiers.size() >= 4)
|
||||
throw new InvalidStateException("too many modifiers for empowering recipe, input: " + input.getItem().getRegistryName());
|
||||
throw new IllegalStateException("too many modifiers for empowering recipe, input: " + input.getItem().getRegistryName());
|
||||
modifiers.add(Ingredient.of(input));
|
||||
return this;
|
||||
}
|
||||
|
||||
public EmpoweringBuilder addModifier(ITag<Item> input) {
|
||||
if (modifiers.size() >= 4)
|
||||
throw new InvalidStateException("too many modifiers for empowering recipe, input: " + input.toString());
|
||||
throw new IllegalStateException("too many modifiers for empowering recipe, input: " + input.toString());
|
||||
modifiers.add(Ingredient.of(input));
|
||||
return this;
|
||||
}
|
||||
|
||||
public void save(Consumer<IFinishedRecipe> consumer, ResourceLocation name) {
|
||||
if (modifiers.size() != 4)
|
||||
throw new InvalidStateException("invalid modifier count: " + modifiers.size() + ", recipe: " + name.toString());
|
||||
throw new IllegalStateException("invalid modifier count: " + modifiers.size() + ", recipe: " + name.toString());
|
||||
consumer.accept(new EmpowererRecipe.FinishedRecipe(name, result, base, modifiers.get(0), modifiers.get(1), modifiers.get(2), modifiers.get(3), energy, time, color));
|
||||
}
|
||||
|
||||
public void save(Consumer<IFinishedRecipe> consumer, String name) {
|
||||
ResourceLocation res = new ResourceLocation(ActuallyAdditions.MODID, "empowering/" + name);
|
||||
if (modifiers.size() != 4)
|
||||
throw new InvalidStateException("invalid modifier count: " + modifiers.size() + ", recipe: " + res);
|
||||
throw new IllegalStateException("invalid modifier count: " + modifiers.size() + ", recipe: " + res);
|
||||
consumer.accept(new EmpowererRecipe.FinishedRecipe(res, result, base, modifiers.get(0), modifiers.get(1), modifiers.get(2), modifiers.get(3), energy, time, color));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes;
|
|||
import de.ellpeck.actuallyadditions.mod.crafting.TargetNBTIngredient;
|
||||
import de.ellpeck.actuallyadditions.mod.crafting.WrappedRecipe;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
|
||||
import net.minecraft.data.*;
|
||||
import net.minecraft.enchantment.Enchantments;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -171,12 +170,12 @@ public class ItemRecipeGenerator extends RecipeProvider {
|
|||
.define('S', ActuallyItems.ENORI_CRYSTAL.get()).save(consumer);
|
||||
|
||||
|
||||
//Rice Recipes
|
||||
/* //Rice Recipes
|
||||
Recipe.shaped(Items.PAPER, 3)
|
||||
.pattern("R ")
|
||||
.pattern(" R ")
|
||||
.pattern(" R")
|
||||
.define('R', TheFoods.RICE).save(consumer); //TODO foods need worked on still.
|
||||
.define('R', TheFoods.RICE).save(consumer); //TODO foods need worked on still.*/
|
||||
|
||||
Recipe.shaped(ActuallyItems.RICE_SLIME.get())
|
||||
.pattern(" R ")
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
/*
|
||||
* This file ("BlockInputter.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.mod.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputter;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputterAdvanced;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockInputter extends BlockContainerBase {
|
||||
|
||||
public static final int NAME_FLAVOR_AMOUNTS = 15;
|
||||
|
||||
public final boolean isAdvanced;
|
||||
|
||||
public BlockInputter(boolean isAdvanced) {
|
||||
super(ActuallyBlocks.defaultPickProps(0).randomTicks());
|
||||
this.isAdvanced = isAdvanced;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity newBlockEntity(IBlockReader worldIn) {
|
||||
return this.isAdvanced
|
||||
? new TileEntityInputterAdvanced()
|
||||
: new TileEntityInputter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
if (this.isAdvanced) {
|
||||
return this.openGui(world, player, pos, TileEntityInputterAdvanced.class);
|
||||
}
|
||||
|
||||
return this.openGui(world, player, pos, TileEntityInputter.class);
|
||||
}
|
||||
|
||||
// TODO: [port] ADD BACK
|
||||
|
||||
// public static class TheItemBlock extends ItemBlockBase {
|
||||
//
|
||||
// private final Random rand = new Random();
|
||||
// private long lastSysTime;
|
||||
// private int toPick;
|
||||
//
|
||||
// public TheItemBlock(Block block) {
|
||||
// super(block);
|
||||
// this.setHasSubtypes(false);
|
||||
// this.setMaxDamage(0);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getTranslationKey(ItemStack stack) {
|
||||
// return this.getTranslationKey();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getMetadata(int damage) {
|
||||
// return damage;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getItemStackDisplayName(ItemStack stack) {
|
||||
// if (Util.isClient()) {
|
||||
// long sysTime = System.currentTimeMillis();
|
||||
//
|
||||
// if (this.lastSysTime + 5000 < sysTime) {
|
||||
// this.lastSysTime = sysTime;
|
||||
// this.toPick = this.rand.nextInt(NAME_FLAVOR_AMOUNTS) + 1;
|
||||
// }
|
||||
//
|
||||
// return StringUtil.localize(this.getTranslationKey() + ".name") + " (" + StringUtil.localize("tile." + ActuallyAdditions.MODID + ".block_inputter.add." + this.toPick + ".name") + ")";
|
||||
// } else {
|
||||
// return super.getItemStackDisplayName(stack);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
|
@ -15,7 +15,6 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntListValues;
|
||||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.*;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
// TODO: [port] MOVE TO DATA_GENERATOR
|
||||
@Deprecated
|
||||
|
@ -48,7 +47,7 @@ public final class InitCrafting {
|
|||
// ActuallyAdditionsAPI.addFarmerBehavior(new EnderlillyFarmerBehavior());
|
||||
// ActuallyAdditionsAPI.addFarmerBehavior(new RedOrchidFarmerBehavior());
|
||||
|
||||
new RecipePotionRingCharging(new ResourceLocation(ActuallyAdditions.MODID, "potion_ring_charging"));
|
||||
new RecipeBioMash(new ResourceLocation(ActuallyAdditions.MODID, "bio_mash"));
|
||||
//new RecipePotionRingCharging(new ResourceLocation(ActuallyAdditions.MODID, "potion_ring_charging"));
|
||||
//new RecipeBioMash(new ResourceLocation(ActuallyAdditions.MODID, "bio_mash"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -215,7 +215,7 @@ public class ClientEvents {
|
|||
|
||||
GlStateManager._pushMatrix();
|
||||
GlStateManager._color4f(1F, 1F, 1F, 1F);
|
||||
energyDisplay.draw();
|
||||
energyDisplay.draw(event.getMatrixStack());
|
||||
GlStateManager._popMatrix();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.ClickType;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.container.IContainerListener;
|
||||
import net.minecraft.inventory.container.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -122,6 +121,7 @@ public class ContainerBag extends Container implements IButtonReactor {
|
|||
super.broadcastChanges();
|
||||
|
||||
if (this.filter.needsUpdateSend() || this.autoInsert != this.oldAutoInsert) {
|
||||
/*
|
||||
for (IContainerListener listener : this.containerListeners) {
|
||||
listener.setContainerData(this, 0, this.filter.isWhitelist
|
||||
? 1
|
||||
|
@ -140,6 +140,7 @@ public class ContainerBag extends Container implements IButtonReactor {
|
|||
? 1
|
||||
: 0);
|
||||
}
|
||||
*/
|
||||
this.filter.updateLasts();
|
||||
this.oldAutoInsert = this.autoInsert;
|
||||
}
|
||||
|
|
|
@ -12,9 +12,7 @@ package de.ellpeck.actuallyadditions.mod.inventory;
|
|||
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput;
|
||||
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCrusher;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
|
@ -64,6 +62,7 @@ public class ContainerGrinder extends Container {
|
|||
|
||||
@Override
|
||||
public ItemStack quickMoveStack(PlayerEntity player, int slot) {
|
||||
/*
|
||||
int inventoryStart = this.isDouble
|
||||
? 6
|
||||
: 3;
|
||||
|
@ -124,7 +123,9 @@ public class ContainerGrinder extends Container {
|
|||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
|
||||
*/
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,132 +0,0 @@
|
|||
/*
|
||||
* This file ("ContainerInputter.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.mod.inventory;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiInputter;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputter;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.ClickType;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.container.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class ContainerInputter extends Container {
|
||||
public final TileEntityInputter tileInputter;
|
||||
public final boolean isAdvanced;
|
||||
|
||||
public static ContainerInputter fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
|
||||
return new ContainerInputter(windowId, inv, (TileEntityInputter) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos())));
|
||||
}
|
||||
|
||||
public ContainerInputter(int windowId, PlayerInventory inventory, TileEntityInputter tile) {
|
||||
super(ActuallyContainers.INPUTTER_CONTAINER.get(), windowId);
|
||||
this.tileInputter = tile;
|
||||
this.isAdvanced = tile.isAdvanced;
|
||||
|
||||
this.addSlot(new SlotItemHandlerUnconditioned(this.tileInputter.inv, 0, 80, 21 + (this.isAdvanced
|
||||
? 12
|
||||
: 0)));
|
||||
|
||||
if (this.isAdvanced) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (int x = 0; x < 3; x++) {
|
||||
for (int y = 0; y < 4; y++) {
|
||||
this.addSlot(new SlotFilter(i == 0
|
||||
? this.tileInputter.leftFilter
|
||||
: this.tileInputter.rightFilter, y + x * 4, 20 + i * 84 + x * 18, 6 + y * 18));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
this.addSlot(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 101 + i * 18 + (this.isAdvanced
|
||||
? GuiInputter.OFFSET_ADVANCED
|
||||
: 0)));
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 9; i++) {
|
||||
this.addSlot(new Slot(inventory, i, 8 + i * 18, 159 + (this.isAdvanced
|
||||
? GuiInputter.OFFSET_ADVANCED
|
||||
: 0)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack quickMoveStack(PlayerEntity player, int slot) {
|
||||
int inventoryStart = this.isAdvanced
|
||||
? 25
|
||||
: 1;
|
||||
int inventoryEnd = inventoryStart + 26;
|
||||
int hotbarStart = inventoryEnd + 1;
|
||||
int hotbarEnd = hotbarStart + 8;
|
||||
|
||||
Slot theSlot = this.slots.get(slot);
|
||||
|
||||
if (theSlot != null && theSlot.hasItem()) {
|
||||
ItemStack newStack = theSlot.getItem();
|
||||
ItemStack currentStack = newStack.copy();
|
||||
|
||||
//Other Slots in Inventory excluded
|
||||
if (slot >= inventoryStart) {
|
||||
//Shift from Inventory
|
||||
if (!this.moveItemStackTo(newStack, 0, 1, false)) {
|
||||
//
|
||||
if (slot >= inventoryStart && slot <= inventoryEnd) {
|
||||
if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
}
|
||||
} else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
}
|
||||
}
|
||||
} else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) {
|
||||
return StackUtil.getEmpty();
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(newStack)) {
|
||||
theSlot.set(StackUtil.getEmpty());
|
||||
} else {
|
||||
theSlot.setChanged();
|
||||
}
|
||||
|
||||
if (newStack.getCount() == currentStack.getCount()) {
|
||||
return StackUtil.getEmpty();
|
||||
}
|
||||
theSlot.onTake(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return StackUtil.getEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) {
|
||||
if (SlotFilter.checkFilter(this, slotId, player)) {
|
||||
return StackUtil.getEmpty();
|
||||
} else {
|
||||
return super.clicked(slotId, dragType, clickTypeIn, player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stillValid(PlayerEntity player) {
|
||||
return this.tileInputter.canPlayerUse(player);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.widget.button.Button;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class Buttons {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class SmallerButton extends Button {
|
||||
|
||||
public final ResourceLocation resLoc = AssetUtil.getGuiLocation("gui_inputter");
|
||||
private final boolean smaller;
|
||||
|
||||
public SmallerButton(int x, int y, ITextComponent display, IPressable pressable) {
|
||||
this(x, y, display, false, pressable);
|
||||
}
|
||||
|
||||
public SmallerButton(int x, int y, ITextComponent display, boolean smaller, IPressable pressable) {
|
||||
super(x, y, 16, smaller
|
||||
? 12
|
||||
: 16, display, pressable);
|
||||
this.smaller = smaller;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int x, int y, float f) {
|
||||
if (this.visible) {
|
||||
Minecraft.getInstance().getTextureManager().bind(this.resLoc);
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.isHovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height;
|
||||
int k = this.getHoverState(this.hovered);
|
||||
GlStateManager._enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlStateManager._blendFunc(770, 771);
|
||||
this.blit(matrices, this.x, this.y, this.smaller
|
||||
? 200
|
||||
: 176, k * this.height, this.width, this.height);
|
||||
this.mouseDragged(mc, x, y);
|
||||
|
||||
int color = 14737632;
|
||||
if (this.packedFGColour != 0) {
|
||||
color = this.packedFGColour;
|
||||
} else if (!this.enabled) {
|
||||
color = 10526880;
|
||||
} else if (this.hovered) {
|
||||
color = 16777120;
|
||||
}
|
||||
|
||||
this.drawCenteredString(mc.fontRenderer, this.displayString, this.x + this.width / 2, this.y + (this.height - 8) / 2, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class TinyButton extends Button {
|
||||
|
||||
public final ResourceLocation resLoc = AssetUtil.getGuiLocation("gui_inputter");
|
||||
|
||||
public TinyButton(int id, int x, int y) {
|
||||
super(id, x, y, 8, 8, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int x, int y, float f) {
|
||||
if (this.visible) {
|
||||
mc.getTextureManager().bind(this.resLoc);
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.hovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height;
|
||||
int k = this.getHoverState(this.hovered);
|
||||
GlStateManager._enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlStateManager._blendFunc(770, 771);
|
||||
this.blit(matrices, this.x, this.y, 192, k * 8, 8, 8);
|
||||
this.mouseDragged(mc, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,13 +14,11 @@ import com.mojang.blaze3d.matrix.MatrixStack;
|
|||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.CustomEnergyStorage;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.AbstractGui;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
|
@ -69,14 +67,14 @@ public class EnergyDisplay extends AbstractGui {
|
|||
if (this.rfReference.getEnergyStored() > 0) {
|
||||
int i = this.rfReference.getEnergyStored() * 83 / this.rfReference.getMaxEnergyStored();
|
||||
|
||||
float[] color = AssetUtil.getWheelColor(mc.level.getTotalWorldTime() % 256);
|
||||
RenderSystem.color4f(color[0] / 255F, color[1] / 255F, color[2] / 255F);
|
||||
float[] color = AssetUtil.getWheelColor(mc.level.getGameTime() % 256);
|
||||
RenderSystem.color3f(color[0] / 255F, color[1] / 255F, color[2] / 255F);
|
||||
this.blit(matrices, barX + 1, barY + 84 - i, 36, 172, 16, i);
|
||||
RenderSystem.color4f(1F, 1F, 1F);
|
||||
RenderSystem.color3f(1F, 1F, 1F);
|
||||
}
|
||||
|
||||
if (this.drawTextNextTo) {
|
||||
this.drawString(mc.font, this.getOverlayText(), barX + 25, barY + 78, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
//this.drawString(mc.font, this.getOverlayText(), barX + 25, barY + 78, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,16 +84,16 @@ public class EnergyDisplay extends AbstractGui {
|
|||
|
||||
List<String> text = new ArrayList<>();
|
||||
text.add(this.getOverlayText());
|
||||
GuiUtils.drawHoveringText(matrices, text, mouseX, mouseY, mc.getWindow().getWidth(), mc.getWindow().getHeight(), -1, mc.font);
|
||||
//GuiUtils.drawHoveringText(matrices, text, mouseX, mouseY, mc.getWindow().getWidth(), mc.getWindow().getHeight(), -1, mc.font);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isMouseOver(int mouseX, int mouseY) {
|
||||
return mouseX >= this.x && mouseY >= this.y && mouseX < this.x + (this.outline
|
||||
? 26
|
||||
: 18) && mouseY < this.y + (this.outline
|
||||
? 93
|
||||
: 85);
|
||||
? 26
|
||||
: 18) && mouseY < this.y + (this.outline
|
||||
? 93
|
||||
: 85);
|
||||
}
|
||||
|
||||
private String getOverlayText() {
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiInputter.SmallerButton;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.FilterSettings;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -21,10 +20,8 @@ import net.minecraft.util.text.StringTextComponent;
|
|||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
@ -32,28 +29,28 @@ public class FilterSettingsGui extends AbstractGui {
|
|||
|
||||
private final FilterSettings theSettings;
|
||||
|
||||
public SmallerButton whitelistButton;
|
||||
public SmallerButton metaButton;
|
||||
public SmallerButton nbtButton;
|
||||
public SmallerButton modButton;
|
||||
public SmallerButton oredictButton;
|
||||
public Buttons.SmallerButton whitelistButton;
|
||||
public Buttons.SmallerButton metaButton;
|
||||
public Buttons.SmallerButton nbtButton;
|
||||
public Buttons.SmallerButton modButton;
|
||||
public Buttons.SmallerButton oredictButton;
|
||||
|
||||
public FilterSettingsGui(FilterSettings settings, int x, int y, List<Button> buttonList) {
|
||||
this.theSettings = settings;
|
||||
|
||||
this.whitelistButton = new SmallerButton(this.theSettings.whitelistButtonId, x, y, "", true);
|
||||
this.whitelistButton = new Buttons.SmallerButton(this.theSettings.whitelistButtonId, x, y, true);
|
||||
buttonList.add(this.whitelistButton);
|
||||
y += 14;
|
||||
this.metaButton = new SmallerButton(this.theSettings.metaButtonId, x, y, "", true);
|
||||
this.metaButton = new Buttons.SmallerButton(this.theSettings.metaButtonId, x, y, true);
|
||||
buttonList.add(this.metaButton);
|
||||
y += 14;
|
||||
this.nbtButton = new SmallerButton(this.theSettings.nbtButtonId, x, y, "", true);
|
||||
this.nbtButton = new Buttons.SmallerButton(this.theSettings.nbtButtonId, x, y, true);
|
||||
buttonList.add(this.nbtButton);
|
||||
y += 14;
|
||||
this.oredictButton = new SmallerButton(this.theSettings.oredictButtonId, x, y, "", true);
|
||||
this.oredictButton = new Buttons.SmallerButton(this.theSettings.oredictButtonId, x, y, true);
|
||||
buttonList.add(this.oredictButton);
|
||||
y += 15;
|
||||
this.modButton = new SmallerButton(this.theSettings.modButtonId, x, y, "", true);
|
||||
this.modButton = new Buttons.SmallerButton(this.theSettings.modButtonId, x, y, true);
|
||||
buttonList.add(this.modButton);
|
||||
|
||||
this.tick();
|
||||
|
@ -75,8 +72,8 @@ public class FilterSettingsGui extends AbstractGui {
|
|||
this.whitelistButton.setMessage(new StringTextComponent("OR").withStyle(this.theSettings.respectOredict == 0
|
||||
? TextFormatting.DARK_GREEN
|
||||
: this.theSettings.respectOredict == 1
|
||||
? TextFormatting.GREEN
|
||||
: TextFormatting.DARK_GREEN));
|
||||
? TextFormatting.GREEN
|
||||
: TextFormatting.DARK_GREEN));
|
||||
}
|
||||
|
||||
public void drawHover(int mouseX, int mouseY) {
|
||||
|
@ -87,25 +84,25 @@ public class FilterSettingsGui extends AbstractGui {
|
|||
list.add(TextFormatting.BOLD + (this.theSettings.isWhitelist
|
||||
? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.whitelist")
|
||||
: StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.blacklist")));
|
||||
list.addAll(mc.font.listFormattedStringToWidth(StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".gui.whitelistInfo"), 200));
|
||||
GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font);
|
||||
//list.addAll(mc.font.substrByWidth(StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".gui.whitelistInfo"), 200));
|
||||
//GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font);
|
||||
} else if (this.metaButton.isMouseOver(mouseX, mouseY)) {
|
||||
GuiUtils.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.theSettings.respectMeta
|
||||
? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectMeta")
|
||||
: StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreMeta"))), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font);
|
||||
//GuiUtils.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.theSettings.respectMeta
|
||||
// ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectMeta")
|
||||
// : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreMeta"))), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font);
|
||||
} else if (this.nbtButton.isMouseOver(mouseX, mouseY)) {
|
||||
GuiUtils.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.theSettings.respectNBT
|
||||
? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectNBT")
|
||||
: StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreNBT"))), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font);
|
||||
//GuiUtils.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.theSettings.respectNBT
|
||||
// ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectNBT")
|
||||
// : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreNBT"))), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font);
|
||||
} else if (this.modButton.isMouseOver(mouseX, mouseY)) {
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add(TextFormatting.BOLD + (this.theSettings.respectMod
|
||||
? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectMod")
|
||||
: StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreMod")));
|
||||
|
||||
list.addAll(mc.font.listFormattedStringToWidth(StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectModInfo"), 200));
|
||||
//list.addAll(mc.font.listFormattedStringToWidth(StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectModInfo"), 200));
|
||||
|
||||
GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font);
|
||||
//GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font);
|
||||
} else if (this.oredictButton.isMouseOver()) {
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add(TextFormatting.BOLD + (this.theSettings.respectOredict == 0
|
||||
|
@ -122,9 +119,9 @@ public class FilterSettingsGui extends AbstractGui {
|
|||
}
|
||||
|
||||
if (type != null) {
|
||||
list.addAll(mc.font.listFormattedStringToWidth(StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectOredictInfo." + type), 200));
|
||||
//list.addAll(mc.font.listFormattedStringToWidth(StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectOredictInfo." + type), 200));
|
||||
}
|
||||
GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font);
|
||||
//GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerBag;
|
||||
import de.ellpeck.actuallyadditions.mod.network.PacketClientToServer;
|
||||
|
@ -50,7 +51,7 @@ public class GuiBag extends GuiWtfMojang<ContainerBag> {
|
|||
public void init() {
|
||||
super.init();
|
||||
|
||||
this.filter = new FilterSettingsGui(this.container.filter, this.leftPos + 138, this.topPos + 10, this.buttonList);
|
||||
this.filter = new FilterSettingsGui(this.container.filter, this.leftPos + 138, this.topPos + 10, this.buttons);
|
||||
|
||||
this.buttonAutoInsert = new Button(0, this.leftPos - 21, this.topPos + 8, 20, 20, (this.container.autoInsert
|
||||
? TextFormatting.DARK_GREEN
|
||||
|
@ -61,20 +62,20 @@ public class GuiBag extends GuiWtfMojang<ContainerBag> {
|
|||
@Override
|
||||
protected void actionPerformed(Button button) throws IOException {
|
||||
CompoundNBT data = new CompoundNBT();
|
||||
data.setInteger("ButtonID", button.id);
|
||||
data.setInteger("PlayerID", Minecraft.getInstance().player.getId());
|
||||
data.setInteger("WorldID", Minecraft.getInstance().level.provider.getDimension());
|
||||
data.putInt("ButtonID", button.id);
|
||||
data.putInt("PlayerID", Minecraft.getInstance().player.getId());
|
||||
data.putInt("WorldID", Minecraft.getInstance().level.provider.getDimension());
|
||||
PacketHandler.THE_NETWORK.sendToServer(new PacketClientToServer(data, PacketHandler.GUI_BUTTON_TO_CONTAINER_HANDLER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
super.updateScreen();
|
||||
public void tick() {
|
||||
super.tick();
|
||||
this.filter.tick();
|
||||
|
||||
this.buttonAutoInsert.displayString = (this.container.autoInsert
|
||||
? TextFormatting.DARK_GREEN
|
||||
: TextFormatting.RED) + "I";
|
||||
//this.buttonAutoInsert.displayString = (this.container.autoInsert
|
||||
// ? TextFormatting.DARK_GREEN
|
||||
// : TextFormatting.RED) + "I";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,348 +0,0 @@
|
|||
/*
|
||||
* This file ("GuiInputter.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.mod.inventory.gui;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerInputter;
|
||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputter;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import net.minecraft.client.gui.widget.button.Button;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import net.minecraft.client.gui.widget.button.Button.IPressable;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class GuiInputter extends GuiWtfMojang<ContainerInputter> {
|
||||
|
||||
public static final int OFFSET_ADVANCED = 12 + 36;
|
||||
public static final String[] SIDES = new String[]{StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.disabled"), StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.up"), StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.down"), StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.north"), StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.east"), StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.south"), StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.west")};
|
||||
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_inputter");
|
||||
private static final ResourceLocation RES_LOC_ADVANCED = AssetUtil.getGuiLocation("gui_inputter_advanced");
|
||||
public final TileEntityInputter tileInputter;
|
||||
private final boolean isAdvanced;
|
||||
private TextFieldWidget fieldPutStart;
|
||||
private TextFieldWidget fieldPutEnd;
|
||||
private TextFieldWidget fieldPullStart;
|
||||
private TextFieldWidget fieldPullEnd;
|
||||
|
||||
private FilterSettingsGui leftFilter;
|
||||
private FilterSettingsGui rightFilter;
|
||||
|
||||
public GuiInputter(ContainerInputter container, PlayerInventory inventory, ITextComponent title) {
|
||||
super(container, inventory);
|
||||
this.tileInputter = container.tileInputter;
|
||||
this.imageWidth = 176;
|
||||
this.imageHeight = 97 + 86 + (container.isAdvanced
|
||||
? OFFSET_ADVANCED
|
||||
: 0);
|
||||
this.isAdvanced = container.isAdvanced;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
|
||||
if (this.isAdvanced) {
|
||||
this.leftFilter = new FilterSettingsGui(this.tileInputter.leftFilter, this.leftPos + 3, this.topPos + 6, this.buttonList);
|
||||
this.rightFilter = new FilterSettingsGui(this.tileInputter.rightFilter, this.leftPos + 157, this.topPos + 6, this.buttonList);
|
||||
}
|
||||
|
||||
this.fieldPullStart = new TextFieldWidget(this.font, this.leftPos + 6, this.topPos + 80 + (this.isAdvanced
|
||||
? OFFSET_ADVANCED
|
||||
: 0), 34, 8);
|
||||
this.fieldPullStart.setMaxLength(5);
|
||||
this.fieldPullStart.setBordered(false);
|
||||
this.children.add(this.fieldPullStart);
|
||||
|
||||
this.fieldPullEnd = new TextFieldWidget(this.font, this.leftPos + 50, this.topPos + 80 + (this.isAdvanced
|
||||
? OFFSET_ADVANCED
|
||||
: 0), 34, 8);
|
||||
this.fieldPullEnd.setMaxLength(5);
|
||||
this.fieldPullEnd.setBordered(false);
|
||||
this.children.add(this.fieldPullEnd);
|
||||
|
||||
this.fieldPutStart = new TextFieldWidget(this.font, this.leftPos + 91, this.topPos + 80 + (this.isAdvanced
|
||||
? OFFSET_ADVANCED
|
||||
: 0), 34, 8);
|
||||
this.fieldPutStart.setMaxLength(5);
|
||||
this.fieldPutStart.setBordered(false);
|
||||
this.children.add(this.fieldPutStart);
|
||||
|
||||
this.fieldPutEnd = new TextFieldWidget(this.font, this.leftPos + 135, this.topPos + 80 + (this.isAdvanced
|
||||
? OFFSET_ADVANCED
|
||||
: 0), 34, 8);
|
||||
this.fieldPutEnd.setMaxLength(5);
|
||||
this.fieldPutEnd.setBordered(false);
|
||||
this.children.add(this.fieldPutEnd);
|
||||
|
||||
SmallerButton buttonSidePutP = new SmallerButton(0, this.leftPos + 155, this.topPos + 43 + (this.isAdvanced
|
||||
? OFFSET_ADVANCED
|
||||
: 0), ">");
|
||||
SmallerButton buttonSidePutM = new SmallerButton(1, this.leftPos + 90, this.topPos + 43 + (this.isAdvanced
|
||||
? OFFSET_ADVANCED
|
||||
: 0), "<");
|
||||
|
||||
SmallerButton buttonSidePullP = new SmallerButton(2, this.leftPos + 70, this.topPos + 43 + (this.isAdvanced
|
||||
? OFFSET_ADVANCED
|
||||
: 0), ">");
|
||||
SmallerButton buttonSidePullM = new SmallerButton(3, this.leftPos + 5, this.topPos + 43 + (this.isAdvanced
|
||||
? OFFSET_ADVANCED
|
||||
: 0), "<");
|
||||
|
||||
this.addButton(buttonSidePutP);
|
||||
this.addButton(buttonSidePullP);
|
||||
this.addButton(buttonSidePutM);
|
||||
this.addButton(buttonSidePullM);
|
||||
|
||||
this.addButton(new TinyButton(TileEntityInputter.OKAY_BUTTON_ID, this.leftPos + 84, this.topPos + 91 + (this.isAdvanced
|
||||
? OFFSET_ADVANCED
|
||||
: 0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int x, int y, float f) {
|
||||
super.render(matrices, x, y, f);
|
||||
|
||||
int newTopOffset = this.topPos + (this.isAdvanced
|
||||
? OFFSET_ADVANCED
|
||||
: 0);
|
||||
//Info Mode on!
|
||||
if (x >= this.leftPos + 4 && y >= newTopOffset + 65 && x <= this.leftPos + 4 + 38 && y <= newTopOffset + 65 + 12) {
|
||||
this.drawHoveringText(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".inputter.info.1").replace("<p>", StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.pull")), 200), x, y);
|
||||
}
|
||||
if (x >= this.leftPos + 89 && y >= newTopOffset + 65 && x <= this.leftPos + 89 + 38 && y <= newTopOffset + 65 + 12) {
|
||||
this.drawHoveringText(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".inputter.info.1").replace("<p>", StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.put")), 200), x, y);
|
||||
}
|
||||
if (x >= this.leftPos + 48 && y >= newTopOffset + 65 && x <= this.leftPos + 48 + 38 && y <= newTopOffset + 65 + 12) {
|
||||
this.drawHoveringText(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".inputter.info.2").replace("<p>", StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.pull")), 200), x, y);
|
||||
}
|
||||
if (x >= this.leftPos + 133 && y >= newTopOffset + 65 && x <= this.leftPos + 133 + 38 && y <= newTopOffset + 65 + 12) {
|
||||
this.drawHoveringText(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".inputter.info.2").replace("<p>", StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.put")), 200), x, y);
|
||||
}
|
||||
|
||||
if (this.isAdvanced) {
|
||||
this.leftFilter.drawHover(x, y);
|
||||
this.rightFilter.drawHover(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderLabels(MatrixStack matrices, int x, int y) {
|
||||
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.tileInputter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBg(MatrixStack matrices, float f, int x, int y) {
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION);
|
||||
this.blit(matrices, this.leftPos, this.topPos + 97 + (this.isAdvanced
|
||||
? OFFSET_ADVANCED
|
||||
: 0), 0, 0, 176, 86);
|
||||
|
||||
this.getMinecraft().getTextureManager().bind(this.isAdvanced
|
||||
? RES_LOC_ADVANCED
|
||||
: RES_LOC);
|
||||
this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 97 + (this.isAdvanced
|
||||
? OFFSET_ADVANCED
|
||||
: 0));
|
||||
|
||||
this.font.draw(matrices, StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.inbound"), this.leftPos + 23 + 3, this.topPos + 32 + (this.isAdvanced
|
||||
? OFFSET_ADVANCED
|
||||
: 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT);
|
||||
this.font.draw(matrices, StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.outbound"), this.leftPos + 104 + 3, this.topPos + 32 + (this.isAdvanced
|
||||
? OFFSET_ADVANCED
|
||||
: 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT);
|
||||
|
||||
this.font.draw(matrices, SIDES[this.tileInputter.sideToPull + 1], this.leftPos + 24 + 1, this.topPos + 45 + 3 + (this.isAdvanced
|
||||
? OFFSET_ADVANCED
|
||||
: 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT);
|
||||
this.font.draw(matrices, SIDES[this.tileInputter.sideToPut + 1], this.leftPos + 109 + 1, this.topPos + 45 + 3 + (this.isAdvanced
|
||||
? OFFSET_ADVANCED
|
||||
: 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT);
|
||||
|
||||
this.font.draw(matrices, Integer.toString(this.tileInputter.slotToPutStart), this.leftPos + 92, this.topPos + 67 + (this.isAdvanced
|
||||
? OFFSET_ADVANCED
|
||||
: 0), StringUtil.DECIMAL_COLOR_WHITE);
|
||||
this.font.draw(matrices, Integer.toString(this.tileInputter.slotToPutEnd), this.leftPos + 136, this.topPos + 67 + (this.isAdvanced
|
||||
? OFFSET_ADVANCED
|
||||
: 0), StringUtil.DECIMAL_COLOR_WHITE);
|
||||
this.font.draw(matrices, Integer.toString(this.tileInputter.slotToPullStart), this.leftPos + 7, this.topPos + 67 + (this.isAdvanced
|
||||
? OFFSET_ADVANCED
|
||||
: 0), StringUtil.DECIMAL_COLOR_WHITE);
|
||||
this.font.draw(matrices, Integer.toString(this.tileInputter.slotToPullEnd), this.leftPos + 51, this.topPos + 67 + (this.isAdvanced
|
||||
? OFFSET_ADVANCED
|
||||
: 0), StringUtil.DECIMAL_COLOR_WHITE);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// protected void mouseClicked(int par1, int par2, int par3) throws IOException {
|
||||
// this.fieldPutStart.mouseClicked(par1, par2, par3);
|
||||
// this.fieldPutEnd.mouseClicked(par1, par2, par3);
|
||||
// this.fieldPullStart.mouseClicked(par1, par2, par3);
|
||||
// this.fieldPullEnd.mouseClicked(par1, par2, par3);
|
||||
//
|
||||
// super.mouseClicked(par1, par2, par3);
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public void keyTyped(char theChar, int key) throws IOException {
|
||||
// if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
|
||||
// if (this.fieldPutStart.isFocused()) {
|
||||
// this.setVariable(this.fieldPutStart, 0);
|
||||
// }
|
||||
// if (this.fieldPutEnd.isFocused()) {
|
||||
// this.setVariable(this.fieldPutEnd, 1);
|
||||
// }
|
||||
// if (this.fieldPullStart.isFocused()) {
|
||||
// this.setVariable(this.fieldPullStart, 2);
|
||||
// }
|
||||
// if (this.fieldPullEnd.isFocused()) {
|
||||
// this.setVariable(this.fieldPullEnd, 3);
|
||||
// }
|
||||
// } else if (Character.isDigit(theChar) || key == Keyboard.KEY_BACK || key == Keyboard.KEY_DELETE || key == Keyboard.KEY_LEFT || key == Keyboard.KEY_RIGHT) {
|
||||
// this.fieldPutStart.textboxKeyTyped(theChar, key);
|
||||
// this.fieldPutEnd.textboxKeyTyped(theChar, key);
|
||||
// this.fieldPullStart.textboxKeyTyped(theChar, key);
|
||||
// this.fieldPullEnd.textboxKeyTyped(theChar, key);
|
||||
// } else {
|
||||
// super.keyTyped(theChar, key);
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
//
|
||||
// this.fieldPutStart.updateCursorCounter();
|
||||
// this.fieldPutEnd.updateCursorCounter();
|
||||
// this.fieldPullStart.updateCursorCounter();
|
||||
// this.fieldPullEnd.updateCursorCounter();
|
||||
|
||||
if (this.isAdvanced) {
|
||||
this.leftFilter.tick();
|
||||
this.rightFilter.tick();
|
||||
}
|
||||
}
|
||||
|
||||
public void setVariable(TextFieldWidget field, int sendInt) {
|
||||
if (!field.getValue().isEmpty()) {
|
||||
this.sendPacket(this.parse(field.getValue()), sendInt);
|
||||
field.setValue("");
|
||||
}
|
||||
}
|
||||
|
||||
private void sendPacket(int text, int textID) {
|
||||
PacketHandlerHelper.sendNumberPacket(this.tileInputter, text, textID);
|
||||
}
|
||||
|
||||
private int parse(String theInt) {
|
||||
try {
|
||||
return Integer.parseInt(theInt);
|
||||
} catch (Exception e) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(Button button) {
|
||||
if (button.id == TileEntityInputter.OKAY_BUTTON_ID) {
|
||||
this.setVariable(this.fieldPutStart, 0);
|
||||
this.setVariable(this.fieldPutEnd, 1);
|
||||
this.setVariable(this.fieldPullStart, 2);
|
||||
this.setVariable(this.fieldPullEnd, 3);
|
||||
} else {
|
||||
PacketHandlerHelper.sendButtonPacket(this.tileInputter, button.id);
|
||||
}
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class SmallerButton extends Button {
|
||||
|
||||
public final ResourceLocation resLoc = AssetUtil.getGuiLocation("gui_inputter");
|
||||
private final boolean smaller;
|
||||
|
||||
public SmallerButton(int x, int y, ITextComponent display, IPressable pressable) {
|
||||
this(x, y, display, false, pressable);
|
||||
}
|
||||
|
||||
public SmallerButton(int x, int y, ITextComponent display, boolean smaller, IPressable pressable) {
|
||||
super(x, y, 16, smaller
|
||||
? 12
|
||||
: 16, display, pressable);
|
||||
this.smaller = smaller;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int x, int y, float f) {
|
||||
if (this.visible) {
|
||||
Minecraft.getInstance().getTextureManager().bind(this.resLoc);
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.isHovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height;
|
||||
int k = this.getHoverState(this.hovered);
|
||||
GlStateManager._enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlStateManager._blendFunc(770, 771);
|
||||
this.blit(matrices, this.x, this.y, this.smaller
|
||||
? 200
|
||||
: 176, k * this.height, this.width, this.height);
|
||||
this.mouseDragged(mc, x, y);
|
||||
|
||||
int color = 14737632;
|
||||
if (this.packedFGColour != 0) {
|
||||
color = this.packedFGColour;
|
||||
} else if (!this.enabled) {
|
||||
color = 10526880;
|
||||
} else if (this.hovered) {
|
||||
color = 16777120;
|
||||
}
|
||||
|
||||
this.drawCenteredString(mc.fontRenderer, this.displayString, this.x + this.width / 2, this.y + (this.height - 8) / 2, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class TinyButton extends Button {
|
||||
|
||||
public final ResourceLocation resLoc = AssetUtil.getGuiLocation("gui_inputter");
|
||||
|
||||
public TinyButton(int id, int x, int y) {
|
||||
super(id, x, y, 8, 8, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int x, int y, float f) {
|
||||
if (this.visible) {
|
||||
mc.getTextureManager().bind(this.resLoc);
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.hovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height;
|
||||
int k = this.getHoverState(this.hovered);
|
||||
GlStateManager._enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlStateManager._blendFunc(770, 771);
|
||||
this.blit(matrices, this.x, this.y, 192, k * 8, 8, 8);
|
||||
this.mouseDragged(mc, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,7 +14,6 @@ import com.mojang.blaze3d.matrix.MatrixStack;
|
|||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerLaserRelayItemWhitelist;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiInputter.SmallerButton;
|
||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemAdvanced;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
|
@ -64,8 +63,8 @@ public class GuiLaserRelayItemWhitelist extends GuiWtfMojang<ContainerLaserRelay
|
|||
this.leftFilter = new FilterSettingsGui(this.tile.leftFilter, this.leftPos + 3, this.topPos + 6, this.buttonList);
|
||||
this.rightFilter = new FilterSettingsGui(this.tile.rightFilter, this.leftPos + 157, this.topPos + 6, this.buttonList);
|
||||
|
||||
this.buttonSmartWhitelistLeft = new SmallerButton(2, this.leftPos + 3, this.topPos + 79, "S");
|
||||
this.buttonSmartWhitelistRight = new SmallerButton(3, this.leftPos + 157, this.topPos + 79, "S");
|
||||
this.buttonSmartWhitelistLeft = new Buttons.SmallerButton(2, this.leftPos + 3, this.topPos + 79, "S");
|
||||
this.buttonSmartWhitelistRight = new Buttons.SmallerButton(3, this.leftPos + 157, this.topPos + 79, "S");
|
||||
this.addButton(this.buttonSmartWhitelistLeft);
|
||||
this.addButton(this.buttonSmartWhitelistRight);
|
||||
}
|
||||
|
|
|
@ -176,13 +176,13 @@ public final class ActuallyItems {
|
|||
public static final RegistryObject<Item> SHOVEL_QUARTZ = ITEMS.register("shovel_quartz", () -> new ItemShovelAA(ToolMaterials.BLACK_QUARTZ));
|
||||
public static final RegistryObject<Item> SWORD_QUARTZ = ITEMS.register("sword_quartz", () -> new ItemSwordAA(ToolMaterials.BLACK_QUARTZ));
|
||||
public static final RegistryObject<Item> HOE_QUARTZ = ITEMS.register("hoe_quartz", () -> new ItemHoeAA(ToolMaterials.BLACK_QUARTZ));
|
||||
public static final RegistryObject<Item> WOODEN_PAXEL = ITEMS.register("wooden_paxel", () -> new ItemAllToolAA(ItemTier.WOOD));
|
||||
public static final RegistryObject<Item> STONE_PAXEL = ITEMS.register("stone_paxel", () -> new ItemAllToolAA(ItemTier.STONE));
|
||||
public static final RegistryObject<Item> IRON_PAXEL = ITEMS.register("iron_paxel", () -> new ItemAllToolAA(ItemTier.IRON));
|
||||
public static final RegistryObject<Item> GOLD_PAXEL = ITEMS.register("gold_paxel", () -> new ItemAllToolAA(ItemTier.GOLD));
|
||||
public static final RegistryObject<Item> DIAMOND_PAXEL = ITEMS.register("diamond_paxel", () -> new ItemAllToolAA(ItemTier.DIAMOND));
|
||||
public static final RegistryObject<Item> NETHERITE_PAXEL = ITEMS.register("netherite_paxel", () -> new ItemAllToolAA(ItemTier.NETHERITE));
|
||||
public static final RegistryObject<Item> QUARTZ_PAXEL = ITEMS.register("quartz_paxel", () -> new ItemAllToolAA(ToolMaterials.BLACK_QUARTZ));
|
||||
public static final RegistryObject<Item> WOODEN_PAXEL = ITEMS.register("wooden_paxel", () -> new AllInOneTool(ItemTier.WOOD));
|
||||
public static final RegistryObject<Item> STONE_PAXEL = ITEMS.register("stone_paxel", () -> new AllInOneTool(ItemTier.STONE));
|
||||
public static final RegistryObject<Item> IRON_PAXEL = ITEMS.register("iron_paxel", () -> new AllInOneTool(ItemTier.IRON));
|
||||
public static final RegistryObject<Item> GOLD_PAXEL = ITEMS.register("gold_paxel", () -> new AllInOneTool(ItemTier.GOLD));
|
||||
public static final RegistryObject<Item> DIAMOND_PAXEL = ITEMS.register("diamond_paxel", () -> new AllInOneTool(ItemTier.DIAMOND));
|
||||
public static final RegistryObject<Item> NETHERITE_PAXEL = ITEMS.register("netherite_paxel", () -> new AllInOneTool(ItemTier.NETHERITE));
|
||||
public static final RegistryObject<Item> QUARTZ_PAXEL = ITEMS.register("quartz_paxel", () -> new AllInOneTool(ToolMaterials.BLACK_QUARTZ));
|
||||
|
||||
public static final RegistryObject<Item> PICKAXE_CRYSTAL_RESTONIA = ITEMS.register("pickaxe_crystal_restonia", () -> new ItemPickaxeAA(ToolMaterials.RESTONIA));
|
||||
public static final RegistryObject<Item> AXE_CRYSTAL_RESTONIA = ITEMS.register("axe_crystal_restonia", () -> new ItemAxeAA(ToolMaterials.RESTONIA));
|
||||
|
@ -193,7 +193,7 @@ public final class ActuallyItems {
|
|||
public static final RegistryObject<Item> CHEST_CRYSTAL_RESTONIA = ITEMS.register("chest_crystal_restonia", () -> new ItemArmorAA(ArmorMaterials.RESTONIA, EquipmentSlotType.CHEST));
|
||||
public static final RegistryObject<Item> PANTS_CRYSTAL_RESTONIA = ITEMS.register("pants_crystal_restonia", () -> new ItemArmorAA(ArmorMaterials.RESTONIA, EquipmentSlotType.LEGS));
|
||||
public static final RegistryObject<Item> BOOTS_CRYSTAL_RESTONIA = ITEMS.register("boots_crystal_restonia", () -> new ItemArmorAA(ArmorMaterials.RESTONIA, EquipmentSlotType.FEET));
|
||||
public static final RegistryObject<Item> PAXEL_CRYSTAL_RESTONIA = ITEMS.register("paxel_crystal_restonia", () -> new ItemAllToolAA(ToolMaterials.RESTONIA));
|
||||
public static final RegistryObject<Item> PAXEL_CRYSTAL_RESTONIA = ITEMS.register("paxel_crystal_restonia", () -> new AllInOneTool(ToolMaterials.RESTONIA));
|
||||
|
||||
public static final RegistryObject<Item> PICKAXE_CRYSTAL_PALIS = ITEMS.register("pickaxe_crystal_palis", () -> new ItemPickaxeAA(ToolMaterials.PALIS));
|
||||
public static final RegistryObject<Item> AXE_CRYSTAL_PALIS = ITEMS.register("axe_crystal_palis", () -> new ItemAxeAA(ToolMaterials.PALIS));
|
||||
|
@ -204,7 +204,7 @@ public final class ActuallyItems {
|
|||
public static final RegistryObject<Item> CHEST_CRYSTAL_PALIS = ITEMS.register("chest_crystal_palis", () -> new ItemArmorAA(ArmorMaterials.PALIS, EquipmentSlotType.CHEST));
|
||||
public static final RegistryObject<Item> PANTS_CRYSTAL_PALIS = ITEMS.register("pants_crystal_palis", () -> new ItemArmorAA(ArmorMaterials.PALIS, EquipmentSlotType.LEGS));
|
||||
public static final RegistryObject<Item> BOOTS_CRYSTAL_PALIS = ITEMS.register("boots_crystal_palis", () -> new ItemArmorAA(ArmorMaterials.PALIS, EquipmentSlotType.FEET));
|
||||
public static final RegistryObject<Item> PAXEL_CRYSTAL_PALIS = ITEMS.register("paxel_crystal_palis", () -> new ItemAllToolAA(ToolMaterials.PALIS));
|
||||
public static final RegistryObject<Item> PAXEL_CRYSTAL_PALIS = ITEMS.register("paxel_crystal_palis", () -> new AllInOneTool(ToolMaterials.PALIS));
|
||||
|
||||
public static final RegistryObject<Item> PICKAXE_CRYSTAL_DIAMATINE = ITEMS.register("pickaxe_crystal_diamatine", () -> new ItemPickaxeAA(ToolMaterials.DIAMATINE));
|
||||
public static final RegistryObject<Item> AXE_CRYSTAL_DIAMATINE = ITEMS.register("axe_crystal_diamatine", () -> new ItemAxeAA(ToolMaterials.DIAMATINE));
|
||||
|
@ -215,7 +215,7 @@ public final class ActuallyItems {
|
|||
public static final RegistryObject<Item> CHEST_CRYSTAL_DIAMATINE = ITEMS.register("chest_crystal_diamatine", () -> new ItemArmorAA(ArmorMaterials.DIAMATINE, EquipmentSlotType.CHEST));
|
||||
public static final RegistryObject<Item> PANTS_CRYSTAL_DIAMATINE = ITEMS.register("pants_crystal_diamatine", () -> new ItemArmorAA(ArmorMaterials.DIAMATINE, EquipmentSlotType.LEGS));
|
||||
public static final RegistryObject<Item> BOOTS_CRYSTAL_DIAMATINE = ITEMS.register("boots_crystal_diamatine", () -> new ItemArmorAA(ArmorMaterials.DIAMATINE, EquipmentSlotType.FEET));
|
||||
public static final RegistryObject<Item> PAXEL_CRYSTAL_DIAMATINE = ITEMS.register("paxel_crystal_diamatine", () -> new ItemAllToolAA(ToolMaterials.DIAMATINE));
|
||||
public static final RegistryObject<Item> PAXEL_CRYSTAL_DIAMATINE = ITEMS.register("paxel_crystal_diamatine", () -> new AllInOneTool(ToolMaterials.DIAMATINE));
|
||||
|
||||
public static final RegistryObject<Item> PICKAXE_CRYSTAL_VOID = ITEMS.register("pickaxe_crystal_void", () -> new ItemPickaxeAA(ToolMaterials.VOID));
|
||||
public static final RegistryObject<Item> AXE_CRYSTAL_VOID = ITEMS.register("axe_crystal_void", () -> new ItemAxeAA(ToolMaterials.VOID));
|
||||
|
@ -226,7 +226,7 @@ public final class ActuallyItems {
|
|||
public static final RegistryObject<Item> CHEST_CRYSTAL_VOID = ITEMS.register("chest_crystal_void", () -> new ItemArmorAA(ArmorMaterials.VOID, EquipmentSlotType.CHEST));
|
||||
public static final RegistryObject<Item> PANTS_CRYSTAL_VOID = ITEMS.register("pants_crystal_void", () -> new ItemArmorAA(ArmorMaterials.VOID, EquipmentSlotType.LEGS));
|
||||
public static final RegistryObject<Item> BOOTS_CRYSTAL_VOID = ITEMS.register("boots_crystal_void", () -> new ItemArmorAA(ArmorMaterials.VOID, EquipmentSlotType.FEET));
|
||||
public static final RegistryObject<Item> PAXEL_CRYSTAL_VOID = ITEMS.register("paxel_crystal_void", () -> new ItemAllToolAA(ToolMaterials.VOID));
|
||||
public static final RegistryObject<Item> PAXEL_CRYSTAL_VOID = ITEMS.register("paxel_crystal_void", () -> new AllInOneTool(ToolMaterials.VOID));
|
||||
|
||||
public static final RegistryObject<Item> PICKAXE_CRYSTAL_EMERADIC = ITEMS.register("pickaxe_crystal_emeradic", () -> new ItemPickaxeAA(ToolMaterials.EMERADIC));
|
||||
public static final RegistryObject<Item> AXE_CRYSTAL_EMERADIC = ITEMS.register("axe_crystal_emeradic", () -> new ItemAxeAA(ToolMaterials.EMERADIC));
|
||||
|
@ -237,7 +237,7 @@ public final class ActuallyItems {
|
|||
public static final RegistryObject<Item> CHEST_CRYSTAL_EMERADIC = ITEMS.register("chest_crystal_emeradic", () -> new ItemArmorAA(ArmorMaterials.DIAMATINE, EquipmentSlotType.CHEST));
|
||||
public static final RegistryObject<Item> PANTS_CRYSTAL_EMERADIC = ITEMS.register("pants_crystal_emeradic", () -> new ItemArmorAA(ArmorMaterials.DIAMATINE, EquipmentSlotType.LEGS));
|
||||
public static final RegistryObject<Item> BOOTS_CRYSTAL_EMERADIC = ITEMS.register("boots_crystal_emeradic", () -> new ItemArmorAA(ArmorMaterials.DIAMATINE, EquipmentSlotType.FEET));
|
||||
public static final RegistryObject<Item> PAXEL_CRYSTAL_EMERADIC = ITEMS.register("paxel_crystal_emeradic", () -> new ItemAllToolAA(ToolMaterials.EMERADIC));
|
||||
public static final RegistryObject<Item> PAXEL_CRYSTAL_EMERADIC = ITEMS.register("paxel_crystal_emeradic", () -> new AllInOneTool(ToolMaterials.EMERADIC));
|
||||
|
||||
public static final RegistryObject<Item> PICKAXE_CRYSTAL_ENORI = ITEMS.register("pickaxe_crystal_enori", () -> new ItemPickaxeAA(ToolMaterials.ENORI));
|
||||
public static final RegistryObject<Item> AXE_CRYSTAL_ENORI = ITEMS.register("axe_crystal_enori", () -> new ItemAxeAA(ToolMaterials.ENORI));
|
||||
|
@ -248,7 +248,7 @@ public final class ActuallyItems {
|
|||
public static final RegistryObject<Item> CHEST_CRYSTAL_ENORI = ITEMS.register("chest_crystal_enori", () -> new ItemArmorAA(ArmorMaterials.ENORI, EquipmentSlotType.CHEST));
|
||||
public static final RegistryObject<Item> PANTS_CRYSTAL_ENORI = ITEMS.register("pants_crystal_enori", () -> new ItemArmorAA(ArmorMaterials.ENORI, EquipmentSlotType.LEGS));
|
||||
public static final RegistryObject<Item> BOOTS_CRYSTAL_ENORI = ITEMS.register("boots_crystal_enori", () -> new ItemArmorAA(ArmorMaterials.ENORI, EquipmentSlotType.FEET));
|
||||
public static final RegistryObject<Item> PAXEL_CRYSTAL_ENORI = ITEMS.register("paxel_crystal_enori", () -> new ItemAllToolAA(ToolMaterials.ENORI));
|
||||
public static final RegistryObject<Item> PAXEL_CRYSTAL_ENORI = ITEMS.register("paxel_crystal_enori", () -> new AllInOneTool(ToolMaterials.ENORI));
|
||||
|
||||
public static Item.Properties defaultProps() {
|
||||
return new Item.Properties().tab(ActuallyAdditions.GROUP);
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package de.ellpeck.actuallyadditions.mod.items;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.IActuallyItem;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class AllInOneTool extends ToolItem implements IActuallyItem {
|
||||
private final IItemTier tier;
|
||||
|
||||
public AllInOneTool(IItemTier tier) {
|
||||
super(
|
||||
4.0f,
|
||||
-2f,
|
||||
tier,
|
||||
ImmutableSet.of(),
|
||||
new Properties()
|
||||
.addToolType(ToolType.AXE, tier.getLevel())
|
||||
.addToolType(ToolType.HOE, tier.getLevel())
|
||||
.addToolType(ToolType.SHOVEL, tier.getLevel())
|
||||
.addToolType(ToolType.PICKAXE, tier.getLevel())
|
||||
.durability(tier.getUses() * 4)
|
||||
.tab(ActuallyAdditions.GROUP)
|
||||
);
|
||||
|
||||
this.tier = tier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType useOn(ItemUseContext context) {
|
||||
// How, no idea, possible, most likely :cry:
|
||||
if (context.getPlayer() == null) {
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
// Player not sneaking? Act as a Hoe to the block, else, Act as a shovel
|
||||
if (!context.getPlayer().isCrouching()) {
|
||||
return Items.IRON_HOE.useOn(context);
|
||||
}
|
||||
|
||||
return Items.IRON_SHOVEL.useOn(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) {
|
||||
return super.canApplyAtEnchantingTable(stack, enchantment) || enchantment.category.canEnchant(Items.DIAMOND_SWORD);
|
||||
}
|
||||
}
|
|
@ -1,128 +0,0 @@
|
|||
/*
|
||||
* This file ("ItemAllToolAA.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.mod.items;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemToolAA;
|
||||
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.IItemTier;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class ItemAllToolAA extends ItemToolAA implements IColorProvidingItem {
|
||||
|
||||
public final int color;
|
||||
|
||||
public ItemAllToolAA(IItemTier toolMat) {
|
||||
super(4.0F, -2F, toolMat, this.repairItem, unlocalizedName, this.rarity, new HashSet<>());
|
||||
this.color = this.color;
|
||||
|
||||
this.setMaxDamage(toolMat.getUses() * 4);
|
||||
this.setHarvestLevels(toolMat.getLevel());
|
||||
}
|
||||
|
||||
private void setHarvestLevels(int amount) {
|
||||
for (String s : this.getToolClasses(null)) {
|
||||
this.setHarvestLevel(s, amount);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRendering() {
|
||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), new ResourceLocation(ActuallyAdditions.MODID, "item_paxel"), "inventory");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onItemUse(PlayerEntity playerIn, World worldIn, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
|
||||
if (!playerIn.isShiftKeyDown()) {
|
||||
return Items.IRON_HOE.onItemUse(playerIn, worldIn, pos, hand, side, hitX, hitY, hitZ);
|
||||
}
|
||||
return Items.IRON_SHOVEL.onItemUse(playerIn, worldIn, pos, hand, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(BlockState state, ItemStack stack) {
|
||||
return this.hasExtraWhitelist(state.getBlock()) || state.getMaterial().isToolNotRequired() || state.getBlock() == Blocks.SNOW_LAYER || state.getBlock() == Blocks.SNOW || (state.getBlock() == Blocks.OBSIDIAN
|
||||
? this.toolMaterial.getHarvestLevel() >= 3
|
||||
: state.getBlock() != Blocks.DIAMOND_BLOCK && state.getBlock() != Blocks.DIAMOND_ORE
|
||||
? state.getBlock() != Blocks.EMERALD_ORE && state.getBlock() != Blocks.EMERALD_BLOCK
|
||||
? state.getBlock() != Blocks.GOLD_BLOCK && state.getBlock() != Blocks.GOLD_ORE
|
||||
? state.getBlock() != Blocks.IRON_BLOCK && state.getBlock() != Blocks.IRON_ORE
|
||||
? state.getBlock() != Blocks.LAPIS_BLOCK && state.getBlock() != Blocks.LAPIS_ORE
|
||||
? state.getBlock() != Blocks.REDSTONE_ORE && state.getBlock() != Blocks.LIT_REDSTONE_ORE
|
||||
? state.getMaterial() == Material.STONE || state.getMaterial() == Material.METAL || state.getMaterial() == Material.HEAVY_METAL
|
||||
: this.toolMaterial.getHarvestLevel() >= 2
|
||||
: this.toolMaterial.getHarvestLevel() >= 1
|
||||
: this.toolMaterial.getHarvestLevel() >= 1
|
||||
: this.toolMaterial.getHarvestLevel() >= 2
|
||||
: this.toolMaterial.getHarvestLevel() >= 2
|
||||
: this.toolMaterial.getHarvestLevel() >= 2);
|
||||
}
|
||||
|
||||
private boolean hasExtraWhitelist(Block block) {
|
||||
String name = block.getRegistryName().toString();
|
||||
for (String list : ConfigStringListValues.PAXEL_EXTRA_MINING_WHITELIST.getValue()) {
|
||||
if (list.equals(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getToolClasses(ItemStack stack) {
|
||||
return Sets.newHashSet("pickaxe", "axe", "shovel");
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDestroySpeed(ItemStack stack, BlockState state) {
|
||||
if (state.getBlock() == Blocks.COBWEB) {
|
||||
return 15.0F;
|
||||
} else {
|
||||
return this.hasExtraWhitelist(state.getBlock()) || state.getBlock().getHarvestTool(state) == null || state.getBlock().getHarvestTool(state).isEmpty() || this.getToolClasses(stack).contains(state.getBlock().getHarvestTool(state))
|
||||
? this.speed
|
||||
: 1.0F;
|
||||
}
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public IItemColor getItemColor() {
|
||||
return (stack, pass) -> pass > 0
|
||||
? ItemAllToolAA.this.color
|
||||
: 0xFFFFFF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) {
|
||||
return super.canApplyAtEnchantingTable(stack, enchantment) || enchantment.category.canEnchant(Items.DIAMOND_SWORD);
|
||||
}
|
||||
}
|
|
@ -18,105 +18,102 @@ import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
|||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.StringUtils;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemCoffee extends ItemFoodBase {
|
||||
|
||||
public ItemCoffee() {
|
||||
super(8, 5.0F, false, name);
|
||||
this.setMaxDamage(3);
|
||||
this.setAlwaysEdible();
|
||||
this.setMaxStackSize(1);
|
||||
this.setNoRepair();
|
||||
super(8, 5.0F, false); //, name);
|
||||
//this.setMaxDamage(3);
|
||||
//this.setAlwaysEdible();
|
||||
//this.setMaxStackSize(1);
|
||||
//this.setNoRepair();
|
||||
}
|
||||
|
||||
public static void initIngredients() {
|
||||
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new MilkIngredient(Ingredient.fromItem(Items.MILK_BUCKET)));
|
||||
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new MilkIngredient(Ingredient.of(Items.MILK_BUCKET)));
|
||||
//Pam's Soy Milk (For Jemx because he's lactose intolerant. YER HAPPY NAO!?)
|
||||
if (Loader.isModLoaded("harvestcraft")) {
|
||||
if (ModList.get().isLoaded("harvestcraft")) {
|
||||
Item item = ItemUtil.getItemFromName("harvestcraft:soymilkitem");
|
||||
if (item != null) {
|
||||
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new MilkIngredient(Ingredient.fromItem(item)));
|
||||
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new MilkIngredient(Ingredient.of(item)));
|
||||
}
|
||||
}
|
||||
|
||||
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.of(Items.SUGAR), 4, new PotionEffect(MobEffects.SPEED, 30, 0)));
|
||||
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.of(Items.MAGMA_CREAM), 2, new PotionEffect(MobEffects.FIRE_RESISTANCE, 20, 0)));
|
||||
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.of(new ItemStack(Items.FISH, 1, 3)), 2, new PotionEffect(MobEffects.WATER_BREATHING, 10, 0)));
|
||||
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.of(Items.GOLDEN_CARROT), 2, new PotionEffect(MobEffects.NIGHT_VISION, 30, 0)));
|
||||
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.of(Items.GHAST_TEAR), 3, new PotionEffect(MobEffects.REGENERATION, 5, 0)));
|
||||
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.of(Items.BLAZE_POWDER), 4, new PotionEffect(MobEffects.STRENGTH, 15, 0)));
|
||||
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.of(Items.FERMENTED_SPIDER_EYE), 2, new PotionEffect(MobEffects.INVISIBILITY, 25, 0)));
|
||||
//ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.of(Items.SUGAR), 4, new PotionEffect(MobEffects.SPEED, 30, 0)));
|
||||
//ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.of(Items.MAGMA_CREAM), 2, new PotionEffect(MobEffects.FIRE_RESISTANCE, 20, 0)));
|
||||
//ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.of(new ItemStack(Items.FISH, 1, 3)), 2, new PotionEffect(MobEffects.WATER_BREATHING, 10, 0)));
|
||||
//ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.of(Items.GOLDEN_CARROT), 2, new PotionEffect(MobEffects.NIGHT_VISION, 30, 0)));
|
||||
//ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.of(Items.GHAST_TEAR), 3, new PotionEffect(MobEffects.REGENERATION, 5, 0)));
|
||||
//ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.of(Items.BLAZE_POWDER), 4, new PotionEffect(MobEffects.STRENGTH, 15, 0)));
|
||||
//ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.of(Items.FERMENTED_SPIDER_EYE), 2, new PotionEffect(MobEffects.INVISIBILITY, 25, 0)));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static CoffeeIngredient getIngredientFromStack(ItemStack stack) {
|
||||
for (CoffeeIngredient ingredient : ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS) {
|
||||
if (ingredient.getInput().apply(stack)) {
|
||||
if (ingredient.getInput().test(stack)) {
|
||||
return ingredient;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void applyPotionEffectsFromStack(ItemStack stack, EntityLivingBase player) {
|
||||
public static void applyPotionEffectsFromStack(ItemStack stack, LivingEntity player) {/*
|
||||
PotionEffect[] effects = ActuallyAdditionsAPI.methodHandler.getEffectsFromStack(stack);
|
||||
if (effects != null && effects.length > 0) {
|
||||
for (PotionEffect effect : effects) {
|
||||
player.addPotionEffect(new PotionEffect(effect.getPotion(), effect.getDuration() * 20, effect.getAmplifier()));
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase player) {
|
||||
//@Override
|
||||
public ItemStack onItemUseFinish(ItemStack stack, World world, LivingEntity player) {
|
||||
ItemStack theStack = stack.copy();
|
||||
super.finishUsingItem(stack, world, player);
|
||||
applyPotionEffectsFromStack(stack, player);
|
||||
theStack.setItemDamage(theStack.getItemDamage() + 1);
|
||||
if (theStack.getMaxDamage() - theStack.getItemDamage() < 0) {
|
||||
return new ItemStack(ActuallyItems.COFFEE_CUP.get());
|
||||
} else {
|
||||
return theStack;
|
||||
}
|
||||
//theStack.setItemDamage(theStack.getItemDamage() + 1);
|
||||
//if (theStack.getMaxDamage() - theStack.getItemDamage() < 0) {
|
||||
// return new ItemStack(ActuallyItems.COFFEE_CUP.get());
|
||||
//} else {
|
||||
// return theStack;
|
||||
//}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction(ItemStack stack) {
|
||||
return EnumAction.DRINK;
|
||||
}
|
||||
//@Override
|
||||
//public EnumAction getItemUseAction(ItemStack stack) {
|
||||
// return EnumAction.DRINK;
|
||||
//}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public CompoundNBT getShareTag(ItemStack stack) {
|
||||
return super.getShareTag(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, @Nullable World playerIn, List<String> tooltip, ITooltipFlag advanced) {
|
||||
PotionEffect[] effects = ActuallyAdditionsAPI.methodHandler.getEffectsFromStack(stack);
|
||||
if (effects != null) {
|
||||
for (PotionEffect effect : effects) {
|
||||
tooltip.add(StringUtil.localize(effect.getEffectName()) + " " + (effect.getAmplifier() + 1) + ", " + StringUtils.formatTickDuration(effect.getDuration() * 20));
|
||||
}
|
||||
} else {
|
||||
tooltip.add(StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".coffeeCup.noEffect"));
|
||||
}
|
||||
public void appendHoverText(ItemStack stack, @Nullable World playerIn, List<ITextComponent> tooltip, ITooltipFlag advanced) {
|
||||
//PotionEffect[] effects = ActuallyAdditionsAPI.methodHandler.getEffectsFromStack(stack);
|
||||
//if (effects != null) {
|
||||
// for (PotionEffect effect : effects) {
|
||||
// tooltip.add(StringUtil.localize(effect.getEffectName()) + " " + (effect.getAmplifier() + 1) + ", " + StringUtils.formatTickDuration(effect.getDuration() * 20));
|
||||
// }
|
||||
//} else {
|
||||
// tooltip.add(StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".coffeeCup.noEffect"));
|
||||
//}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -137,10 +134,10 @@ public class ItemCoffee extends ItemFoodBase {
|
|||
|
||||
@Override
|
||||
public boolean effect(ItemStack stack) {
|
||||
PotionEffect[] effects = ActuallyAdditionsAPI.methodHandler.getEffectsFromStack(stack);
|
||||
ArrayList<PotionEffect> effectsNew = new ArrayList<>();
|
||||
//PotionEffect[] effects = ActuallyAdditionsAPI.methodHandler.getEffectsFromStack(stack);
|
||||
//ArrayList<PotionEffect> effectsNew = new ArrayList<>();
|
||||
if (effects != null && effects.length > 0) {
|
||||
for (PotionEffect effect : effects) {
|
||||
/* for (PotionEffect effect : effects) {
|
||||
if (effect.getAmplifier() > 0) {
|
||||
effectsNew.add(new PotionEffect(effect.getPotion(), effect.getDuration() + 120, effect.getAmplifier() - 1));
|
||||
}
|
||||
|
@ -149,7 +146,7 @@ public class ItemCoffee extends ItemFoodBase {
|
|||
if (effectsNew.size() > 0) {
|
||||
this.effects = effectsNew.toArray(new PotionEffect[effectsNew.size()]);
|
||||
ActuallyAdditionsAPI.methodHandler.addEffectToStack(stack, this);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
this.effects = null;
|
||||
return true;
|
||||
|
|
|
@ -10,40 +10,19 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.items;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheDusts;
|
||||
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Rarity;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
public class ItemDust extends ItemBase implements IColorProvidingItem {
|
||||
public class ItemDust extends ItemBase {
|
||||
|
||||
public static final TheDusts[] ALL_DUSTS = TheDusts.values();
|
||||
|
||||
public ItemDust() {
|
||||
super(name);
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage) {
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescriptionId(ItemStack stack) {
|
||||
return stack.getItemDamage() >= ALL_DUSTS.length
|
||||
? StringUtil.BUGGED_ITEM_NAME
|
||||
: this.getDescriptionId() + "_" + ALL_DUSTS[stack.getItemDamage()].name;
|
||||
//super(name);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public Rarity getRarity(ItemStack stack) {
|
||||
return stack.getItemDamage() >= ALL_DUSTS.length
|
||||
|
@ -51,31 +30,9 @@ public class ItemDust extends ItemBase implements IColorProvidingItem {
|
|||
: ALL_DUSTS[stack.getItemDamage()].rarity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
if (this.isInCreativeTab(tab)) {
|
||||
for (int j = 0; j < ALL_DUSTS.length; j++) {
|
||||
list.add(new ItemStack(this, 1, j));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRendering() {
|
||||
for (int i = 0; i < ALL_DUSTS.length; i++) {
|
||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this, 1, i), this.getRegistryName(), "inventory");
|
||||
}
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public IItemColor getItemColor() {
|
||||
return (stack, pass) -> stack.getItemDamage() >= ALL_DUSTS.length
|
||||
? 0xFFFFFF
|
||||
: ALL_DUSTS[stack.getItemDamage()].color;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
@Override
|
||||
public int getItemBurnTime(ItemStack stack) {
|
||||
if (stack.getMetadata() == 6) {
|
||||
|
@ -83,4 +40,6 @@ public class ItemDust extends ItemBase implements IColorProvidingItem {
|
|||
}
|
||||
return super.getItemBurnTime(stack);
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -1,124 +0,0 @@
|
|||
/*
|
||||
* This file ("ItemFoods.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.mod.items;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemFoodBase;
|
||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Rarity;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
public class ItemFoods extends ItemFoodBase {
|
||||
|
||||
public static final TheFoods[] ALL_FOODS = TheFoods.values();
|
||||
|
||||
public ItemFoods() {
|
||||
super(0, 0.0F, false, name);
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
TheFoods.setReturnItems();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase player) {
|
||||
ItemStack stackToReturn = super.finishUsingItem(stack, world, player);
|
||||
ItemStack returnItem = stack.getItemDamage() >= ALL_FOODS.length
|
||||
? null
|
||||
: ALL_FOODS[stack.getItemDamage()].returnItem;
|
||||
if (StackUtil.isValid(returnItem) && player instanceof PlayerEntity) {
|
||||
if (!((PlayerEntity) player).inventory.add(returnItem.copy())) {
|
||||
if (!world.isClientSide) {
|
||||
ItemEntity entityItem = new ItemEntity(player.world, player.posX, player.posY, player.posZ, returnItem.copy());
|
||||
entityItem.setPickUpDelay(0);
|
||||
player.world.addEntity(entityItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
return stackToReturn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration(ItemStack stack) {
|
||||
return stack.getItemDamage() >= ALL_FOODS.length
|
||||
? 0
|
||||
: ALL_FOODS[stack.getItemDamage()].useDuration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction(ItemStack stack) {
|
||||
return stack.getItemDamage() >= ALL_FOODS.length
|
||||
? EnumAction.EAT
|
||||
: ALL_FOODS[stack.getItemDamage()].getsDrunken
|
||||
? EnumAction.DRINK
|
||||
: EnumAction.EAT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHealAmount(ItemStack stack) {
|
||||
return stack.getItemDamage() >= ALL_FOODS.length
|
||||
? 0
|
||||
: ALL_FOODS[stack.getItemDamage()].healAmount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSaturationModifier(ItemStack stack) {
|
||||
return stack.getItemDamage() >= ALL_FOODS.length
|
||||
? 0
|
||||
: ALL_FOODS[stack.getItemDamage()].saturation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage) {
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescriptionId(ItemStack stack) {
|
||||
return stack.getItemDamage() >= ALL_FOODS.length
|
||||
? StringUtil.BUGGED_ITEM_NAME
|
||||
: this.getDescriptionId() + "_" + ALL_FOODS[stack.getItemDamage()].name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rarity getRarity(ItemStack stack) {
|
||||
return stack.getItemDamage() >= ALL_FOODS.length
|
||||
? Rarity.COMMON
|
||||
: ALL_FOODS[stack.getItemDamage()].rarity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
if (this.isInCreativeTab(tab)) {
|
||||
for (int j = 0; j < ALL_FOODS.length; j++) {
|
||||
list.add(new ItemStack(this, 1, j));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRendering() {
|
||||
for (int i = 0; i < ALL_FOODS.length; i++) {
|
||||
String name = this.getRegistryName() + "_" + ALL_FOODS[i].name;
|
||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this, 1, i), new ModelResourceLocation(name), "inventory");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,75 +10,33 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.items;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemFoodBase;
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ActuallyItem;
|
||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheJams;
|
||||
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.Food;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
public class ItemJams extends ItemFoodBase implements IColorProvidingItem {
|
||||
public class ItemJams extends ActuallyItem {
|
||||
|
||||
public static final TheJams[] ALL_JAMS = TheJams.values();
|
||||
|
||||
public ItemJams() {
|
||||
super(0, 0.0F, false, name);
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
this.setAlwaysEdible();
|
||||
super(baseProps().food(new Food.Builder().alwaysEat().build()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage) {
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescriptionId(ItemStack stack) {
|
||||
return stack.getItemDamage() >= ALL_JAMS.length
|
||||
? StringUtil.BUGGED_ITEM_NAME
|
||||
: this.getDescriptionId() + "_" + ALL_JAMS[stack.getItemDamage()].name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return stack.getItemDamage() >= ALL_JAMS.length
|
||||
? EnumRarity.COMMON
|
||||
: ALL_JAMS[stack.getItemDamage()].rarity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
if (this.isInCreativeTab(tab)) {
|
||||
for (int j = 0; j < ALL_JAMS.length; j++) {
|
||||
list.add(new ItemStack(this, 1, j));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase player) {
|
||||
//@Override
|
||||
public ItemStack onItemUseFinish(ItemStack stack, World world, LivingEntity player) {
|
||||
ItemStack stackToReturn = super.finishUsingItem(stack, world, player);
|
||||
|
||||
/*
|
||||
if (player instanceof PlayerEntity && !world.isClientSide && stack.getItemDamage() < ALL_JAMS.length) {
|
||||
PotionEffect firstEffectToGet = new PotionEffect(Potion.getPotionById(ALL_JAMS[stack.getItemDamage()].firstEffectToGet), 200);
|
||||
player.addPotionEffect(firstEffectToGet);
|
||||
Effect firstEffectToGet = new Effect(Potion.getPotionById(ALL_JAMS[stack.getItemDamage()].firstEffectToGet), 200);
|
||||
player.addEffect(firstEffectToGet);
|
||||
|
||||
PotionEffect secondEffectToGet = new PotionEffect(Potion.getPotionById(ALL_JAMS[stack.getItemDamage()].secondEffectToGet), 600);
|
||||
player.addPotionEffect(secondEffectToGet);
|
||||
Effect secondEffectToGet = new Effect(Potion.getPotionById(ALL_JAMS[stack.getItemDamage()].secondEffectToGet), 600);
|
||||
player.addEffect(secondEffectToGet);
|
||||
|
||||
ItemStack returnItem = new ItemStack(Items.GLASS_BOTTLE);
|
||||
if (!((PlayerEntity) player).inventory.add(returnItem.copy())) {
|
||||
|
@ -87,9 +45,12 @@ public class ItemJams extends ItemFoodBase implements IColorProvidingItem {
|
|||
player.world.addEntity(entityItem);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
return stackToReturn;
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public int getHealAmount(ItemStack stack) {
|
||||
return stack.getItemDamage() >= ALL_JAMS.length
|
||||
|
@ -104,20 +65,5 @@ public class ItemJams extends ItemFoodBase implements IColorProvidingItem {
|
|||
: ALL_JAMS[stack.getItemDamage()].saturation;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRendering() {
|
||||
for (int i = 0; i < ALL_JAMS.length; i++) {
|
||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this, 1, i), this.getRegistryName(), "inventory");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public IItemColor getItemColor() {
|
||||
return (stack, pass) -> pass > 0
|
||||
? stack.getItemDamage() >= ALL_JAMS.length
|
||||
? 0xFFFFFF
|
||||
: ALL_JAMS[stack.getItemDamage()].color
|
||||
: 0xFFFFFF;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -11,32 +11,23 @@
|
|||
package de.ellpeck.actuallyadditions.mod.items;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.misc.IDisplayStandItem;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||
import de.ellpeck.actuallyadditions.mod.items.metalists.ThePotionRings;
|
||||
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDisplayStandItem {
|
||||
public class ItemPotionRing extends ItemBase implements IDisplayStandItem {
|
||||
|
||||
public static final ThePotionRings[] ALL_RINGS = ThePotionRings.values();
|
||||
|
||||
|
@ -62,11 +53,6 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage) {
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
double diff = MAX_BLAZE - getStoredBlaze(stack);
|
||||
|
@ -79,22 +65,15 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi
|
|||
return MathHelper.hsvToRgb(Math.max(0.0F, (float) curr / MAX_BLAZE) / 3.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescriptionId(ItemStack stack) {
|
||||
return stack.getItemDamage() >= ALL_RINGS.length
|
||||
? StringUtil.BUGGED_ITEM_NAME
|
||||
: this.getDescriptionId() + ALL_RINGS[stack.getItemDamage()].name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack itemStack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5) {
|
||||
super.onUpdate(stack, world, player, par4, par5);
|
||||
|
||||
@Override
|
||||
public void inventoryTick(ItemStack stack, World world, Entity player, int par4, boolean par5) {
|
||||
super.inventoryTick(stack, world, player, par4, par5);
|
||||
/*
|
||||
if (!world.isClientSide && stack.getItemDamage() < ALL_RINGS.length) {
|
||||
if (player instanceof PlayerEntity) {
|
||||
PlayerEntity thePlayer = (PlayerEntity) player;
|
||||
|
@ -112,13 +91,15 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) {
|
||||
return slotChanged || !ItemStack.isSame(oldStack, newStack);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
if (Util.isClient()) {
|
||||
|
@ -137,8 +118,10 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi
|
|||
return standardName;
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
public Rarity getRarity(ItemStack stack) {
|
||||
return stack.getItemDamage() >= ALL_RINGS.length
|
||||
? EnumRarity.COMMON
|
||||
: ALL_RINGS[stack.getItemDamage()].rarity;
|
||||
|
@ -165,13 +148,7 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public IItemColor getItemColor() {
|
||||
return (stack, tintIndex) -> stack.getItemDamage() >= ALL_RINGS.length
|
||||
? 0xFFFFFF
|
||||
: ALL_RINGS[stack.getItemDamage()].color;
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean update(ItemStack stack, TileEntity tile, int elapsedTicks) {
|
||||
|
@ -179,16 +156,16 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi
|
|||
int range = advanced
|
||||
? 48
|
||||
: 16;
|
||||
List<EntityLivingBase> entities = tile.getLevel().getEntitiesOfClass(EntityLivingBase.class, new AxisAlignedBB(tile.getBlockPos().getX() - range, tile.getBlockPos().getY() - range, tile.getBlockPos().getZ() - range, tile.getBlockPos().getX() + range, tile.getBlockPos().getY() + range, tile.getBlockPos().getZ() + range));
|
||||
List<LivingEntity> entities = tile.getLevel().getEntitiesOfClass(LivingEntity.class, new AxisAlignedBB(tile.getBlockPos().getX() - range, tile.getBlockPos().getY() - range, tile.getBlockPos().getZ() - range, tile.getBlockPos().getX() + range, tile.getBlockPos().getY() + range, tile.getBlockPos().getZ() + range));
|
||||
if (entities != null && !entities.isEmpty()) {
|
||||
if (advanced) {
|
||||
//Give all entities the effect
|
||||
for (EntityLivingBase entity : entities) {
|
||||
for (LivingEntity entity : entities) {
|
||||
this.effectEntity(entity, stack, true);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
Potion potion = Potion.getPotionById(ThePotionRings.values()[stack.getItemDamage()].effectID);
|
||||
} else {/*
|
||||
Potion potion = Potion.byName(ThePotionRings.values()[stack.getItemDamage()].effectID);
|
||||
for (EntityLivingBase entity : entities) {
|
||||
if (entity.isPotionActive(potion)) {
|
||||
//Sometimes make the effect switch to someone else
|
||||
|
@ -202,14 +179,16 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi
|
|||
return true;
|
||||
}
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
//Give the effect to someone new if no one had it or it randomly switched
|
||||
Collections.shuffle(entities);
|
||||
this.effectEntity(entities.get(0), stack, true);
|
||||
return true;
|
||||
//Collections.shuffle(entities);
|
||||
//this.effectEntity(entities.get(0), stack, true);
|
||||
//return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -218,7 +197,8 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi
|
|||
return 325;
|
||||
}
|
||||
|
||||
private boolean effectEntity(EntityLivingBase thePlayer, ItemStack stack, boolean canUseBasic) {
|
||||
private boolean effectEntity(LivingEntity thePlayer, ItemStack stack, boolean canUseBasic) {
|
||||
/*
|
||||
ThePotionRings effect = ThePotionRings.values()[stack.getItemDamage()];
|
||||
Potion potion = Potion.getPotionById(effect.effectID);
|
||||
PotionEffect activeEffect = thePlayer.getActivePotionEffect(potion);
|
||||
|
@ -233,12 +213,14 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, @Nullable World playerIn, List<String> tooltip, ITooltipFlag advanced) {
|
||||
public void appendHoverText(ItemStack stack, @Nullable World playerIn, List<ITextComponent> tooltip, ITooltipFlag advanced) {
|
||||
super.appendHoverText(stack, playerIn, tooltip, advanced);
|
||||
tooltip.add(String.format("%d/%d %s", getStoredBlaze(stack), MAX_BLAZE, StringUtil.localize("item." + ActuallyAdditions.MODID + ".item_misc_ring.storage")));
|
||||
//tooltip.add(String.format("%d/%d %s", getStoredBlaze(stack), MAX_BLAZE, StringUtil.localize("item." + ActuallyAdditions.MODID + ".item_misc_ring.storage")));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,13 +14,12 @@ import com.google.common.collect.Sets;
|
|||
import de.ellpeck.actuallyadditions.mod.items.base.ItemToolAA;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.IItemTier;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package de.ellpeck.actuallyadditions.mod.items.base;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
/**
|
||||
* I'm using a custom class here as I'm sure we'll need a unified way of declaring rules
|
||||
* but also so we can always know if something is ours in the simplest form.
|
||||
*/
|
||||
public abstract class ActuallyItem extends Item implements IActuallyItem {
|
||||
public ActuallyItem(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
protected static Properties baseProps() {
|
||||
return new Properties().tab(ActuallyAdditions.GROUP);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package de.ellpeck.actuallyadditions.mod.items.base;
|
||||
|
||||
// Currently nothing :cry:
|
||||
public interface IActuallyItem {
|
||||
}
|
|
@ -13,14 +13,12 @@ package de.ellpeck.actuallyadditions.mod.items.base;
|
|||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemSeedFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
|
||||
public class ItemFoodSeed extends ItemSeedFood {
|
||||
public class ItemFoodSeed /*extends ItemSeedFood */{ //TODO what is this?!
|
||||
|
||||
public final Block plant;
|
||||
public final String name;
|
||||
|
@ -28,7 +26,7 @@ public class ItemFoodSeed extends ItemSeedFood {
|
|||
private final int maxUseDuration;
|
||||
|
||||
public ItemFoodSeed(String name, String oredictName, Block plant, Item returnItem, int returnMeta, int healAmount, float saturation, int maxUseDuration) {
|
||||
super(healAmount, saturation, plant, Blocks.FARMLAND);
|
||||
//super(healAmount, saturation, plant, Blocks.FARMLAND);
|
||||
this.name = name;
|
||||
this.oredictName = oredictName;
|
||||
this.plant = plant;
|
||||
|
@ -39,13 +37,13 @@ public class ItemFoodSeed extends ItemSeedFood {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
//@Override
|
||||
public int getMaxItemUseDuration(ItemStack stack) {
|
||||
return this.maxUseDuration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getPlant(IBlockAccess world, BlockPos pos) {
|
||||
//@Override
|
||||
public BlockState getPlant(IBlockReader world, BlockPos pos) {
|
||||
return this.plant.defaultBlockState();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,20 +13,17 @@ package de.ellpeck.actuallyadditions.mod.items.base;
|
|||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemSeeds;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
|
||||
public class ItemSeed extends ItemSeeds {
|
||||
public class ItemSeed /* extends ItemSeeds*/ {
|
||||
|
||||
public final Block plant;
|
||||
public final String oredictName;
|
||||
|
||||
public ItemSeed(String oredictName, Block plant, Item returnItem, int returnMeta) {
|
||||
super(plant, Blocks.FARMLAND);
|
||||
//super(plant, Blocks.FARMLAND);
|
||||
this.oredictName = oredictName;
|
||||
this.plant = plant;
|
||||
|
||||
|
@ -35,8 +32,8 @@ public class ItemSeed extends ItemSeeds {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getPlant(IBlockAccess world, BlockPos pos) {
|
||||
//@Override
|
||||
public BlockState getPlant(IBlockReader world, BlockPos pos) {
|
||||
return this.plant.defaultBlockState();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package de.ellpeck.actuallyadditions.mod.items.misc;
|
||||
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ActuallyItem;
|
||||
|
||||
public class DrillAugmentItem extends ActuallyItem {
|
||||
private final AugmentType type;
|
||||
|
||||
public DrillAugmentItem(AugmentType type) {
|
||||
super(baseProps().stacksTo(1));
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public AugmentType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public enum AugmentType {
|
||||
SPEED_AUGMENT_I(50),
|
||||
SPEED_AUGMENT_II(75),
|
||||
SPEED_AUGMENT_III(175),
|
||||
SILK_TOUCH_AUGMENT(100),
|
||||
FORTUNE_AUGMENT_I(40),
|
||||
FORTUNE_AUGMENT_II(80),
|
||||
MINING_AUGMENT_I(10),
|
||||
MINING_AUGMENT_II(30),
|
||||
BLOCK_PLACING_AUGMENT(0);
|
||||
|
||||
int energyCost;
|
||||
|
||||
AugmentType(int energyCost) {
|
||||
this.energyCost = energyCost;
|
||||
}
|
||||
|
||||
public int getEnergyCost() {
|
||||
return energyCost;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package de.ellpeck.actuallyadditions.mod.items.misc;
|
||||
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ActuallyItem;
|
||||
import net.minecraft.item.Food;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
|
||||
public class YummyItem extends ActuallyItem {
|
||||
private final Foods food;
|
||||
|
||||
public YummyItem(Foods food) {
|
||||
super(baseProps().food(food.food));
|
||||
|
||||
this.food = food;
|
||||
}
|
||||
|
||||
public enum Foods {
|
||||
CHEESE(new Food.Builder().nutrition(1).saturationMod(0.05F), 3),
|
||||
PUMPKIN_STEW(new Food.Builder().nutrition(6).saturationMod(0.3F), 30, true, new ItemStack(Items.BOWL)),
|
||||
CARROT_JUICE(new Food.Builder().nutrition(4).saturationMod(0.2F), 20, true, new ItemStack(Items.GLASS_BOTTLE)),
|
||||
FISH_N_CHIPS(new Food.Builder().nutrition(14).saturationMod(0.65F), 40, new ItemStack(ActuallyItems.PAPER_CONE.get())),
|
||||
FRENCH_FRIES(new Food.Builder().nutrition(10).saturationMod(0.6F), 32, new ItemStack(ActuallyItems.PAPER_CONE.get())),
|
||||
FRENCH_FRY(new Food.Builder().nutrition(2).saturationMod(0.025F), 3),
|
||||
SPAGHETTI(new Food.Builder().nutrition(7).saturationMod(0.4F), 38, new ItemStack(Items.BOWL)),
|
||||
NOODLE(new Food.Builder().nutrition(1).saturationMod(0.01F), 3),
|
||||
CHOCOLATE_CAKE(new Food.Builder().nutrition(16).saturationMod(0.8F), 45),
|
||||
CHOCOLATE(new Food.Builder().nutrition(3).saturationMod(0.3F), 15),
|
||||
TOAST(new Food.Builder().nutrition(3).saturationMod(0.08F), 25),
|
||||
SUBMARINE_SANDWICH(new Food.Builder().nutrition(9).saturationMod(0.4F), 40),
|
||||
BIG_COOKIE(new Food.Builder().nutrition(4).saturationMod(0.25F), 20),
|
||||
HAMBURGER(new Food.Builder().nutrition(13).saturationMod(0.65F), 40),
|
||||
PIZZA(new Food.Builder().nutrition(16).saturationMod(0.8F), 45),
|
||||
BAGUETTE(new Food.Builder().nutrition(6).saturationMod(0.5F), 25),
|
||||
RICE(new Food.Builder().nutrition(2).saturationMod(0.05F), 10),
|
||||
RICE_BREAD(new Food.Builder().nutrition(6).saturationMod(0.5F), 25),
|
||||
DOUGHNUT(new Food.Builder().nutrition(2).saturationMod(0.1F), 10),
|
||||
CHOCOLATE_TOAST(new Food.Builder().nutrition(5).saturationMod(0.2F), 40),
|
||||
BACON(new Food.Builder().nutrition(4).saturationMod(0.1F), 30);
|
||||
|
||||
Food food;
|
||||
int useDuration;
|
||||
boolean isDrunken;
|
||||
ItemStack returnItem;
|
||||
|
||||
Foods(Food.Builder food, int useDuration, boolean isDrunken, ItemStack returnItem) {
|
||||
this.food = food.build();
|
||||
this.useDuration = useDuration;
|
||||
this.isDrunken = isDrunken;
|
||||
this.returnItem = returnItem;
|
||||
}
|
||||
|
||||
Foods(Food.Builder food, int useDuration) {
|
||||
this(food, useDuration, false, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
Foods(Food.Builder food, int useDuration, ItemStack returnItem) {
|
||||
this(food, useDuration, false, returnItem);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.network;
|
|||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterTrials;
|
||||
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
|
||||
import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -75,9 +74,9 @@ public final class PacketHandlerHelper {
|
|||
|
||||
int total = 0;
|
||||
for (IBookletChapter chapter : ActuallyAdditionsAPI.entryTrials.getAllChapters()) {
|
||||
if (chapter instanceof BookletChapterTrials) {
|
||||
total++;
|
||||
}
|
||||
//if (chapter instanceof BookletChapterTrials) {
|
||||
// total++;
|
||||
//}
|
||||
}
|
||||
|
||||
if (data.completedTrials.size() >= total) {
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.tile;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnervator;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover;
|
||||
|
@ -29,8 +30,6 @@ import net.minecraftforge.energy.IEnergyStorage;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
|
||||
|
||||
public class TileEntityEnervator extends TileEntityInventoryBase implements ISharingEnergyProvider, INamedContainerProvider {
|
||||
|
||||
public final CustomEnergyStorage storage = new CustomEnergyStorage(50000, 0, 1000);
|
||||
|
@ -38,7 +37,7 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements ISha
|
|||
private int lastEnergy;
|
||||
|
||||
public TileEntityEnervator() {
|
||||
super(ActuallyTiles.ENERVATOR_TILE.get(), 2);
|
||||
super(ActuallyBlocks.ENERVATOR.getTileEntityType(), 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,332 +0,0 @@
|
|||
/*
|
||||
* This file ("TileEntityInputter.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.mod.tile;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerInputter;
|
||||
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
|
||||
import de.ellpeck.actuallyadditions.mod.network.gui.INumberReactor;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.container.INamedContainerProvider;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.AbstractFurnaceTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
|
||||
|
||||
public class TileEntityInputter extends TileEntityInventoryBase implements IButtonReactor, INumberReactor, INamedContainerProvider {
|
||||
|
||||
public static final int OKAY_BUTTON_ID = 133;
|
||||
private final SlotlessableItemHandlerWrapper wrapper = new SlotlessableItemHandlerWrapper(this.lazyInv, null);
|
||||
public int sideToPut = -1;
|
||||
public int slotToPutStart;
|
||||
public int slotToPutEnd;
|
||||
public Map<Direction, SlotlessableItemHandlerWrapper> placeToPut = new ConcurrentHashMap<>();
|
||||
public int sideToPull = -1;
|
||||
public int slotToPullStart;
|
||||
public int slotToPullEnd;
|
||||
public Map<Direction, SlotlessableItemHandlerWrapper> placeToPull = new ConcurrentHashMap<>();
|
||||
public boolean isAdvanced;
|
||||
public FilterSettings leftFilter = new FilterSettings(12, true, true, false, false, 0, -1000);
|
||||
public FilterSettings rightFilter = new FilterSettings(12, true, true, false, false, 0, -2000);
|
||||
private int lastPutSide;
|
||||
private int lastPutStart;
|
||||
private int lastPutEnd;
|
||||
private int lastPullSide;
|
||||
private int lastPullStart;
|
||||
private int lastPullEnd;
|
||||
|
||||
public TileEntityInputter(TileEntityType<?> type, int slots) {
|
||||
super(type, slots);
|
||||
}
|
||||
|
||||
public TileEntityInputter() {
|
||||
super(ActuallyTiles.INPUTTER_TILE.get(), 1);
|
||||
this.isAdvanced = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNumberReceived(double number, int textID, PlayerEntity player) {
|
||||
int text = (int) number;
|
||||
|
||||
if (text != -1) {
|
||||
if (textID == 0) {
|
||||
this.slotToPutStart = Math.max(text, 0);
|
||||
}
|
||||
if (textID == 1) {
|
||||
this.slotToPutEnd = Math.max(text, 0);
|
||||
}
|
||||
|
||||
if (textID == 2) {
|
||||
this.slotToPullStart = Math.max(text, 0);
|
||||
}
|
||||
if (textID == 3) {
|
||||
this.slotToPullEnd = Math.max(text, 0);
|
||||
}
|
||||
}
|
||||
this.setChanged();
|
||||
}
|
||||
|
||||
private boolean newPulling() {
|
||||
for (Direction side : this.placeToPull.keySet()) {
|
||||
WorldUtil.doItemInteraction(this.placeToPull.get(side), this.wrapper, Integer.MAX_VALUE, this.slotToPullStart, this.slotToPullEnd, 0, 1, !this.isAdvanced
|
||||
? null
|
||||
: this.leftFilter);
|
||||
|
||||
if (this.placeToPull instanceof TileEntityItemInterface) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean newPutting() {
|
||||
if (!this.isAdvanced || this.rightFilter.check(this.inv.getStackInSlot(0))) {
|
||||
for (Direction side : this.placeToPut.keySet()) {
|
||||
WorldUtil.doItemInteraction(this.wrapper, this.placeToPut.get(side), Integer.MAX_VALUE, 0, 1, this.slotToPutStart, this.slotToPutEnd, null);
|
||||
|
||||
if (this.placeToPut instanceof TileEntityItemInterface) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSaveDataOnChangeOrWorldStart() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets all of the relevant variables
|
||||
*/
|
||||
@Override
|
||||
public void saveDataOnChangeOrWorldStart() {
|
||||
this.placeToPull.clear();
|
||||
this.placeToPut.clear();
|
||||
|
||||
if (this.sideToPull != -1) {
|
||||
Direction side = WorldUtil.getDirectionBySidesInOrder(this.sideToPull);
|
||||
BlockPos offset = this.worldPosition.relative(side);
|
||||
|
||||
if (this.level.hasChunkAt(offset)) {
|
||||
TileEntity tile = this.level.getBlockEntity(offset);
|
||||
|
||||
if (tile != null) {
|
||||
for (Direction facing : Direction.values()) {
|
||||
LazyOptional<IItemHandler> normal;
|
||||
if (tile instanceof AbstractFurnaceTileEntity) {
|
||||
normal = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
|
||||
} else {
|
||||
normal = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing);
|
||||
}
|
||||
|
||||
|
||||
// TODO: [port] add support for this back eventually.
|
||||
Object slotless = null;
|
||||
// if (ActuallyAdditions.commonCapsLoaded) {
|
||||
// if (tile.hasCapability(SlotlessItemHandlerConfig.CAPABILITY, facing)) {
|
||||
// slotless = tile.getCapability(SlotlessItemHandlerConfig.CAPABILITY, facing);
|
||||
// }
|
||||
// }
|
||||
|
||||
this.placeToPull.put(facing.getOpposite(), new SlotlessableItemHandlerWrapper(normal, slotless));
|
||||
}
|
||||
|
||||
if (this.slotToPullEnd <= 0) {
|
||||
tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
|
||||
.ifPresent(cap -> this.slotToPullEnd = cap.getSlots());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.sideToPut != -1) {
|
||||
Direction side = WorldUtil.getDirectionBySidesInOrder(this.sideToPut);
|
||||
BlockPos offset = this.worldPosition.relative(side);
|
||||
|
||||
if (this.level.hasChunkAt(offset)) {
|
||||
TileEntity tile = this.level.getBlockEntity(offset);
|
||||
|
||||
if (tile != null) {
|
||||
for (Direction facing : Direction.values()) {
|
||||
LazyOptional<IItemHandler> normal = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing);
|
||||
|
||||
// TODO: [port] add support for this back eventually.
|
||||
Object slotless = null;
|
||||
// if (ActuallyAdditions.commonCapsLoaded) {
|
||||
// if (tile.hasCapability(SlotlessItemHandlerConfig.CAPABILITY, facing)) {
|
||||
// slotless = tile.getCapability(SlotlessItemHandlerConfig.CAPABILITY, facing);
|
||||
// }
|
||||
// }
|
||||
|
||||
this.placeToPut.put(facing.getOpposite(), new SlotlessableItemHandlerWrapper(normal, slotless));
|
||||
}
|
||||
|
||||
if (this.slotToPutEnd <= 0) {
|
||||
tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)
|
||||
.ifPresent(cap -> this.slotToPutEnd = cap.getSlots());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onButtonPressed(int buttonID, PlayerEntity player) {
|
||||
this.leftFilter.onButtonPressed(buttonID);
|
||||
this.rightFilter.onButtonPressed(buttonID);
|
||||
|
||||
//Reset the Slots
|
||||
if (buttonID == 0 || buttonID == 1) {
|
||||
this.slotToPutStart = 0;
|
||||
this.slotToPutEnd = 0;
|
||||
}
|
||||
if (buttonID == 2 || buttonID == 3) {
|
||||
this.slotToPullStart = 0;
|
||||
this.slotToPullEnd = 0;
|
||||
}
|
||||
|
||||
if (buttonID == 0) {
|
||||
this.sideToPut++;
|
||||
}
|
||||
if (buttonID == 1) {
|
||||
this.sideToPut--;
|
||||
}
|
||||
|
||||
if (buttonID == 2) {
|
||||
this.sideToPull++;
|
||||
}
|
||||
if (buttonID == 3) {
|
||||
this.sideToPull--;
|
||||
}
|
||||
|
||||
if (this.sideToPut >= 6) {
|
||||
this.sideToPut = -1;
|
||||
} else if (this.sideToPut < -1) {
|
||||
this.sideToPut = 5;
|
||||
} else if (this.sideToPull >= 6) {
|
||||
this.sideToPull = -1;
|
||||
} else if (this.sideToPull < -1) {
|
||||
this.sideToPull = 5;
|
||||
}
|
||||
|
||||
this.setChanged();
|
||||
this.saveDataOnChangeOrWorldStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(CompoundNBT compound, NBTType type) {
|
||||
super.writeSyncableNBT(compound, type);
|
||||
if (type != NBTType.SAVE_BLOCK) {
|
||||
compound.putInt("SideToPut", this.sideToPut);
|
||||
compound.putInt("SlotToPut", this.slotToPutStart);
|
||||
compound.putInt("SlotToPutEnd", this.slotToPutEnd);
|
||||
compound.putInt("SideToPull", this.sideToPull);
|
||||
compound.putInt("SlotToPull", this.slotToPullStart);
|
||||
compound.putInt("SlotToPullEnd", this.slotToPullEnd);
|
||||
}
|
||||
|
||||
this.leftFilter.writeToNBT(compound, "LeftFilter");
|
||||
this.rightFilter.writeToNBT(compound, "RightFilter");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(CompoundNBT compound, NBTType type) {
|
||||
if (type != NBTType.SAVE_BLOCK) {
|
||||
this.sideToPut = compound.getInt("SideToPut");
|
||||
this.slotToPutStart = compound.getInt("SlotToPut");
|
||||
this.slotToPutEnd = compound.getInt("SlotToPutEnd");
|
||||
this.sideToPull = compound.getInt("SideToPull");
|
||||
this.slotToPullStart = compound.getInt("SlotToPull");
|
||||
this.slotToPullEnd = compound.getInt("SlotToPullEnd");
|
||||
}
|
||||
|
||||
this.leftFilter.readFromNBT(compound, "LeftFilter");
|
||||
this.rightFilter.readFromNBT(compound, "RightFilter");
|
||||
|
||||
super.readSyncableNBT(compound, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (!this.level.isClientSide) {
|
||||
|
||||
//Is Block not powered by Redstone?
|
||||
if (!this.isRedstonePowered) {
|
||||
if (this.ticksElapsed % 30 == 0) {
|
||||
if (!(this.sideToPull == this.sideToPut && this.slotToPullStart == this.slotToPutStart && this.slotToPullEnd == this.slotToPutEnd)) {
|
||||
if (!StackUtil.isValid(this.inv.getStackInSlot(0)) && this.sideToPull != -1 && this.placeToPull != null) {
|
||||
this.newPulling();
|
||||
}
|
||||
|
||||
if (StackUtil.isValid(this.inv.getStackInSlot(0)) && this.sideToPut != -1 && this.placeToPut != null) {
|
||||
this.newPutting();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Update the Client
|
||||
if ((this.sideToPut != this.lastPutSide || this.sideToPull != this.lastPullSide || this.slotToPullStart != this.lastPullStart || this.slotToPullEnd != this.lastPullEnd || this.slotToPutStart != this.lastPutStart || this.slotToPutEnd != this.lastPutEnd || this.leftFilter.needsUpdateSend() || this.rightFilter.needsUpdateSend()) && this.sendUpdateWithInterval()) {
|
||||
this.lastPutSide = this.sideToPut;
|
||||
this.lastPullSide = this.sideToPull;
|
||||
this.lastPullStart = this.slotToPullStart;
|
||||
this.lastPullEnd = this.slotToPullEnd;
|
||||
this.lastPutStart = this.slotToPutStart;
|
||||
this.lastPutEnd = this.slotToPutEnd;
|
||||
this.leftFilter.updateLasts();
|
||||
this.rightFilter.updateLasts();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAcceptor getAcceptor() {
|
||||
return (slot, stack, automation) -> !automation || slot == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRemover getRemover() {
|
||||
return (slot, automation) -> !automation || slot == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent getDisplayName() {
|
||||
return StringTextComponent.EMPTY;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) {
|
||||
return new ContainerInputter(windowId, playerInventory, this);
|
||||
}
|
||||
}
|
|
@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
|||
import de.ellpeck.actuallyadditions.api.tile.IPhantomTile;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerPhantomPlacer;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
|
||||
|
@ -39,8 +38,6 @@ import net.minecraft.world.server.ServerWorld;
|
|||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
|
||||
|
||||
public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements IPhantomTile, IButtonReactor, INamedContainerProvider {
|
||||
|
||||
public static final int RANGE = 3;
|
||||
|
@ -195,11 +192,6 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
|
|||
this.boundPosition = pos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGuiID() {
|
||||
return GuiHandler.GuiTypes.PHANTOM_PLACER.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRange() {
|
||||
return this.range;
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
/*
|
||||
* This file ("IColorProvidingBlock.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.mod.util;
|
||||
|
||||
import net.minecraft.client.renderer.color.IBlockColor;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
public interface IColorProvidingBlock {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
IBlockColor getBlockColor();
|
||||
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
/*
|
||||
* This file ("IColorProvidingItem.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.mod.util;
|
||||
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
public interface IColorProvidingItem {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
IItemColor getItemColor();
|
||||
|
||||
}
|
Loading…
Reference in a new issue