mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-24 16:18:33 +01:00
Compare commits
10 commits
789570e25d
...
ac3551061d
Author | SHA1 | Date | |
---|---|---|---|
|
ac3551061d | ||
|
eb3072bcbe | ||
|
b3a00f8d4e | ||
|
3980b8dc46 | ||
|
5236744941 | ||
|
b6406c7adc | ||
|
4273fdd0f5 | ||
|
eccf77dd54 | ||
|
01ee39973a | ||
|
4b57b9fb45 |
56 changed files with 746 additions and 817 deletions
|
@ -10,15 +10,10 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.api.internal;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.potion.EffectInstance;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -50,25 +45,25 @@ public interface IMethodHandler {
|
|||
//Use Ingredient input on AA API class
|
||||
boolean addCrusherRecipes(List<ItemStack> inputs, ItemStack outputOne, int outputOneAmount, ItemStack outputTwo, int outputTwoAmount, int outputTwoChance);
|
||||
|
||||
IBookletPage generateTextPage(int id);
|
||||
|
||||
IBookletPage generatePicturePage(int id, ResourceLocation resLoc, int textStartY);
|
||||
|
||||
IBookletPage generateCraftingPage(int id, IRecipe... recipes);
|
||||
|
||||
IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result);
|
||||
|
||||
IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages);
|
||||
|
||||
IBookletPage generateTextPage(int id, int priority);
|
||||
|
||||
IBookletPage generatePicturePage(int id, ResourceLocation resLoc, int textStartY, int priority);
|
||||
|
||||
IBookletPage generateCraftingPage(int id, int priority, IRecipe... recipes);
|
||||
|
||||
IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result, int priority);
|
||||
|
||||
IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, int priority, IBookletPage... pages);
|
||||
|
||||
IBookletChapter createTrial(String identifier, ItemStack displayStack, boolean textOnSecondPage);
|
||||
// IBookletPage generateTextPage(int id);
|
||||
//
|
||||
// IBookletPage generatePicturePage(int id, ResourceLocation resLoc, int textStartY);
|
||||
//
|
||||
// IBookletPage generateCraftingPage(int id, IRecipe... recipes);
|
||||
//
|
||||
// IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result);
|
||||
//
|
||||
// IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages);
|
||||
//
|
||||
// IBookletPage generateTextPage(int id, int priority);
|
||||
//
|
||||
// IBookletPage generatePicturePage(int id, ResourceLocation resLoc, int textStartY, int priority);
|
||||
//
|
||||
// IBookletPage generateCraftingPage(int id, int priority, IRecipe... recipes);
|
||||
//
|
||||
// IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result, int priority);
|
||||
//
|
||||
// IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, int priority, IBookletPage... pages);
|
||||
//
|
||||
// IBookletChapter createTrial(String identifier, ItemStack displayStack, boolean textOnSecondPage);
|
||||
}
|
||||
|
|
|
@ -48,8 +48,7 @@ public class ActuallyAdditionsClient {
|
|||
ScreenManager.register(ActuallyContainers.FIREWORK_BOX_CONTAINER.get(), GuiFireworkBox::new);
|
||||
ScreenManager.register(ActuallyContainers.FLUID_COLLECTOR_CONTAINER.get(), GuiFluidCollector::new);
|
||||
ScreenManager.register(ActuallyContainers.FURNACE_DOUBLE_CONTAINER.get(), GuiFurnaceDouble::new);
|
||||
ScreenManager.register(ActuallyContainers.GRINDER_CONTAINER.get(), GuiGrinder::new);
|
||||
ScreenManager.register(ActuallyContainers.INPUTTER_CONTAINER.get(), GuiInputter::new);
|
||||
ScreenManager.register(ActuallyContainers.GRINDER_CONTAINER.get(), CrusherScreen::new);
|
||||
ScreenManager.register(ActuallyContainers.LASER_RELAY_ITEM_WHITELIST_CONTAINER.get(), GuiLaserRelayItemWhitelist::new);
|
||||
ScreenManager.register(ActuallyContainers.MINER_CONTAINER.get(), GuiMiner::new);
|
||||
ScreenManager.register(ActuallyContainers.OIL_GENERATOR_CONTAINER.get(), GuiOilGenerator::new);
|
||||
|
@ -82,7 +81,7 @@ public class ActuallyAdditionsClient {
|
|||
}
|
||||
|
||||
// TODO: [port] validate that this works
|
||||
public void sendBreakPacket(BlockPos pos) {
|
||||
public static void sendBreakPacket(BlockPos pos) {
|
||||
ClientPlayNetHandler connection = Minecraft.getInstance().getConnection();
|
||||
assert connection != null;
|
||||
assert Minecraft.getInstance().hitResult != null;
|
||||
|
|
|
@ -21,8 +21,6 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.client.MainWindow;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.inventory.container.INamedContainerProvider;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -39,7 +37,6 @@ import net.minecraft.world.IBlockReader;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.network.NetworkHooks;
|
||||
|
||||
|
||||
public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
|
||||
|
@ -107,14 +104,14 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
|
|||
if (this.tryToggleRedstone(world, pos, player)) {
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
/*
|
||||
if (!world.isClientSide) {
|
||||
TileEntity tile = world.getBlockEntity(pos);
|
||||
if (tile instanceof IPhantomTile && ((IPhantomTile) tile).getGuiID() != -1) {
|
||||
NetworkHooks.openGui((ServerPlayerEntity) player, (INamedContainerProvider) tile, pos);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,7 @@ public class ActuallyContainers {
|
|||
public static final RegistryObject<ContainerType<ContainerFireworkBox>> FIREWORK_BOX_CONTAINER = CONTAINERS.register("firework_box_container", () -> IForgeContainerType.create(ContainerFireworkBox::fromNetwork));
|
||||
public static final RegistryObject<ContainerType<ContainerFluidCollector>> FLUID_COLLECTOR_CONTAINER = CONTAINERS.register("fluid_collector_container", () -> IForgeContainerType.create(ContainerFluidCollector::fromNetwork));
|
||||
public static final RegistryObject<ContainerType<ContainerFurnaceDouble>> FURNACE_DOUBLE_CONTAINER = CONTAINERS.register("furnace_double_container", () -> IForgeContainerType.create(ContainerFurnaceDouble::fromNetwork));
|
||||
public static final RegistryObject<ContainerType<ContainerGrinder>> GRINDER_CONTAINER = CONTAINERS.register("grinder_container", () -> IForgeContainerType.create(ContainerGrinder::fromNetwork));
|
||||
public static final RegistryObject<ContainerType<ContainerInputter>> INPUTTER_CONTAINER = CONTAINERS.register("inputter_container", () -> IForgeContainerType.create(ContainerInputter::fromNetwork));
|
||||
public static final RegistryObject<ContainerType<CrusherContainer>> GRINDER_CONTAINER = CONTAINERS.register("grinder_container", () -> IForgeContainerType.create(CrusherContainer::fromNetwork));
|
||||
public static final RegistryObject<ContainerType<ContainerLaserRelayItemWhitelist>> LASER_RELAY_ITEM_WHITELIST_CONTAINER = CONTAINERS.register("laser_relay_item_whitelist_container", () -> IForgeContainerType.create(ContainerLaserRelayItemWhitelist::fromNetwork));
|
||||
public static final RegistryObject<ContainerType<ContainerMiner>> MINER_CONTAINER = CONTAINERS.register("miner_container", () -> IForgeContainerType.create(ContainerMiner::fromNetwork));
|
||||
public static final RegistryObject<ContainerType<ContainerOilGenerator>> OIL_GENERATOR_CONTAINER = CONTAINERS.register("oil_generator_container", () -> IForgeContainerType.create(ContainerOilGenerator::fromNetwork));
|
||||
|
|
|
@ -22,11 +22,11 @@ import net.minecraft.network.PacketBuffer;
|
|||
|
||||
import java.util.Objects;
|
||||
|
||||
public class ContainerGrinder extends Container {
|
||||
public class CrusherContainer extends Container {
|
||||
public final TileEntityCrusher tileGrinder;
|
||||
public final boolean isDouble;
|
||||
|
||||
public ContainerGrinder(int windowId, PlayerInventory inventory, TileEntityCrusher tile) {
|
||||
public CrusherContainer(int windowId, PlayerInventory inventory, TileEntityCrusher tile) {
|
||||
super(ActuallyContainers.GRINDER_CONTAINER.get(), windowId);
|
||||
this.tileGrinder = tile;
|
||||
this.isDouble = tile.isDouble;
|
||||
|
@ -56,8 +56,8 @@ public class ContainerGrinder extends Container {
|
|||
}
|
||||
}
|
||||
|
||||
public static ContainerGrinder fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
|
||||
return new ContainerGrinder(windowId, inv, (TileEntityCrusher) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos())));
|
||||
public static CrusherContainer fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
|
||||
return new CrusherContainer(windowId, inv, (TileEntityCrusher) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos())));
|
||||
}
|
||||
|
||||
@Override
|
|
@ -8,6 +8,7 @@ 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.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
@ -30,31 +31,32 @@ public class Buttons {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int x, int y, float f) {
|
||||
public void render(MatrixStack matrixStack, 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);
|
||||
int k = this.getYImage(this.isHovered);
|
||||
GlStateManager._enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlStateManager.glBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlStateManager._blendFunc(770, 771);
|
||||
this.blit(matrices, this.x, this.y, this.smaller
|
||||
this.blit(matrixStack, this.x, this.y, this.smaller
|
||||
? 200
|
||||
: 176, k * this.height, this.width, this.height);
|
||||
this.mouseDragged(mc, x, y);
|
||||
//this.mouseDragged(mc, x, y); // The heck was this doing here?
|
||||
|
||||
int color = 14737632;
|
||||
if (this.packedFGColour != 0) {
|
||||
color = this.packedFGColour;
|
||||
} else if (!this.enabled) {
|
||||
if (this.packedFGColor != 0) {
|
||||
color = this.packedFGColor;
|
||||
} else if (!this.active) {
|
||||
color = 10526880;
|
||||
} else if (this.hovered) {
|
||||
} else if (this.isHovered) {
|
||||
color = 16777120;
|
||||
}
|
||||
|
||||
this.drawCenteredString(mc.fontRenderer, this.displayString, this.x + this.width / 2, this.y + (this.height - 8) / 2, color);
|
||||
drawCenteredString(matrixStack, Minecraft.getInstance().font, this.getMessage().getString(), this.x + this.width / 2, this.y + (this.height - 8) / 2, color);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,21 +66,21 @@ public class Buttons {
|
|||
public final ResourceLocation resLoc = AssetUtil.getGuiLocation("gui_inputter");
|
||||
|
||||
public TinyButton(int id, int x, int y) {
|
||||
super(id, x, y, 8, 8, "");
|
||||
super(x, y, 8, 8, new StringTextComponent(""), Button::onPress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int x, int y, float f) {
|
||||
public void render(MatrixStack matrixStack, int x, int y, float f) {
|
||||
if (this.visible) {
|
||||
mc.getTextureManager().bind(this.resLoc);
|
||||
Minecraft.getInstance().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);
|
||||
this.isHovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height;
|
||||
int k = this.getYImage(this.isHovered);
|
||||
GlStateManager._enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlStateManager.glBlendFuncSeparate(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);
|
||||
this.blit(matrixStack, this.x, this.y, 192, k * 8, 8, 8);
|
||||
//this.mouseDragged(mc, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,26 +12,22 @@ 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.ContainerGrinder;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.CrusherContainer;
|
||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCrusher;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
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.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
|
||||
public class CrusherScreen extends GuiWtfMojang<CrusherContainer> {
|
||||
|
||||
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_grinder");
|
||||
private static final ResourceLocation RES_LOC_DOUBLE = AssetUtil.getGuiLocation("gui_grinder_double");
|
||||
|
@ -41,7 +37,7 @@ public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
|
|||
|
||||
private Button buttonAutoSplit;
|
||||
|
||||
public GuiGrinder(ContainerGrinder container, PlayerInventory inventory, ITextComponent title) {
|
||||
public CrusherScreen(CrusherContainer container, PlayerInventory inventory, ITextComponent title) {
|
||||
super(container, inventory);
|
||||
this.tileGrinder = container.tileGrinder;
|
||||
this.isDouble = container.isDouble;
|
||||
|
@ -57,15 +53,14 @@ public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
|
|||
: 42), this.topPos + 5, this.tileGrinder.storage);
|
||||
|
||||
if (this.isDouble) {
|
||||
this.buttonAutoSplit = new GuiInputter.SmallerButton(0, this.leftPos - 10, this.topPos, "S");
|
||||
this.buttonAutoSplit = new Buttons.SmallerButton( this.leftPos - 10, this.topPos, new StringTextComponent("S"), (button) -> actionPerformed(0));
|
||||
this.addButton(this.buttonAutoSplit);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(Button button) throws IOException {
|
||||
if (this.isDouble && button.id == 0) {
|
||||
PacketHandlerHelper.sendButtonPacket(this.tileGrinder, button.id);
|
||||
protected void actionPerformed(int id) {
|
||||
if (this.isDouble && id == 0) {
|
||||
PacketHandlerHelper.sendButtonPacket(this.tileGrinder, id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,15 +76,13 @@ public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int x, int y, float f) {
|
||||
super.render(matrices, x, y, f);
|
||||
this.energy.render(matrices, x, y);
|
||||
public void render(MatrixStack matrixStack, int x, int y, float f) {
|
||||
super.render(matrixStack, x, y, f);
|
||||
this.energy.render(matrixStack, x, y);
|
||||
|
||||
if (this.isDouble && this.buttonAutoSplit.isMouseOver()) {
|
||||
if (this.isDouble && this.buttonAutoSplit.isMouseOver(x,y)) {
|
||||
|
||||
this.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.tileGrinder.isAutoSplit
|
||||
? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.on")
|
||||
: StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.off"))), x, y);
|
||||
drawString(matrixStack, font, new TranslationTextComponent("info.actuallyadditions.gui.autosplititems." + (tileGrinder.isAutoSplit?"on":"off")).withStyle(TextFormatting.BOLD), x , y, 0xffffff);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,10 +119,10 @@ public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
|
|||
this.energy.draw(matrices);
|
||||
}
|
||||
|
||||
public static class GuiGrinderDouble extends GuiGrinder {
|
||||
public static class CrusherDoubleScreen extends CrusherScreen {
|
||||
|
||||
public GuiGrinderDouble(ContainerGrinder containerGrinder, PlayerInventory inventory, ITextComponent tile) {
|
||||
super(containerGrinder, inventory, tile);
|
||||
public CrusherDoubleScreen(CrusherContainer crusherContainer, PlayerInventory inventory, ITextComponent tile) {
|
||||
super(crusherContainer, inventory, tile);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,6 +18,7 @@ import net.minecraft.client.gui.AbstractGui;
|
|||
import net.minecraft.client.gui.widget.button.Button;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
@ -38,19 +39,19 @@ public class FilterSettingsGui extends AbstractGui {
|
|||
public FilterSettingsGui(FilterSettings settings, int x, int y, List<Button> buttonList) {
|
||||
this.theSettings = settings;
|
||||
|
||||
this.whitelistButton = new Buttons.SmallerButton(this.theSettings.whitelistButtonId, x, y, true);
|
||||
this.whitelistButton = new Buttons.SmallerButton( x, y, new TranslationTextComponent(""), true, Button::onPress); //TODO these need translation keys
|
||||
buttonList.add(this.whitelistButton);
|
||||
y += 14;
|
||||
this.metaButton = new Buttons.SmallerButton(this.theSettings.metaButtonId, x, y, true);
|
||||
this.metaButton = new Buttons.SmallerButton( x, y, new TranslationTextComponent(""), true, Button::onPress); //TODO also button actions
|
||||
buttonList.add(this.metaButton);
|
||||
y += 14;
|
||||
this.nbtButton = new Buttons.SmallerButton(this.theSettings.nbtButtonId, x, y, true);
|
||||
this.nbtButton = new Buttons.SmallerButton( x, y, new TranslationTextComponent(""), true, Button::onPress);
|
||||
buttonList.add(this.nbtButton);
|
||||
y += 14;
|
||||
this.oredictButton = new Buttons.SmallerButton(this.theSettings.oredictButtonId, x, y, true);
|
||||
this.oredictButton = new Buttons.SmallerButton( x, y, new TranslationTextComponent(""), true, Button::onPress);
|
||||
buttonList.add(this.oredictButton);
|
||||
y += 15;
|
||||
this.modButton = new Buttons.SmallerButton(this.theSettings.modButtonId, x, y, true);
|
||||
this.modButton = new Buttons.SmallerButton( x, y, new TranslationTextComponent(""), true, Button::onPress);
|
||||
buttonList.add(this.modButton);
|
||||
|
||||
this.tick();
|
||||
|
@ -103,7 +104,7 @@ public class FilterSettingsGui extends AbstractGui {
|
|||
//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);
|
||||
} else if (this.oredictButton.isMouseOver()) {
|
||||
} else if (this.oredictButton.isMouseOver(mouseX, mouseY)) {
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add(TextFormatting.BOLD + (this.theSettings.respectOredict == 0
|
||||
? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreOredict")
|
||||
|
|
|
@ -11,9 +11,6 @@
|
|||
package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
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.fluid.Fluid;
|
||||
|
@ -21,16 +18,11 @@ import net.minecraft.util.ResourceLocation;
|
|||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.Collections;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class FluidDisplay extends AbstractGui {
|
||||
|
||||
private FluidTank fluidReference;
|
||||
private FluidStack fluidReference;
|
||||
private Fluid oldFluid;
|
||||
|
||||
private int x;
|
||||
|
@ -41,15 +33,15 @@ public class FluidDisplay extends AbstractGui {
|
|||
|
||||
private boolean drawTextNextTo;
|
||||
|
||||
public FluidDisplay(int x, int y, FluidTank fluidReference, boolean outline, boolean drawTextNextTo) {
|
||||
public FluidDisplay(int x, int y, FluidStack fluidReference, boolean outline, boolean drawTextNextTo) {
|
||||
this.setData(x, y, fluidReference, outline, drawTextNextTo);
|
||||
}
|
||||
|
||||
public FluidDisplay(int x, int y, FluidTank fluidReference) {
|
||||
public FluidDisplay(int x, int y, FluidStack fluidReference) {
|
||||
this(x, y, fluidReference, false, false);
|
||||
}
|
||||
|
||||
public void setData(int x, int y, FluidTank fluidReference, boolean outline, boolean drawTextNextTo) {
|
||||
public void setData(int x, int y, FluidStack fluidReference, boolean outline, boolean drawTextNextTo) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.fluidReference = fluidReference;
|
||||
|
@ -58,7 +50,7 @@ public class FluidDisplay extends AbstractGui {
|
|||
}
|
||||
|
||||
public void draw(MatrixStack matrices) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
/* Minecraft mc = Minecraft.getInstance();
|
||||
mc.getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION);
|
||||
|
||||
int barX = this.x;
|
||||
|
@ -101,7 +93,7 @@ public class FluidDisplay extends AbstractGui {
|
|||
|
||||
if (this.drawTextNextTo) {
|
||||
this.drawString(mc.font, this.getOverlayText(), barX + 25, barY + 78, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY) {
|
||||
|
@ -111,16 +103,17 @@ public class FluidDisplay extends AbstractGui {
|
|||
? 93
|
||||
: 85)) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
GuiUtils.drawHoveringText(Collections.singletonList(this.getOverlayText()), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font);
|
||||
//GuiUtils.drawHoveringText(Collections.singletonList(this.getOverlayText()), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font);
|
||||
}
|
||||
}
|
||||
|
||||
private String getOverlayText() {
|
||||
NumberFormat format = NumberFormat.getInstance();
|
||||
/* NumberFormat format = NumberFormat.getInstance();
|
||||
FluidStack stack = this.fluidReference.getFluid();
|
||||
String cap = format.format(this.fluidReference.getCapacity());
|
||||
return stack == null || stack.getFluid() == null
|
||||
? "0/" + cap + " mB"
|
||||
: format.format(this.fluidReference.getFluidAmount()) + "/" + cap + " mB " + stack.getLocalizedName();
|
||||
: format.format(this.fluidReference.getFluidAmount()) + "/" + cap + " mB " + stack.getLocalizedName();*/
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,23 +12,12 @@ 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;
|
||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
||||
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.button.Button;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiBag extends GuiWtfMojang<ContainerBag> {
|
||||
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_bag");
|
||||
|
@ -51,22 +40,22 @@ 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.buttons);
|
||||
|
||||
this.buttonAutoInsert = new Button(0, this.leftPos - 21, this.topPos + 8, 20, 20, (this.container.autoInsert
|
||||
? TextFormatting.DARK_GREEN
|
||||
: TextFormatting.RED) + "I");
|
||||
// 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
|
||||
// : TextFormatting.RED) + "I");
|
||||
this.addButton(this.buttonAutoInsert);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(Button button) throws IOException {
|
||||
CompoundNBT data = new CompoundNBT();
|
||||
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
|
||||
// protected void actionPerformed(Button button) throws IOException {
|
||||
// CompoundNBT data = new CompoundNBT();
|
||||
// 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 tick() {
|
||||
|
@ -78,19 +67,19 @@ public class GuiBag extends GuiWtfMojang<ContainerBag> {
|
|||
// : TextFormatting.RED) + "I";
|
||||
}
|
||||
|
||||
@Override
|
||||
/* @Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y) {
|
||||
AssetUtil.displayNameString(this.font, this.imageWidth, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + "." + (this.isVoid
|
||||
? "voidBag"
|
||||
: "bag") + ".name"));
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(stack, mouseX, mouseY, partialTicks);
|
||||
this.filter.drawHover(mouseX, mouseY);
|
||||
|
||||
if (this.buttonAutoInsert.isMouseOver()) {
|
||||
/* if (this.buttonAutoInsert.isMouseOver()) {
|
||||
List<String> text = new ArrayList<>();
|
||||
text.add(TextFormatting.BOLD + "Auto-Insert " + (this.container.autoInsert
|
||||
? "On"
|
||||
|
@ -98,7 +87,7 @@ public class GuiBag extends GuiWtfMojang<ContainerBag> {
|
|||
text.addAll(this.font.listFormattedStringToWidth("Turn this on to make items that get picked up automatically go into the bag.", 200));
|
||||
text.addAll(this.font.listFormattedStringToWidth(TextFormatting.GRAY + "" + TextFormatting.ITALIC + "Note that this WON'T work when you are holding the bag in your hand.", 200));
|
||||
this.renderToolTip(stack, text, mouseX, mouseY, this.getMinecraft().font);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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.inventory.ContainerBioReactor;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBioReactor;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
|
@ -41,7 +42,7 @@ public class GuiBioReactor extends GuiWtfMojang<ContainerBioReactor> {
|
|||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(matrices, mouseX, mouseY, partialTicks);
|
||||
this.energy.render(mouseX, mouseY);
|
||||
//this.energy.render(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -68,6 +69,6 @@ public class GuiBioReactor extends GuiWtfMojang<ContainerBioReactor> {
|
|||
drawCenteredString(matrices, this.font, this.tile.producePerTick + " " + I18n.get("actuallyadditions.cft"), this.leftPos + 87, this.topPos + 86, 0xFFFFFF);
|
||||
}
|
||||
|
||||
this.energy.draw();
|
||||
//this.energy.draw();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.inventory.ContainerCanolaPress;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
|
@ -38,8 +39,8 @@ public class GuiCanolaPress extends GuiWtfMojang<ContainerCanolaPress> {
|
|||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
this.energy = new EnergyDisplay(this.leftPos + 42, this.topPos + 5, this.press.storage);
|
||||
this.fluid = new FluidDisplay(this.leftPos + 116, this.topPos + 5, this.press.tank);
|
||||
//this.energy = new EnergyDisplay(this.leftPos + 42, this.topPos + 5, this.press.storage);
|
||||
//this.fluid = new FluidDisplay(this.leftPos + 116, this.topPos + 5, this.press.tank);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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.inventory.ContainerCoalGenerator;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
|
|
|
@ -14,19 +14,15 @@ import com.mojang.blaze3d.matrix.MatrixStack;
|
|||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCoffeeMachine;
|
||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
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 java.util.Collections;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class GuiCoffeeMachine extends GuiWtfMojang<ContainerCoffeeMachine> {
|
||||
|
||||
|
@ -47,11 +43,11 @@ public class GuiCoffeeMachine extends GuiWtfMojang<ContainerCoffeeMachine> {
|
|||
public void init() {
|
||||
super.init();
|
||||
|
||||
Button buttonOkay = new Button(this.leftPos + 60, this.topPos + 11, 58, 20, StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ok"));
|
||||
this.addButton(buttonOkay);
|
||||
|
||||
this.energy = new EnergyDisplay(this.leftPos + 16, this.topPos + 5, this.machine.storage);
|
||||
this.fluid = new FluidDisplay(this.leftPos - 30, this.topPos + 1, this.machine.tank, true, false);
|
||||
// Button buttonOkay = new Button(this.leftPos + 60, this.topPos + 11, 58, 20, StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ok"));
|
||||
// this.addButton(buttonOkay);
|
||||
//
|
||||
// this.energy = new EnergyDisplay(this.leftPos + 16, this.topPos + 5, this.machine.storage);
|
||||
// this.fluid = new FluidDisplay(this.leftPos - 30, this.topPos + 1, this.machine.tank, true, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -60,7 +56,7 @@ public class GuiCoffeeMachine extends GuiWtfMojang<ContainerCoffeeMachine> {
|
|||
|
||||
String text2 = this.machine.coffeeCacheAmount + "/" + TileEntityCoffeeMachine.COFFEE_CACHE_MAX_AMOUNT + " " + StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.coffee");
|
||||
if (x >= this.leftPos + 40 && y >= this.topPos + 25 && x <= this.leftPos + 49 && y <= this.topPos + 56) {
|
||||
this.drawHoveringText(Collections.singletonList(text2), x, y);
|
||||
//this.drawHoveringText(Collections.singletonList(text2), x, y);
|
||||
}
|
||||
|
||||
this.energy.render(matrices, x, y);
|
||||
|
@ -99,8 +95,8 @@ public class GuiCoffeeMachine extends GuiWtfMojang<ContainerCoffeeMachine> {
|
|||
this.fluid.draw(matrices);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(Button button) {
|
||||
PacketHandlerHelper.sendButtonPacket(this.machine, button.id);
|
||||
}
|
||||
// @Override
|
||||
// public void actionPerformed(Button button) {
|
||||
// PacketHandlerHelper.sendButtonPacket(this.machine, button.id);
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -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.inventory.ContainerDirectionalBreaker;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLongRangeBreaker;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
|
|
|
@ -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.ContainerDrill;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
|
|
|
@ -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.inventory.ContainerDropper;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
|
|
|
@ -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.inventory.ContainerEnergizer;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
|
|
|
@ -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.inventory.ContainerEnervator;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
|
|
|
@ -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.inventory.ContainerFarmer;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
|
|
|
@ -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.ContainerFeeder;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder;
|
||||
|
@ -22,8 +23,6 @@ import net.minecraft.util.text.ITextComponent;
|
|||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class GuiFeeder extends GuiWtfMojang<ContainerFeeder> {
|
||||
|
||||
|
@ -46,7 +45,7 @@ public class GuiFeeder extends GuiWtfMojang<ContainerFeeder> {
|
|||
: this.tileFeeder.currentAnimalAmount >= TileEntityFeeder.THRESHOLD
|
||||
? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.tooMany")
|
||||
: StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.notEnough")};
|
||||
this.drawHoveringText(Arrays.asList(array), x, y);
|
||||
//this.drawHoveringText(Arrays.asList(array), x, y);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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.inventory.ContainerFermentingBarrel;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
|
@ -46,8 +47,8 @@ public class GuiFermentingBarrel extends GuiWtfMojang<ContainerFermentingBarrel>
|
|||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
this.input = new FluidDisplay(this.leftPos + 60, this.topPos + 5, this.press.canolaTank);
|
||||
this.output = new FluidDisplay(this.leftPos + 98, this.topPos + 5, this.press.oilTank);
|
||||
this.input = new FluidDisplay(this.leftPos + 60, this.topPos + 5, this.press.tanks.canolaTank);
|
||||
this.output = new FluidDisplay(this.leftPos + 98, this.topPos + 5, this.press.tanks.oilTank);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -46,7 +46,7 @@ public class GuiFluidCollector extends GuiWtfMojang<ContainerFluidCollector> {
|
|||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
this.fluid = new FluidDisplay(this.leftPos + 67, this.topPos + 5, this.collector.tank);
|
||||
//this.fluid = new FluidDisplay(this.leftPos + 67, this.topPos + 5, this.collector.tank);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,12 +12,9 @@ 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.ContainerFurnaceDouble;
|
||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPoweredFurnace;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.client.gui.widget.button.Button;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
@ -27,9 +24,6 @@ import net.minecraft.util.text.TextFormatting;
|
|||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class GuiFurnaceDouble extends GuiWtfMojang<ContainerFurnaceDouble> {
|
||||
|
||||
|
@ -51,11 +45,11 @@ public class GuiFurnaceDouble extends GuiWtfMojang<ContainerFurnaceDouble> {
|
|||
super.render(matrices, x, y, f);
|
||||
this.energy.render(matrices, x, y);
|
||||
|
||||
if (this.buttonAutoSplit.isMouseOver(x, y)) {
|
||||
this.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.tileFurnace.isAutoSplit
|
||||
? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.on")
|
||||
: StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.off"))), x, y);
|
||||
}
|
||||
// if (this.buttonAutoSplit.isMouseOver(x, y)) {
|
||||
// this.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.tileFurnace.isAutoSplit
|
||||
// ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.on")
|
||||
// : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.off"))), x, y);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -63,8 +57,8 @@ public class GuiFurnaceDouble extends GuiWtfMojang<ContainerFurnaceDouble> {
|
|||
super.init();
|
||||
this.energy = new EnergyDisplay(this.leftPos + 27, this.topPos + 5, this.tileFurnace.storage);
|
||||
|
||||
this.buttonAutoSplit = new GuiInputter.SmallerButton(0, this.leftPos, this.topPos, "S");
|
||||
this.addButton(this.buttonAutoSplit);
|
||||
// this.buttonAutoSplit = new GuiInputter.SmallerButton(0, this.leftPos, this.topPos, "S");
|
||||
// this.addButton(this.buttonAutoSplit);
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,12 +71,12 @@ public class GuiFurnaceDouble extends GuiWtfMojang<ContainerFurnaceDouble> {
|
|||
: TextFormatting.RED));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(Button button) throws IOException {
|
||||
if (button.id == 0) {
|
||||
PacketHandlerHelper.sendButtonPacket(this.tileFurnace, button.id);
|
||||
}
|
||||
}
|
||||
// @Override
|
||||
// protected void actionPerformed(Button button) throws IOException {
|
||||
// if (button.id == 0) {
|
||||
// PacketHandlerHelper.sendButtonPacket(this.tileFurnace, button.id);
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void renderLabels(MatrixStack matrices, int x, int 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.network.PacketHandlerHelper;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemAdvanced;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
|
@ -22,13 +21,9 @@ 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.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class GuiLaserRelayItemWhitelist extends GuiWtfMojang<ContainerLaserRelayItemWhitelist> {
|
||||
|
||||
|
@ -60,30 +55,30 @@ public class GuiLaserRelayItemWhitelist extends GuiWtfMojang<ContainerLaserRelay
|
|||
public void init() {
|
||||
super.init();
|
||||
|
||||
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 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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(Button button) {
|
||||
PacketHandlerHelper.sendButtonPacket(this.tile, button.id);
|
||||
// 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 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);
|
||||
}
|
||||
//
|
||||
// @Override
|
||||
// public void actionPerformed(Button button) {
|
||||
// PacketHandlerHelper.sendButtonPacket(this.tile, button.id);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int x, int y, float f) {
|
||||
super.render(matrices, x, y, f);
|
||||
|
||||
if (this.buttonSmartWhitelistLeft.isMouseOver() || this.buttonSmartWhitelistRight.isMouseOver()) {
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add(TextFormatting.BOLD + StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.smart"));
|
||||
list.addAll(this.font.listFormattedStringToWidth(StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.smartInfo"), 200));
|
||||
this.drawHoveringText(list, x, y);
|
||||
}
|
||||
//
|
||||
// if (this.buttonSmartWhitelistLeft.isMouseOver() || this.buttonSmartWhitelistRight.isMouseOver()) {
|
||||
// List<String> list = new ArrayList<>();
|
||||
// list.add(TextFormatting.BOLD + StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.smart"));
|
||||
// list.addAll(this.font.listFormattedStringToWidth(StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.smartInfo"), 200));
|
||||
// this.drawHoveringText(list, x, y);
|
||||
// }
|
||||
|
||||
this.leftFilter.drawHover(x, y);
|
||||
this.rightFilter.drawHover(x, y);
|
||||
|
|
|
@ -13,11 +13,9 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
|||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerMiner;
|
||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityVerticalDigger;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
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;
|
||||
|
@ -42,13 +40,13 @@ public class GuiMiner extends GuiWtfMojang<ContainerMiner> {
|
|||
public void init() {
|
||||
super.init();
|
||||
|
||||
Button buttonMode = new Button(this.leftPos + this.imageWidth / 2 - 51, this.topPos + 75, 50, 20, "Mode", button -> {
|
||||
});
|
||||
this.addButton(buttonMode);
|
||||
|
||||
Button buttonReset = new Button(this.leftPos + this.imageWidth / 2 + 1, this.topPos + 75, 50, 20, "Reset", button -> {
|
||||
});
|
||||
this.addButton(buttonReset);
|
||||
// Button buttonMode = new Button(this.leftPos + this.imageWidth / 2 - 51, this.topPos + 75, 50, 20, "Mode", button -> {
|
||||
// });
|
||||
// this.addButton(buttonMode);
|
||||
//
|
||||
// Button buttonReset = new Button(this.leftPos + this.imageWidth / 2 + 1, this.topPos + 75, 50, 20, "Reset", button -> {
|
||||
// });
|
||||
// this.addButton(buttonReset);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -72,8 +70,8 @@ public class GuiMiner extends GuiWtfMojang<ContainerMiner> {
|
|||
this.font.draw(matrices, mining, this.leftPos + this.imageWidth / 2 - this.font.width(mining) / 2, this.topPos + 8, StringUtil.DECIMAL_COLOR_GRAY_TEXT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(Button button) {
|
||||
PacketHandlerHelper.sendButtonPacket(this.miner, button.id);
|
||||
}
|
||||
// @Override
|
||||
// public void actionPerformed(Button button) {
|
||||
// PacketHandlerHelper.sendButtonPacket(this.miner, button.id);
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -43,8 +43,8 @@ public class GuiOilGenerator extends GuiWtfMojang<ContainerOilGenerator> {
|
|||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
this.energy = new EnergyDisplay(this.leftPos + 42, this.topPos + 5, this.generator.storage);
|
||||
this.fluid = new FluidDisplay(this.leftPos + 116, this.topPos + 5, this.generator.tank);
|
||||
//this.energy = new EnergyDisplay(this.leftPos + 42, this.topPos + 5, this.generator.storage);
|
||||
//this.fluid = new FluidDisplay(this.leftPos + 116, this.topPos + 5, this.generator.tank);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,24 +12,15 @@ 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.ContainerPhantomPlacer;
|
||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomPlacer;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
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.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class GuiPhantomPlacer extends GuiWtfMojang<ContainerPhantomPlacer> {
|
||||
|
||||
|
@ -47,44 +38,44 @@ public class GuiPhantomPlacer extends GuiWtfMojang<ContainerPhantomPlacer> {
|
|||
public void init() {
|
||||
super.init();
|
||||
|
||||
if (!this.placer.isBreaker) {
|
||||
this.addButton(new Button(0, this.leftPos + 63, this.topPos + 75, 50, 20, this.getSide()));
|
||||
}
|
||||
// if (!this.placer.isBreaker) {
|
||||
// this.addButton(new Button(0, this.leftPos + 63, this.topPos + 75, 50, 20, this.getSide()));
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
if (!this.placer.isBreaker) {
|
||||
this.buttonList.get(0).displayString = this.getSide();
|
||||
}
|
||||
// if (!this.placer.isBreaker) {
|
||||
// this.buttonList.get(0).displayString = this.getSide();
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(matrices, mouseX, mouseY, partialTicks);
|
||||
|
||||
if (!this.placer.isBreaker && this.buttonList.get(0).isMouseOver()) {
|
||||
String loc = "info." + ActuallyAdditions.MODID + ".placer.sides";
|
||||
|
||||
List<String> textList = new ArrayList<>();
|
||||
textList.add(TextFormatting.GOLD + StringUtil.localize(loc + ".1"));
|
||||
textList.addAll(this.font.listFormattedStringToWidth(StringUtil.localize(loc + ".2"), 200));
|
||||
this.drawHoveringText(textList, mouseX, mouseY);
|
||||
}
|
||||
// if (!this.placer.isBreaker && this.buttonList.get(0).isMouseOver()) {
|
||||
// String loc = "info." + ActuallyAdditions.MODID + ".placer.sides";
|
||||
//
|
||||
// List<String> textList = new ArrayList<>();
|
||||
// textList.add(TextFormatting.GOLD + StringUtil.localize(loc + ".1"));
|
||||
// textList.addAll(this.font.listFormattedStringToWidth(StringUtil.localize(loc + ".2"), 200));
|
||||
// this.drawHoveringText(textList, mouseX, mouseY);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(Button button) throws IOException {
|
||||
if (!this.placer.isBreaker) {
|
||||
PacketHandlerHelper.sendButtonPacket(this.placer, button.id);
|
||||
}
|
||||
}
|
||||
// @Override
|
||||
// protected void actionPerformed(Button button) throws IOException {
|
||||
// if (!this.placer.isBreaker) {
|
||||
// PacketHandlerHelper.sendButtonPacket(this.placer, button.id);
|
||||
// }
|
||||
// }
|
||||
|
||||
private String getSide() {
|
||||
return GuiInputter.SIDES[this.placer.side + 1];
|
||||
}
|
||||
// private String getSide() {
|
||||
// return GuiInputter.SIDES[this.placer.side + 1];
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void renderLabels(MatrixStack matrices, int x, int y) {
|
||||
|
|
|
@ -13,10 +13,8 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
|||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerRangedCollector;
|
||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
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;
|
||||
|
@ -43,14 +41,14 @@ public class GuiRangedCollector extends GuiWtfMojang<ContainerRangedCollector> {
|
|||
public void init() {
|
||||
super.init();
|
||||
|
||||
this.filter = new FilterSettingsGui(this.collector.filter, this.leftPos + 3, this.topPos + 6, this.buttonList);
|
||||
//this.filter = new FilterSettingsGui(this.collector.filter, this.leftPos + 3, this.topPos + 6, this.buttonList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int x, int y, float f) {
|
||||
super.render(matrices, x, y, f);
|
||||
|
||||
this.filter.drawHover(matrices, x, y);
|
||||
//this.filter.drawHover(matrices, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,8 +74,8 @@ public class GuiRangedCollector extends GuiWtfMojang<ContainerRangedCollector> {
|
|||
this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 86);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(Button button) {
|
||||
PacketHandlerHelper.sendButtonPacket(this.collector, button.id);
|
||||
}
|
||||
// @Override
|
||||
// public void actionPerformed(Button button) {
|
||||
// PacketHandlerHelper.sendButtonPacket(this.collector, button.id);
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -13,16 +13,12 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
|||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerXPSolidifier;
|
||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier;
|
||||
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.button.Button;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
@ -43,35 +39,35 @@ public class GuiXPSolidifier extends GuiWtfMojang<ContainerXPSolidifier> {
|
|||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
|
||||
Button buttonOne = new GuiInputter.SmallerButton(this.leftPos + 62, this.topPos + 44, new StringTextComponent("1"), btn -> {
|
||||
});
|
||||
Button buttonFive = new GuiInputter.SmallerButton(this.leftPos + 80, this.topPos + 44, new StringTextComponent("5"), btn -> {
|
||||
});
|
||||
Button buttonTen = new GuiInputter.SmallerButton(this.leftPos + 99, this.topPos + 44, new StringTextComponent("10"), btn -> {
|
||||
});
|
||||
Button buttonTwenty = new GuiInputter.SmallerButton(this.leftPos + 62, this.topPos + 61, new StringTextComponent("20"), btn -> {
|
||||
});
|
||||
Button buttonThirty = new GuiInputter.SmallerButton(this.leftPos + 80, this.topPos + 61, new StringTextComponent("30"), btn -> {
|
||||
});
|
||||
Button buttonForty = new GuiInputter.SmallerButton(this.leftPos + 99, this.topPos + 61, new StringTextComponent("40"), btn -> {
|
||||
});
|
||||
Button buttonFifty = new GuiInputter.SmallerButton(this.leftPos + 62, this.topPos + 78, new StringTextComponent("50"), btn -> {
|
||||
});
|
||||
Button buttonSixtyFour = new GuiInputter.SmallerButton(this.leftPos + 80, this.topPos + 78, new StringTextComponent("64"), btn -> {
|
||||
});
|
||||
Button buttonAll = new GuiInputter.SmallerButton(this.leftPos + 99, this.topPos + 78, new StringTextComponent("All"), btn -> {
|
||||
});
|
||||
|
||||
this.addButton(buttonOne);
|
||||
this.addButton(buttonFive);
|
||||
this.addButton(buttonTen);
|
||||
this.addButton(buttonTwenty);
|
||||
this.addButton(buttonThirty);
|
||||
this.addButton(buttonForty);
|
||||
this.addButton(buttonFifty);
|
||||
this.addButton(buttonSixtyFour);
|
||||
this.addButton(buttonAll);
|
||||
//
|
||||
// Button buttonOne = new GuiInputter.SmallerButton(this.leftPos + 62, this.topPos + 44, new StringTextComponent("1"), btn -> {
|
||||
// });
|
||||
// Button buttonFive = new GuiInputter.SmallerButton(this.leftPos + 80, this.topPos + 44, new StringTextComponent("5"), btn -> {
|
||||
// });
|
||||
// Button buttonTen = new GuiInputter.SmallerButton(this.leftPos + 99, this.topPos + 44, new StringTextComponent("10"), btn -> {
|
||||
// });
|
||||
// Button buttonTwenty = new GuiInputter.SmallerButton(this.leftPos + 62, this.topPos + 61, new StringTextComponent("20"), btn -> {
|
||||
// });
|
||||
// Button buttonThirty = new GuiInputter.SmallerButton(this.leftPos + 80, this.topPos + 61, new StringTextComponent("30"), btn -> {
|
||||
// });
|
||||
// Button buttonForty = new GuiInputter.SmallerButton(this.leftPos + 99, this.topPos + 61, new StringTextComponent("40"), btn -> {
|
||||
// });
|
||||
// Button buttonFifty = new GuiInputter.SmallerButton(this.leftPos + 62, this.topPos + 78, new StringTextComponent("50"), btn -> {
|
||||
// });
|
||||
// Button buttonSixtyFour = new GuiInputter.SmallerButton(this.leftPos + 80, this.topPos + 78, new StringTextComponent("64"), btn -> {
|
||||
// });
|
||||
// Button buttonAll = new GuiInputter.SmallerButton(this.leftPos + 99, this.topPos + 78, new StringTextComponent("All"), btn -> {
|
||||
// });
|
||||
//
|
||||
// this.addButton(buttonOne);
|
||||
// this.addButton(buttonFive);
|
||||
// this.addButton(buttonTen);
|
||||
// this.addButton(buttonTwenty);
|
||||
// this.addButton(buttonThirty);
|
||||
// this.addButton(buttonForty);
|
||||
// this.addButton(buttonFifty);
|
||||
// this.addButton(buttonSixtyFour);
|
||||
// this.addButton(buttonAll);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -92,10 +88,10 @@ public class GuiXPSolidifier extends GuiWtfMojang<ContainerXPSolidifier> {
|
|||
drawCenteredString(matrices, this.font, Integer.toString(this.solidifier.amount), this.leftPos + 88, this.topPos + 30, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(Button button) {
|
||||
PacketHandlerHelper.sendButtonPacket(this.solidifier, button.id);
|
||||
|
||||
this.solidifier.onButtonPressed(button.id, Minecraft.getInstance().player);
|
||||
}
|
||||
// @Override
|
||||
// public void actionPerformed(Button button) {
|
||||
// PacketHandlerHelper.sendButtonPacket(this.solidifier, button.id);
|
||||
//
|
||||
// this.solidifier.onButtonPressed(button.id, Minecraft.getInstance().player);
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -12,17 +12,17 @@ package de.ellpeck.actuallyadditions.mod.items;
|
|||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.*;
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemArmorAA;
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemHoeAA;
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemSwordAA;
|
||||
import de.ellpeck.actuallyadditions.mod.items.lens.ItemLens;
|
||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
|
||||
import de.ellpeck.actuallyadditions.mod.material.ArmorMaterials;
|
||||
import de.ellpeck.actuallyadditions.mod.material.ToolMaterials;
|
||||
import net.minecraft.inventory.EquipmentSlotType;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTier;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
@ -144,7 +144,7 @@ public final class ActuallyItems {
|
|||
public static final RegistryObject<Item> COFFEE = ITEMS.register("coffee", ItemCoffee::new);
|
||||
public static final RegistryObject<Item> PHANTOM_CONNECTOR = ITEMS.register("phantom_connector", ItemPhantomConnector::new);
|
||||
public static final RegistryObject<Item> RESONANT_RICE = ITEMS.register("resonant_rice", ItemResonantRice::new);
|
||||
public static final RegistryObject<Item> FOOD = ITEMS.register("food", ItemFoods::new); //just... food?
|
||||
public static final RegistryObject<Item> FOOD = ITEMS.register("food", ItemBase::new); //just... food? //TODO
|
||||
public static final RegistryObject<Item> JAM = ITEMS.register("jam", ItemJams::new);
|
||||
public static final RegistryObject<Item> KNIFE = ITEMS.register("knife", ItemKnife::new);
|
||||
public static final RegistryObject<Item> CRAFTER_ON_A_STICK = ITEMS.register("crafter_on_a_stick", ItemCrafterOnAStick::new);
|
||||
|
@ -160,10 +160,10 @@ public final class ActuallyItems {
|
|||
public static final RegistryObject<Item> HAIRY_BALL = ITEMS.register("hairy_ball", ItemHairBall::new);
|
||||
public static final RegistryObject<Item> COFFEE_BEANS = ITEMS.register("coffee_beans", ItemCoffeeBean::new);
|
||||
|
||||
public static final RegistryObject<Item> RICE_SEED = ITEMS.register("rice_seed", () -> new ItemSeed("seedRice", ActuallyBlocks.RICE.get(), FOOD.get(), TheFoods.RICE.ordinal()));
|
||||
public static final RegistryObject<Item> CANOLA_SEED = ITEMS.register("canola_seed", () -> new ItemFoodSeed("seedCanola", ActuallyBlocks.CANOLA, itemMisc, 0, 1, 0.01F, 10).setPotionEffect(new PotionEffect(MobEffects.NAUSEA, 1000, 0), 0.2F));
|
||||
public static final RegistryObject<Item> FLAX_SEED = ITEMS.register("flax_seed", () -> new ItemSeed("seedFlax", ActuallyBlocks.FLAX, Items.STRING, 0));
|
||||
public static final RegistryObject<Item> COFFEE_SEED = ITEMS.register("coffee_seed", () -> new ItemSeed("seedCoffeeBeans", ActuallyBlocks.COFFEE, COFFEE_BEANS, 0));
|
||||
public static final RegistryObject<Item> RICE_SEED = ITEMS.register("rice_seed", ItemBase::new); //() -> new ItemSeed("seedRice", ActuallyBlocks.RICE.get(), FOOD.get(), TheFoods.RICE.ordinal()));
|
||||
public static final RegistryObject<Item> CANOLA_SEED = ITEMS.register("canola_seed", ItemBase::new); //() -> new ItemFoodSeed("seedCanola", ActuallyBlocks.CANOLA, itemMisc, 0, 1, 0.01F, 10).setPotionEffect(new PotionEffect(MobEffects.NAUSEA, 1000, 0), 0.2F));
|
||||
public static final RegistryObject<Item> FLAX_SEED = ITEMS.register("flax_seed", ItemBase::new); //() -> new ItemSeed("seedFlax", ActuallyBlocks.FLAX, Items.STRING, 0));
|
||||
public static final RegistryObject<Item> COFFEE_SEED = ITEMS.register("coffee_seed", ItemBase::new); //() -> new ItemSeed("seedCoffeeBeans", ActuallyBlocks.COFFEE, COFFEE_BEANS, 0));
|
||||
|
||||
// TOOLS & ARMOR
|
||||
public static final RegistryObject<Item> HELM_QUARTZ = ITEMS.register("helm_quartz", () -> new ItemArmorAA(ArmorMaterials.QUARTZ, EquipmentSlotType.HEAD));
|
||||
|
@ -173,7 +173,7 @@ public final class ActuallyItems {
|
|||
|
||||
public static final RegistryObject<Item> PICKAXE_QUARTZ = ITEMS.register("pickaxe_quartz", () -> new ItemPickaxeAA(ToolMaterials.BLACK_QUARTZ));
|
||||
public static final RegistryObject<Item> AXE_QUARTZ = ITEMS.register("axe_quartz", () -> new ItemAxeAA(ToolMaterials.BLACK_QUARTZ));
|
||||
public static final RegistryObject<Item> SHOVEL_QUARTZ = ITEMS.register("shovel_quartz", () -> new ItemShovelAA(ToolMaterials.BLACK_QUARTZ));
|
||||
public static final RegistryObject<Item> SHOVEL_QUARTZ = ITEMS.register("shovel_quartz", ItemBase::new); //() -> 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 AllInOneTool(ItemTier.WOOD));
|
||||
|
@ -186,7 +186,7 @@ public final class ActuallyItems {
|
|||
|
||||
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));
|
||||
public static final RegistryObject<Item> SHOVEL_CRYSTAL_RESTONIA = ITEMS.register("shovel_crystal_restonia", () -> new ItemShovelAA(ToolMaterials.RESTONIA));
|
||||
public static final RegistryObject<Item> SHOVEL_CRYSTAL_RESTONIA = ITEMS.register("shovel_crystal_restonia", ItemBase::new); // () -> new ItemShovelAA(ToolMaterials.RESTONIA));
|
||||
public static final RegistryObject<Item> SWORD_CRYSTAL_RESTONIA = ITEMS.register("sword_crystal_restonia", () -> new ItemSwordAA(ToolMaterials.RESTONIA));
|
||||
public static final RegistryObject<Item> HOE_CRYSTAL_RESTONIA = ITEMS.register("hoe_crystal_restonia", () -> new ItemHoeAA(ToolMaterials.RESTONIA));
|
||||
public static final RegistryObject<Item> HELM_CRYSTAL_RESTONIA = ITEMS.register("helm_crystal_restonia", () -> new ItemArmorAA(ArmorMaterials.RESTONIA, EquipmentSlotType.HEAD));
|
||||
|
@ -197,7 +197,7 @@ public final class ActuallyItems {
|
|||
|
||||
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));
|
||||
public static final RegistryObject<Item> SHOVEL_CRYSTAL_PALIS = ITEMS.register("shovel_crystal_palis", () -> new ItemShovelAA(ToolMaterials.PALIS));
|
||||
public static final RegistryObject<Item> SHOVEL_CRYSTAL_PALIS = ITEMS.register("shovel_crystal_palis", ItemBase::new); //() -> new ItemShovelAA(ToolMaterials.PALIS));
|
||||
public static final RegistryObject<Item> SWORD_CRYSTAL_PALIS = ITEMS.register("sword_crystal_palis", () -> new ItemSwordAA(ToolMaterials.PALIS));
|
||||
public static final RegistryObject<Item> HOE_CRYSTAL_PALIS = ITEMS.register("hoe_crystal_palis", () -> new ItemHoeAA(ToolMaterials.PALIS));
|
||||
public static final RegistryObject<Item> HELM_CRYSTAL_PALIS = ITEMS.register("helm_crystal_palis", () -> new ItemArmorAA(ArmorMaterials.PALIS, EquipmentSlotType.HEAD));
|
||||
|
@ -208,7 +208,7 @@ public final class ActuallyItems {
|
|||
|
||||
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));
|
||||
public static final RegistryObject<Item> SHOVEL_CRYSTAL_DIAMATINE = ITEMS.register("shovel_crystal_diamatine", () -> new ItemShovelAA(ToolMaterials.DIAMATINE));
|
||||
public static final RegistryObject<Item> SHOVEL_CRYSTAL_DIAMATINE = ITEMS.register("shovel_crystal_diamatine", ItemBase::new); //() -> new ItemShovelAA(ToolMaterials.DIAMATINE));
|
||||
public static final RegistryObject<Item> SWORD_CRYSTAL_DIAMATINE = ITEMS.register("sword_crystal_diamatine", () -> new ItemSwordAA(ToolMaterials.DIAMATINE));
|
||||
public static final RegistryObject<Item> HOE_CRYSTAL_DIAMATINE = ITEMS.register("hoe_crystal_diamatine", () -> new ItemHoeAA(ToolMaterials.DIAMATINE));
|
||||
public static final RegistryObject<Item> HELM_CRYSTAL_DIAMATINE = ITEMS.register("helm_crystal_diamatine", () -> new ItemArmorAA(ArmorMaterials.DIAMATINE, EquipmentSlotType.HEAD));
|
||||
|
@ -219,7 +219,7 @@ public final class ActuallyItems {
|
|||
|
||||
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));
|
||||
public static final RegistryObject<Item> SHOVEL_CRYSTAL_VOID = ITEMS.register("shovel_crystal_void", () -> new ItemShovelAA(ToolMaterials.VOID));
|
||||
public static final RegistryObject<Item> SHOVEL_CRYSTAL_VOID = ITEMS.register("shovel_crystal_void", ItemBase::new); // () -> new ItemShovelAA(ToolMaterials.VOID));
|
||||
public static final RegistryObject<Item> SWORD_CRYSTAL_VOID = ITEMS.register("sword_crystal_void", () -> new ItemSwordAA(ToolMaterials.VOID));
|
||||
public static final RegistryObject<Item> HOE_CRYSTAL_VOID = ITEMS.register("hoe_crystal_void", () -> new ItemHoeAA(ToolMaterials.VOID));
|
||||
public static final RegistryObject<Item> HELM_CRYSTAL_VOID = ITEMS.register("helm_crystal_void", () -> new ItemArmorAA(ArmorMaterials.VOID, EquipmentSlotType.HEAD));
|
||||
|
@ -230,7 +230,7 @@ public final class ActuallyItems {
|
|||
|
||||
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));
|
||||
public static final RegistryObject<Item> SHOVEL_CRYSTAL_EMERADIC = ITEMS.register("shovel_crystal_emeradic", () -> new ItemShovelAA(ToolMaterials.EMERADIC));
|
||||
public static final RegistryObject<Item> SHOVEL_CRYSTAL_EMERADIC = ITEMS.register("shovel_crystal_emeradic", ItemBase::new); //() -> new ItemShovelAA(ToolMaterials.EMERADIC));
|
||||
public static final RegistryObject<Item> SWORD_CRYSTAL_EMERADIC = ITEMS.register("sword_crystal_emeradic", () -> new ItemSwordAA(ToolMaterials.EMERADIC));
|
||||
public static final RegistryObject<Item> HOE_CRYSTAL_EMERADIC = ITEMS.register("hoe_crystal_emeradic", () -> new ItemHoeAA(ToolMaterials.EMERADIC));
|
||||
public static final RegistryObject<Item> HELM_CRYSTAL_EMERADIC = ITEMS.register("helm_crystal_emeradic", () -> new ItemArmorAA(ArmorMaterials.DIAMATINE, EquipmentSlotType.HEAD));
|
||||
|
@ -241,7 +241,7 @@ public final class ActuallyItems {
|
|||
|
||||
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));
|
||||
public static final RegistryObject<Item> SHOVEL_CRYSTAL_ENORI = ITEMS.register("shovel_crystal_enori", () -> new ItemShovelAA(ToolMaterials.ENORI));
|
||||
public static final RegistryObject<Item> SHOVEL_CRYSTAL_ENORI = ITEMS.register("shovel_crystal_enori", ItemBase::new); //() -> new ItemShovelAA(ToolMaterials.ENORI));
|
||||
public static final RegistryObject<Item> SWORD_CRYSTAL_ENORI = ITEMS.register("sword_crystal_enori", () -> new ItemSwordAA(ToolMaterials.ENORI));
|
||||
public static final RegistryObject<Item> HOE_CRYSTAL_ENORI = ITEMS.register("hoe_crystal_enori", () -> new ItemHoeAA(ToolMaterials.ENORI));
|
||||
public static final RegistryObject<Item> HELM_CRYSTAL_ENORI = ITEMS.register("helm_crystal_enori", () -> new ItemArmorAA(ArmorMaterials.ENORI, EquipmentSlotType.HEAD));
|
||||
|
|
|
@ -10,20 +10,33 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.items;
|
||||
|
||||
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.block.material.Material;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import net.minecraft.item.IItemTier;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ToolItem;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
public class ItemAxeAA extends ToolItem {
|
||||
private IItemTier tier;
|
||||
public ItemAxeAA(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)
|
||||
);
|
||||
|
||||
public class ItemAxeAA extends ItemToolAA {
|
||||
this.tier = tier;
|
||||
}
|
||||
|
||||
/*
|
||||
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.PLANKS, Blocks.BOOKSHELF, Blocks.LOG, Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK, Blocks.LADDER, Blocks.WOODEN_BUTTON, Blocks.WOODEN_PRESSURE_PLATE);
|
||||
|
||||
public ItemAxeAA(IItemTier material) {
|
||||
|
@ -42,5 +55,5 @@ public class ItemAxeAA extends ItemToolAA {
|
|||
@Override
|
||||
public Set<String> getToolClasses(ItemStack stack) {
|
||||
return Collections.singleton("axe");
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -16,6 +16,6 @@ public class ItemCoffeeBean extends ItemFoodBase {
|
|||
|
||||
public ItemCoffeeBean() {
|
||||
super(1, 1F, false);
|
||||
this.setMaxDamage(0);
|
||||
//this.setMaxDamage(0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,20 +10,33 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.items;
|
||||
|
||||
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.block.material.Material;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import net.minecraft.item.IItemTier;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ToolItem;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
public class ItemPickaxeAA extends ToolItem {
|
||||
private final IItemTier tier;
|
||||
public ItemPickaxeAA(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)
|
||||
);
|
||||
|
||||
public class ItemPickaxeAA extends ItemToolAA {
|
||||
this.tier = tier;
|
||||
}
|
||||
|
||||
/*
|
||||
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.DOUBLE_STONE_SLAB, Blocks.GOLDEN_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.ICE, Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.LIT_REDSTONE_ORE, Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, Blocks.SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.STONE_SLAB, Blocks.STONE_BUTTON, Blocks.STONE_PRESSURE_PLATE);
|
||||
|
||||
public ItemPickaxeAA(IItemTier material) {
|
||||
|
@ -76,5 +89,5 @@ public class ItemPickaxeAA extends ItemToolAA {
|
|||
@Override
|
||||
public Set<String> getToolClasses(ItemStack stack) {
|
||||
return Collections.singleton("pickaxe");
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -15,39 +15,40 @@ 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.item.IItemTier;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.tags.ITag;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
public class ItemShovelAA extends ItemToolAA {
|
||||
|
||||
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.CLAY, Blocks.DIRT, Blocks.FARMLAND, Blocks.GRASS, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_LAYER, Blocks.SOUL_SAND, Blocks.GRASS_PATH);
|
||||
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.CLAY, Blocks.DIRT, Blocks.FARMLAND, Blocks.GRASS, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_BLOCK, Blocks.SOUL_SAND, Blocks.GRASS_PATH);
|
||||
|
||||
public ItemShovelAA(IItemTier material) {
|
||||
super(1.5F, -3.0F, material, this.repairItem, unlocalizedName, this.rarity, EFFECTIVE_ON);
|
||||
this.setHarvestLevel("shovel", material.getLevel());
|
||||
public ItemShovelAA(float p_i48512_1_, float p_i48512_2_, IItemTier p_i48512_3_, Set<Block> p_i48512_4_, Properties p_i48512_5_, String name, ItemStack repairItem, ITag<Item> repairTag) {
|
||||
super(p_i48512_1_, p_i48512_2_, p_i48512_3_, p_i48512_4_, p_i48512_5_, name, repairItem, repairTag);
|
||||
}
|
||||
|
||||
// public ItemShovelAA(IItemTier material) {
|
||||
//// super(1.5F, -3.0F, material, this.repairItem, unlocalizedName, this.rarity, EFFECTIVE_ON);
|
||||
//// this.setHarvestLevel("shovel", material.getLevel());
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean isCorrectToolForDrops(BlockState blockIn) {
|
||||
Block block = blockIn.getBlock();
|
||||
return block == Blocks.SNOW_LAYER || block == Blocks.SNOW;
|
||||
return block == Blocks.SNOW_BLOCK || block == Blocks.SNOW;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public EnumActionResult onItemUse(PlayerEntity playerIn, World worldIn, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) {
|
||||
return Items.IRON_SHOVEL.onItemUse(playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ);
|
||||
public ActionResultType useOn(ItemUseContext useContext) {
|
||||
return Items.IRON_SHOVEL.useOn(useContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
//@Override
|
||||
public Set<String> getToolClasses(ItemStack stack) {
|
||||
return Collections.singleton("shovel");
|
||||
}
|
||||
|
|
|
@ -12,6 +12,6 @@ package de.ellpeck.actuallyadditions.mod.items.base;
|
|||
|
||||
public class ItemFoodBase extends ItemBase {
|
||||
public ItemFoodBase(int heal, float saturation, boolean wolfFood) {
|
||||
super(heal, saturation, wolfFood);
|
||||
//super(heal, saturation, wolfFood);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ public class ItemFoodSeed /*extends ItemSeedFood */{ //TODO what is this?!
|
|||
this.maxUseDuration = maxUseDuration;
|
||||
|
||||
if (plant instanceof BlockPlant) {
|
||||
((BlockPlant) plant).doStuff(this, returnItem, returnMeta);
|
||||
//((BlockPlant) plant).doStuff(this, returnItem, returnMeta);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,17 +10,30 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.items.base;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
|
||||
import de.ellpeck.actuallyadditions.mod.config.ConfigurationHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import net.minecraft.item.HoeItem;
|
||||
import net.minecraft.item.IItemTier;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class ItemHoeAA extends HoeItem implements IDisableableItem {
|
||||
public class ItemHoeAA extends HoeItem {
|
||||
private IItemTier tier;
|
||||
public ItemHoeAA(IItemTier tier) {
|
||||
super(tier,
|
||||
4,
|
||||
-2f,
|
||||
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)
|
||||
);
|
||||
|
||||
private final ItemStack repairItem;
|
||||
this.tier = tier;
|
||||
}
|
||||
|
||||
/* private final ItemStack repairItem;
|
||||
private final boolean disabled;
|
||||
|
||||
public ItemHoeAA(IItemTier toolMat) {
|
||||
|
@ -43,5 +56,5 @@ public class ItemHoeAA extends HoeItem implements IDisableableItem {
|
|||
@Override
|
||||
public boolean isDisabled() {
|
||||
return this.disabled;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public class ItemSeed /* extends ItemSeeds*/ {
|
|||
this.plant = plant;
|
||||
|
||||
if (plant instanceof BlockPlant) {
|
||||
((BlockPlant) plant).doStuff(this, returnItem, returnMeta);
|
||||
//((BlockPlant) plant).doStuff(this, returnItem, returnMeta); //TODO
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,18 +10,28 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.items.base;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
||||
import de.ellpeck.actuallyadditions.mod.config.ConfigurationHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import net.minecraft.item.IItemTier;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.SwordItem;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class ItemSwordAA extends SwordItem implements IDisableableItem {
|
||||
public class ItemSwordAA extends SwordItem {
|
||||
private IItemTier tier;
|
||||
public ItemSwordAA(IItemTier tier) {
|
||||
super(tier,
|
||||
(int) tier.getAttackDamageBonus(),
|
||||
tier.getSpeed(),
|
||||
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)
|
||||
);
|
||||
}
|
||||
|
||||
private final boolean disabled;
|
||||
/* private final boolean disabled;
|
||||
|
||||
public ItemSwordAA(IItemTier toolMat) {
|
||||
super(toolMat);
|
||||
|
@ -48,5 +58,5 @@ public class ItemSwordAA extends SwordItem implements IDisableableItem {
|
|||
@Override
|
||||
public boolean isDisabled() {
|
||||
return this.disabled;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -22,11 +22,8 @@ import net.minecraft.item.BlockItem;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -61,7 +58,7 @@ public class LensColor extends Lens {
|
|||
ItemStack returnStack = this.tryConvert(new ItemStack(block), hitState, hitBlock, tile);
|
||||
if (returnStack != null && returnStack.getItem() instanceof BlockItem) {
|
||||
Block toPlace = Block.byItem(returnStack.getItem());
|
||||
BlockState state2Place = toPlace.getStateForPlacement(tile.getWorldObject(), hitBlock, Direction.UP, 0, 0, 0, returnStack.getMetadata(), FakePlayerFactory.getMinecraft((ServerWorld) tile.getWorldObject()), Hand.MAIN_HAND);
|
||||
BlockState state2Place = toPlace.defaultBlockState(); //getStateForPlacement(tile.getWorldObject(), hitBlock, Direction.UP, 0, 0, 0, FakePlayerFactory.getMinecraft((ServerWorld) tile.getWorldObject()), Hand.MAIN_HAND); //TODO
|
||||
tile.getWorldObject().setBlock(hitBlock, state2Place, 2);
|
||||
tile.extractEnergy(ENERGY_USE);
|
||||
}
|
||||
|
|
|
@ -15,21 +15,15 @@ import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
|||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.WeightedOre;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
|
||||
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.NetherrackBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.WeightedRandom;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||
import net.minecraftforge.common.Tags;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -125,7 +119,7 @@ public class LensMining extends Lens {
|
|||
|
||||
List<WeightedOre> ores = null;
|
||||
Block hitBlock = hitState.getBlock();
|
||||
if (hitBlock instanceof BlockStone) {
|
||||
if (hitBlock.is(Tags.Blocks.STONE)) { //TODO maybe?
|
||||
ores = ActuallyAdditionsAPI.STONE_ORES;
|
||||
} else if (hitBlock instanceof NetherrackBlock) {
|
||||
ores = ActuallyAdditionsAPI.NETHERRACK_ORES;
|
||||
|
@ -139,7 +133,7 @@ public class LensMining extends Lens {
|
|||
boolean found = false;
|
||||
while (!found) {
|
||||
WeightedOre ore = WeightedRandom.getRandomItem(tile.getWorldObject().random, ores, totalWeight);
|
||||
if (ore != null) {
|
||||
/* if (ore != null) {
|
||||
List<ItemStack> stacks = OreDictionary.getOres(ore.name, false);
|
||||
if (stacks != null && !stacks.isEmpty()) {
|
||||
for (ItemStack aStack : stacks) {
|
||||
|
@ -154,19 +148,19 @@ public class LensMining extends Lens {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
if (tile.getEnergy() >= adaptedUse) {
|
||||
Block block = Block.byItem(stack.getItem());
|
||||
if (block != Blocks.AIR) {
|
||||
/* if (block != Blocks.AIR) {
|
||||
BlockState state = block.getStateForPlacement(tile.getWorldObject(), hitPos, Direction.UP, 0, 0, 0, stack.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), Hand.MAIN_HAND);
|
||||
tile.getWorldObject().setBlock(hitPos, state, 2);
|
||||
|
||||
tile.getWorldObject().levelEvent(2001, hitPos, Block.getId(state));
|
||||
|
||||
tile.extractEnergy(adaptedUse);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,126 +14,117 @@ import net.minecraft.block.Blocks;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.Rarity;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.Effect;
|
||||
import net.minecraft.potion.Effects;
|
||||
|
||||
@Deprecated
|
||||
public enum ThePotionRings {
|
||||
|
||||
SPEED(
|
||||
MobEffects.SPEED.getName(),
|
||||
8171462,
|
||||
MobEffects.SPEED,
|
||||
0,
|
||||
1,
|
||||
10,
|
||||
false,
|
||||
Rarity.UNCOMMON,
|
||||
new ItemStack(Items.SUGAR)
|
||||
8171462,
|
||||
Effects.MOVEMENT_SPEED,
|
||||
0,
|
||||
1,
|
||||
10,
|
||||
false,
|
||||
Rarity.UNCOMMON,
|
||||
new ItemStack(Items.SUGAR)
|
||||
),
|
||||
//Slowness
|
||||
HASTE(
|
||||
MobEffects.HASTE.getName(),
|
||||
14270531,
|
||||
MobEffects.HASTE,
|
||||
0,
|
||||
1,
|
||||
10,
|
||||
false,
|
||||
Rarity.EPIC,
|
||||
new ItemStack(Items.REPEATER)
|
||||
14270531,
|
||||
Effects.DIG_SPEED, // todo: wrong
|
||||
0,
|
||||
1,
|
||||
10,
|
||||
false,
|
||||
Rarity.EPIC,
|
||||
new ItemStack(Items.REPEATER)
|
||||
),
|
||||
//Mining Fatigue
|
||||
STRENGTH(
|
||||
MobEffects.STRENGTH.getName(),
|
||||
9643043,
|
||||
MobEffects.STRENGTH,
|
||||
0,
|
||||
1,
|
||||
10,
|
||||
false,
|
||||
Rarity.RARE,
|
||||
new ItemStack(Items.BLAZE_POWDER)
|
||||
9643043,
|
||||
Effects.DAMAGE_BOOST, // TODO: wrong?
|
||||
0,
|
||||
1,
|
||||
10,
|
||||
false,
|
||||
Rarity.RARE,
|
||||
new ItemStack(Items.BLAZE_POWDER)
|
||||
),
|
||||
//Health (Not Happening)
|
||||
//Damage
|
||||
JUMP_BOOST(
|
||||
MobEffects.JUMP_BOOST.getName(),
|
||||
7889559,
|
||||
MobEffects.JUMP_BOOST,
|
||||
0,
|
||||
1,
|
||||
10,
|
||||
false,
|
||||
Rarity.RARE,
|
||||
new ItemStack(Blocks.PISTON)
|
||||
7889559,
|
||||
Effects.JUMP,
|
||||
0,
|
||||
1,
|
||||
10,
|
||||
false,
|
||||
Rarity.RARE,
|
||||
new ItemStack(Blocks.PISTON)
|
||||
),
|
||||
//Nausea
|
||||
REGEN(
|
||||
MobEffects.REGENERATION.getName(),
|
||||
13458603,
|
||||
MobEffects.REGENERATION,
|
||||
0,
|
||||
1,
|
||||
50,
|
||||
true,
|
||||
Rarity.RARE,
|
||||
new ItemStack(Items.GHAST_TEAR)
|
||||
13458603,
|
||||
Effects.REGENERATION,
|
||||
0,
|
||||
1,
|
||||
50,
|
||||
true,
|
||||
Rarity.RARE,
|
||||
new ItemStack(Items.GHAST_TEAR)
|
||||
),
|
||||
RESISTANCE(
|
||||
MobEffects.RESISTANCE.getName(),
|
||||
10044730,
|
||||
MobEffects.RESISTANCE,
|
||||
0,
|
||||
1,
|
||||
10,
|
||||
false,
|
||||
Rarity.EPIC,
|
||||
new ItemStack(Items.SLIME_BALL)
|
||||
10044730,
|
||||
Effects.DAMAGE_RESISTANCE,
|
||||
0,
|
||||
1,
|
||||
10,
|
||||
false,
|
||||
Rarity.EPIC,
|
||||
new ItemStack(Items.SLIME_BALL)
|
||||
),
|
||||
FIRE_RESISTANCE(
|
||||
MobEffects.FIRE_RESISTANCE.getName(),
|
||||
14981690,
|
||||
MobEffects.FIRE_RESISTANCE,
|
||||
0,
|
||||
0,
|
||||
10,
|
||||
false,
|
||||
Rarity.UNCOMMON,
|
||||
new ItemStack(Items.MAGMA_CREAM)
|
||||
14981690,
|
||||
Effects.FIRE_RESISTANCE,
|
||||
0,
|
||||
0,
|
||||
10,
|
||||
false,
|
||||
Rarity.UNCOMMON,
|
||||
new ItemStack(Items.MAGMA_CREAM)
|
||||
),
|
||||
WATER_BREATHING(
|
||||
MobEffects.WATER_BREATHING.getName(),
|
||||
3035801,
|
||||
MobEffects.WATER_BREATHING,
|
||||
0,
|
||||
0,
|
||||
10,
|
||||
false,
|
||||
Rarity.RARE,
|
||||
new ItemStack(Items.FISH, 1, 3)
|
||||
3035801,
|
||||
Effects.WATER_BREATHING,
|
||||
0,
|
||||
0,
|
||||
10,
|
||||
false,
|
||||
Rarity.RARE,
|
||||
new ItemStack(Items.TROPICAL_FISH)
|
||||
),
|
||||
INVISIBILITY(
|
||||
MobEffects.INVISIBILITY.getName(),
|
||||
8356754,
|
||||
MobEffects.INVISIBILITY,
|
||||
0,
|
||||
0,
|
||||
10,
|
||||
false,
|
||||
Rarity.EPIC,
|
||||
new ItemStack(Items.FERMENTED_SPIDER_EYE)
|
||||
8356754,
|
||||
Effects.INVISIBILITY,
|
||||
0,
|
||||
0,
|
||||
10,
|
||||
false,
|
||||
Rarity.EPIC,
|
||||
new ItemStack(Items.FERMENTED_SPIDER_EYE)
|
||||
),
|
||||
//Blindness
|
||||
NIGHT_VISION(
|
||||
MobEffects.NIGHT_VISION.getName(),
|
||||
2039713,
|
||||
MobEffects.NIGHT_VISION,
|
||||
0,
|
||||
0,
|
||||
300,
|
||||
false,
|
||||
Rarity.RARE,
|
||||
new ItemStack(Items.GOLDEN_CARROT)
|
||||
2039713,
|
||||
Effects.NIGHT_VISION,
|
||||
0,
|
||||
0,
|
||||
300,
|
||||
false,
|
||||
Rarity.RARE,
|
||||
new ItemStack(Items.GOLDEN_CARROT)
|
||||
);
|
||||
//Hunger
|
||||
//Weakness
|
||||
|
@ -145,18 +136,18 @@ public enum ThePotionRings {
|
|||
public final String name;
|
||||
public final int color;
|
||||
public final Rarity rarity;
|
||||
public final int effectID;
|
||||
public final Effect effect;
|
||||
public final int normalAmplifier;
|
||||
public final int advancedAmplifier;
|
||||
public final int activeTime;
|
||||
public final boolean needsWaitBeforeActivating;
|
||||
public final ItemStack craftingItem;
|
||||
|
||||
ThePotionRings(String name, int color, Potion effect, int normalAmplifier, int advancedAmplifier, int activeTime, boolean needsWaitBeforeActivating, Rarity rarity, ItemStack craftingItem) {
|
||||
this.name = name;
|
||||
ThePotionRings(int color, Effect effect, int normalAmplifier, int advancedAmplifier, int activeTime, boolean needsWaitBeforeActivating, Rarity rarity, ItemStack craftingItem) {
|
||||
this.name = effect.getDisplayName().getString();
|
||||
this.color = color;
|
||||
this.rarity = rarity;
|
||||
this.effectID = Potion.getIdFromPotion(effect);
|
||||
this.effect = effect;
|
||||
this.normalAmplifier = normalAmplifier;
|
||||
this.advancedAmplifier = advancedAmplifier;
|
||||
this.activeTime = activeTime;
|
||||
|
|
|
@ -10,38 +10,18 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.misc.apiimpl;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||
import de.ellpeck.actuallyadditions.api.internal.IMethodHandler;
|
||||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.BlockLaserRelay;
|
||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
|
||||
import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.potion.Effect;
|
||||
import net.minecraft.potion.EffectInstance;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.vector.Vector3i;
|
||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -137,7 +117,7 @@ public class MethodHandler implements IMethodHandler {
|
|||
|
||||
@Override
|
||||
public boolean invokeConversionLens(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) {
|
||||
if (hitBlock != null) {
|
||||
/* if (hitBlock != null) {
|
||||
int range = 1;
|
||||
int rangeX = 0;
|
||||
int rangeY = 0;
|
||||
|
@ -175,7 +155,7 @@ public class MethodHandler implements IMethodHandler {
|
|||
recipe.transformHook(ItemStack.EMPTY, state, pos, tile);
|
||||
if (output.getItem() instanceof BlockItem) {
|
||||
Block toPlace = Block.byItem(output.getItem());
|
||||
BlockState state2Place = toPlace.getStateForPlacement(tile.getWorldObject(), pos, facing, 0, 0, 0, output.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), Hand.MAIN_HAND);
|
||||
BlockState state2Place = toPlace.defaultBlockState(); //.getStateForPlacement(tile.getWorldObject(), pos, facing, 0, 0, 0, output.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), Hand.MAIN_HAND); //TODO
|
||||
tile.getWorldObject().setBlock(pos, state2Place, 2);
|
||||
} else {
|
||||
ItemEntity item = new ItemEntity(tile.getWorldObject(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, output.copy());
|
||||
|
@ -199,7 +179,7 @@ public class MethodHandler implements IMethodHandler {
|
|||
List<ItemEntity> items = tile.getWorldObject().getEntitiesOfClass(ItemEntity.class, aabb);
|
||||
for (ItemEntity item : items) {
|
||||
ItemStack stack = item.getItem();
|
||||
if (item.isAlive() && StackUtil.isValid(stack) && !item.getEntityData().getBoolean("aa_cnv")) {
|
||||
if (item.isAlive() && StackUtil.isValid(stack) && !item.getPersistentData().getBoolean("aa_cnv")) {
|
||||
LensConversionRecipe recipe = LensRecipeHandler.findMatchingRecipe(stack, tile.getLens());
|
||||
if (recipe != null) {
|
||||
int itemsPossible = Math.min(tile.getEnergy() / recipe.getEnergyUsed(), stack.getCount());
|
||||
|
@ -220,7 +200,7 @@ public class MethodHandler implements IMethodHandler {
|
|||
outputCopy.setCount(itemsPossible);
|
||||
|
||||
ItemEntity newItem = new ItemEntity(tile.getWorldObject(), item.getX(), item.getY(), item.getZ(), outputCopy);
|
||||
newItem.getEntityData().putBoolean("aa_cnv", true);
|
||||
newItem.getPersistentData().putBoolean("aa_cnv", true);
|
||||
tile.getWorldObject().addFreshEntity(newItem);
|
||||
|
||||
tile.extractEnergy(recipe.getEnergyUsed() * itemsPossible);
|
||||
|
@ -230,7 +210,7 @@ public class MethodHandler implements IMethodHandler {
|
|||
}
|
||||
}
|
||||
return !hitState.getBlock().isAir(hitState, tile.getWorldObject(), hitBlock);
|
||||
}
|
||||
}*/
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -261,7 +241,7 @@ public class MethodHandler implements IMethodHandler {
|
|||
@Override
|
||||
public boolean addCrusherRecipes(List<ItemStack> inputs, List<ItemStack> outputOnes, int outputOneAmounts, List<ItemStack> outputTwos, int outputTwoAmounts, int outputTwoChance) {
|
||||
boolean hasWorkedOnce = false;
|
||||
for (ItemStack input : inputs) {
|
||||
/* for (ItemStack input : inputs) {
|
||||
if (StackUtil.isValid(input) && CrusherRecipeRegistry.getRecipeFromInput(input) == null) {
|
||||
for (ItemStack outputOne : outputOnes) {
|
||||
if (StackUtil.isValid(outputOne) && !CrusherRecipeRegistry.hasBlacklistedOutput(outputOne, ConfigStringListValues.CRUSHER_OUTPUT_BLACKLIST.getValue())) {
|
||||
|
@ -285,14 +265,14 @@ public class MethodHandler implements IMethodHandler {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/ //TODO
|
||||
return hasWorkedOnce;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addCrusherRecipes(List<ItemStack> inputs, ItemStack outputOne, int outputOneAmount, ItemStack outputTwo, int outputTwoAmount, int outputTwoChance) {
|
||||
boolean hasWorkedOnce = false;
|
||||
for (ItemStack input : inputs) {
|
||||
/* for (ItemStack input : inputs) {
|
||||
if (StackUtil.isValid(input) && CrusherRecipeRegistry.getRecipeFromInput(input) == null) {
|
||||
if (StackUtil.isValid(outputOne) && !CrusherRecipeRegistry.hasBlacklistedOutput(outputOne, ConfigStringListValues.CRUSHER_OUTPUT_BLACKLIST.getValue())) {
|
||||
ItemStack outputOneCopy = outputOne.copy();
|
||||
|
@ -310,62 +290,62 @@ public class MethodHandler implements IMethodHandler {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
return hasWorkedOnce;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBookletPage generateTextPage(int id) {
|
||||
return this.generateTextPage(id, 0);
|
||||
}
|
||||
// @Override
|
||||
// public IBookletPage generateTextPage(int id) {
|
||||
// return this.generateTextPage(id, 0);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public IBookletPage generatePicturePage(int id, ResourceLocation resLoc, int textStartY) {
|
||||
return this.generatePicturePage(id, resLoc, textStartY, 0);
|
||||
}
|
||||
// @Override
|
||||
// public IBookletPage generatePicturePage(int id, ResourceLocation resLoc, int textStartY) {
|
||||
// return this.generatePicturePage(id, resLoc, textStartY, 0);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public IBookletPage generateCraftingPage(int id, IRecipe... recipes) {
|
||||
return this.generateCraftingPage(id, 0, recipes);
|
||||
}
|
||||
// @Override
|
||||
// public IBookletPage generateCraftingPage(int id, IRecipe... recipes) {
|
||||
// return this.generateCraftingPage(id, 0, recipes);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result) {
|
||||
return this.generateFurnacePage(id, input, result, 0);
|
||||
}
|
||||
// @Override
|
||||
// public IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result) {
|
||||
// return this.generateFurnacePage(id, input, result, 0);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) {
|
||||
return this.generateBookletChapter(identifier, entry, displayStack, 0, pages);
|
||||
}
|
||||
// @Override
|
||||
// public IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) {
|
||||
// return this.generateBookletChapter(identifier, entry, displayStack, 0, pages);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public IBookletPage generateTextPage(int id, int priority) {
|
||||
return new PageTextOnly(id, priority);
|
||||
}
|
||||
// @Override
|
||||
// public IBookletPage generateTextPage(int id, int priority) {
|
||||
// return new PageTextOnly(id, priority);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public IBookletPage generatePicturePage(int id, ResourceLocation resLoc, int textStartY, int priority) {
|
||||
return new PagePicture(id, resLoc, textStartY, priority);
|
||||
}
|
||||
// @Override
|
||||
// public IBookletPage generatePicturePage(int id, ResourceLocation resLoc, int textStartY, int priority) {
|
||||
// return new PagePicture(id, resLoc, textStartY, priority);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public IBookletPage generateCraftingPage(int id, int priority, IRecipe... recipes) {
|
||||
return new PageCrafting(id, priority, recipes);
|
||||
}
|
||||
// @Override
|
||||
// public IBookletPage generateCraftingPage(int id, int priority, IRecipe... recipes) {
|
||||
// return new PageCrafting(id, priority, recipes);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result, int priority) {
|
||||
return new PageFurnace(id, result, priority);
|
||||
}
|
||||
// @Override
|
||||
// public IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result, int priority) {
|
||||
// return new PageFurnace(id, result, priority);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, int priority, IBookletPage... pages) {
|
||||
return new BookletChapter(identifier, entry, displayStack, priority, pages);
|
||||
}
|
||||
// @Override
|
||||
// public IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, int priority, IBookletPage... pages) {
|
||||
// return new BookletChapter(identifier, entry, displayStack, priority, pages);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public IBookletChapter createTrial(String identifier, ItemStack displayStack, boolean textOnSecondPage) {
|
||||
return new BookletChapterTrials(identifier, displayStack, textOnSecondPage);
|
||||
}
|
||||
// @Override
|
||||
// public IBookletChapter createTrial(String identifier, ItemStack displayStack, boolean textOnSecondPage) {
|
||||
// return new BookletChapterTrials(identifier, displayStack, textOnSecondPage);
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class CactusFarmerBehavior implements IFarmerBehavior {
|
|||
BlockState upState = world.getBlockState(up);
|
||||
if (upState.getBlock() == Blocks.CACTUS) {
|
||||
NonNullList<ItemStack> drops = NonNullList.create();
|
||||
upState.getBlock().getDrops(drops, world, up, upState, 0);
|
||||
//upState.getBlock().getDrops(drops, world, up, upState, 0);
|
||||
|
||||
if (!drops.isEmpty()) {
|
||||
if (farmer.canAddToOutput(drops)) {
|
||||
|
|
|
@ -97,7 +97,7 @@ public class DefaultFarmerBehavior implements IFarmerBehavior {
|
|||
List<ItemStack> seeds = new ArrayList<>();
|
||||
List<ItemStack> other = new ArrayList<>();
|
||||
NonNullList<ItemStack> drops = NonNullList.create();
|
||||
state.getBlock().getDrops(drops, world, pos, state, 0);
|
||||
//state.getBlock().getDrops(drops, world, pos, state, 0);
|
||||
for (ItemStack stack : drops) {
|
||||
if (this.getPlantableFromStack(stack) != null) {
|
||||
seeds.add(stack);
|
||||
|
@ -177,7 +177,7 @@ public class DefaultFarmerBehavior implements IFarmerBehavior {
|
|||
if (!player.mayUseItemAt(pos.relative(Direction.UP), Direction.UP, itemstack)) {
|
||||
return ActionResultType.FAIL;
|
||||
} else {
|
||||
int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(itemstack, player, world, pos);
|
||||
/* int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(itemstack, player, world, pos);
|
||||
if (hook != 0) {
|
||||
return hook > 0
|
||||
? ActionResultType.SUCCESS
|
||||
|
@ -205,7 +205,7 @@ public class DefaultFarmerBehavior implements IFarmerBehavior {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public class MelonPumpkinFarmerBehavior implements IFarmerBehavior {
|
|||
Block block = state.getBlock();
|
||||
if (block == Blocks.PUMPKIN || block == Blocks.MELON) {
|
||||
NonNullList<ItemStack> drops = NonNullList.create();
|
||||
block.getDrops(drops, world, pos, state, 0);
|
||||
//block.getDrops(drops, world, pos, state, 0);
|
||||
if (!drops.isEmpty()) {
|
||||
if (farmer.canAddToOutput(drops)) {
|
||||
world.levelEvent(2001, pos, Block.getId(state));
|
||||
|
|
|
@ -52,7 +52,7 @@ public class NetherWartFarmerBehavior implements IFarmerBehavior {
|
|||
if (state.getBlock() instanceof NetherWartBlock) {
|
||||
if (state.getValue(BlockStateProperties.AGE_3) >= 3) {
|
||||
NonNullList<ItemStack> drops = NonNullList.create();
|
||||
state.getBlock().getDrops(drops, world, pos, state, 0);
|
||||
//state.getBlock().getDrops(drops, world, pos, state, 0);
|
||||
if (!drops.isEmpty()) {
|
||||
boolean toInput = farmer.canAddToSeeds(drops);
|
||||
if (toInput || farmer.canAddToOutput(drops)) {
|
||||
|
|
|
@ -55,7 +55,7 @@ public class ReedFarmerBehavior implements IFarmerBehavior {
|
|||
BlockState upState = world.getBlockState(up);
|
||||
if (upState.getBlock() instanceof SugarCaneBlock) {
|
||||
NonNullList<ItemStack> drops = NonNullList.create();
|
||||
upState.getBlock().getDrops(drops, world, pos, state, 0);
|
||||
//upState.getBlock().getDrops(drops, world, pos, state, 0);
|
||||
|
||||
if (!drops.isEmpty()) {
|
||||
if (farmer.canAddToOutput(drops)) {
|
||||
|
|
|
@ -18,7 +18,6 @@ import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
public class FilterSettings {
|
||||
|
||||
|
@ -86,46 +85,43 @@ public class FilterSettings {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (oredict != 0) {
|
||||
int[] firstIds = OreDictionary.getOreIDs(first);
|
||||
int[] secondIds = OreDictionary.getOreIDs(second);
|
||||
boolean firstEmpty = ArrayUtils.isEmpty(firstIds);
|
||||
boolean secondEmpty = ArrayUtils.isEmpty(secondIds);
|
||||
|
||||
//Both empty, meaning none has OreDict entries, so they are equal
|
||||
if (firstEmpty && secondEmpty) {
|
||||
return true;
|
||||
}
|
||||
//Only one empty, meaning they are not equal
|
||||
else if (firstEmpty || secondEmpty) {
|
||||
return false;
|
||||
} else {
|
||||
for (int id : firstIds) {
|
||||
if (ArrayUtils.contains(secondIds, id)) {
|
||||
//Needs to match only one id, so return true on first match
|
||||
if (oredict == 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//Needs to match every id, so just return false when no match
|
||||
else if (oredict == 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
//If oredict mode 1, this will fail because nothing matched
|
||||
//If oredict mode 2, this will mean nothing hasn't matched
|
||||
return oredict == 2;
|
||||
}
|
||||
}
|
||||
// if (oredict != 0) {
|
||||
// boolean firstEmpty = ArrayUtils.isEmpty(firstIds);
|
||||
// boolean secondEmpty = ArrayUtils.isEmpty(secondIds);
|
||||
//
|
||||
// //Both empty, meaning none has OreDict entries, so they are equal
|
||||
// if (firstEmpty && secondEmpty) {
|
||||
// return true;
|
||||
// }
|
||||
// //Only one empty, meaning they are not equal
|
||||
// else if (firstEmpty || secondEmpty) {
|
||||
// return false;
|
||||
// } else {
|
||||
// for (int id : firstIds) {
|
||||
// if (ArrayUtils.contains(secondIds, id)) {
|
||||
// //Needs to match only one id, so return true on first match
|
||||
// if (oredict == 1) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// //Needs to match every id, so just return false when no match
|
||||
// else if (oredict == 2) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// //If oredict mode 1, this will fail because nothing matched
|
||||
// //If oredict mode 2, this will mean nothing hasn't matched
|
||||
// return oredict == 2;
|
||||
// }
|
||||
// }
|
||||
|
||||
if (firstItem != secondItem) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean metaFine = !meta || first.getItemDamage() == second.getItemDamage();
|
||||
boolean nbtFine = !nbt || ItemStack.tagMatches(first, second);
|
||||
if (metaFine && nbtFine) {
|
||||
if (nbtFine) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -139,11 +135,11 @@ public class FilterSettings {
|
|||
compound.putBoolean("Mod", this.respectMod);
|
||||
compound.putInt("Oredict", this.respectOredict);
|
||||
TileEntityInventoryBase.saveSlots(this.filterInventory, compound);
|
||||
tag.setTag(name, compound);
|
||||
tag.put(name, compound);
|
||||
}
|
||||
|
||||
public void readFromNBT(CompoundNBT tag, String name) {
|
||||
CompoundNBT compound = tag.getCompoundTag(name);
|
||||
CompoundNBT compound = tag.getCompound(name);
|
||||
this.isWhitelist = compound.getBoolean("Whitelist");
|
||||
this.respectMeta = compound.getBoolean("Meta");
|
||||
this.respectNBT = compound.getBoolean("NBT");
|
||||
|
|
|
@ -12,10 +12,9 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
|||
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerGrinder;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.CrusherContainer;
|
||||
import de.ellpeck.actuallyadditions.mod.misc.SoundHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
|
||||
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
|
@ -177,7 +176,7 @@ public class TileEntityCrusher extends TileEntityInventoryBase implements IButto
|
|||
|
||||
@Override
|
||||
public IAcceptor getAcceptor() {
|
||||
return (slot, stack, automation) -> !automation || (slot == SLOT_INPUT_1 || slot == SLOT_INPUT_2) && CrusherRecipeRegistry.getRecipeFromInput(stack) != null;
|
||||
return (slot, stack, automation) -> !automation || (slot == SLOT_INPUT_1 || slot == SLOT_INPUT_2); /*CrusherRecipeRegistry.getRecipeFromInput(stack) != null*/ //TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -288,6 +287,6 @@ public class TileEntityCrusher extends TileEntityInventoryBase implements IButto
|
|||
@Nullable
|
||||
@Override
|
||||
public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) {
|
||||
return new ContainerGrinder(windowId, playerInventory, this);
|
||||
return new CrusherContainer(windowId, playerInventory, this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,117 +1,118 @@
|
|||
/*
|
||||
* This file ("TileEntityFurnaceSolar.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 net.minecraft.block.BlockState;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
|
||||
|
||||
public class TileEntityFurnaceSolar extends TileEntityBase implements ISharingEnergyProvider, IEnergyDisplay {
|
||||
|
||||
public static final int PRODUCE = 8;
|
||||
public final CustomEnergyStorage storage = new CustomEnergyStorage(30000, 0, 100);
|
||||
public final LazyOptional<IEnergyStorage> lazyEnergy = LazyOptional.of(() -> this.storage);
|
||||
private int oldEnergy;
|
||||
|
||||
public TileEntityFurnaceSolar() {
|
||||
super(ActuallyTiles.SOLAR_TILE.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(CompoundNBT compound, NBTType type) {
|
||||
super.writeSyncableNBT(compound, type);
|
||||
this.storage.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(CompoundNBT compound, NBTType type) {
|
||||
super.readSyncableNBT(compound, type);
|
||||
this.storage.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (!this.level.isClientSide) {
|
||||
int power = this.getPowerToGenerate(PRODUCE);
|
||||
if (this.level.isDay() && power > 0) {
|
||||
if (power <= this.storage.getMaxEnergyStored() - this.storage.getEnergyStored()) {
|
||||
this.storage.receiveEnergyInternal(power, false);
|
||||
this.setChanged();
|
||||
}
|
||||
}
|
||||
|
||||
if (this.oldEnergy != this.storage.getEnergyStored() && this.sendUpdateWithInterval()) {
|
||||
this.oldEnergy = this.storage.getEnergyStored();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getPowerToGenerate(int power) {
|
||||
for (int y = 1; y <= this.level.getMaxBuildHeight() - this.worldPosition.getY(); y++) {
|
||||
if (power > 0) {
|
||||
BlockPos pos = this.worldPosition.above(y);
|
||||
BlockState state = this.level.getBlockState(pos);
|
||||
|
||||
if (state.getMaterial().isSolidBlocking()) {
|
||||
power = 0;
|
||||
} else if (!state.getBlock().isAir(state, this.level, pos)) {
|
||||
power--;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomEnergyStorage getEnergyStorage() {
|
||||
return this.storage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsHoldShift() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyToSplitShare() {
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesShareEnergy() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Direction[] getEnergyShareSides() {
|
||||
return Direction.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canShareTo(TileEntity tile) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LazyOptional<IEnergyStorage> getEnergyStorage(Direction facing) {
|
||||
return this.lazyEnergy;
|
||||
}
|
||||
}
|
||||
///*
|
||||
// * This file ("TileEntityFurnaceSolar.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.blocks.ActuallyBlocks;
|
||||
//import net.minecraft.block.BlockState;
|
||||
//import net.minecraft.nbt.CompoundNBT;
|
||||
//import net.minecraft.tileentity.TileEntity;
|
||||
//import net.minecraft.util.Direction;
|
||||
//import net.minecraft.util.math.BlockPos;
|
||||
//import net.minecraftforge.common.util.LazyOptional;
|
||||
//import net.minecraftforge.energy.IEnergyStorage;
|
||||
//
|
||||
//import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
|
||||
//
|
||||
//public class TileEntityFurnaceSolar extends TileEntityBase implements ISharingEnergyProvider, IEnergyDisplay {
|
||||
//
|
||||
// public static final int PRODUCE = 8;
|
||||
// public final CustomEnergyStorage storage = new CustomEnergyStorage(30000, 0, 100);
|
||||
// public final LazyOptional<IEnergyStorage> lazyEnergy = LazyOptional.of(() -> this.storage);
|
||||
// private int oldEnergy;
|
||||
//
|
||||
// public TileEntityFurnaceSolar() {
|
||||
// super(ActuallyBlocks.SO.SOLAR_TILE.get());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void writeSyncableNBT(CompoundNBT compound, NBTType type) {
|
||||
// super.writeSyncableNBT(compound, type);
|
||||
// this.storage.writeToNBT(compound);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void readSyncableNBT(CompoundNBT compound, NBTType type) {
|
||||
// super.readSyncableNBT(compound, type);
|
||||
// this.storage.readFromNBT(compound);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void updateEntity() {
|
||||
// super.updateEntity();
|
||||
// if (!this.level.isClientSide) {
|
||||
// int power = this.getPowerToGenerate(PRODUCE);
|
||||
// if (this.level.isDay() && power > 0) {
|
||||
// if (power <= this.storage.getMaxEnergyStored() - this.storage.getEnergyStored()) {
|
||||
// this.storage.receiveEnergyInternal(power, false);
|
||||
// this.setChanged();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (this.oldEnergy != this.storage.getEnergyStored() && this.sendUpdateWithInterval()) {
|
||||
// this.oldEnergy = this.storage.getEnergyStored();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public int getPowerToGenerate(int power) {
|
||||
// for (int y = 1; y <= this.level.getMaxBuildHeight() - this.worldPosition.getY(); y++) {
|
||||
// if (power > 0) {
|
||||
// BlockPos pos = this.worldPosition.above(y);
|
||||
// BlockState state = this.level.getBlockState(pos);
|
||||
//
|
||||
// if (state.getMaterial().isSolidBlocking()) {
|
||||
// power = 0;
|
||||
// } else if (!state.getBlock().isAir(state, this.level, pos)) {
|
||||
// power--;
|
||||
// }
|
||||
// } else {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return power;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public CustomEnergyStorage getEnergyStorage() {
|
||||
// return this.storage;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean needsHoldShift() {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getEnergyToSplitShare() {
|
||||
// return this.storage.getEnergyStored();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean doesShareEnergy() {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Direction[] getEnergyShareSides() {
|
||||
// return Direction.values();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean canShareTo(TileEntity tile) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public LazyOptional<IEnergyStorage> getEnergyStorage(Direction facing) {
|
||||
// return this.lazyEnergy;
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
/*
|
||||
* This file ("TileEntityInputterAdvanced.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;
|
||||
|
||||
public class TileEntityInputterAdvanced extends TileEntityInputter {
|
||||
|
||||
public TileEntityInputterAdvanced() {
|
||||
super(ActuallyTiles.INPUTTERADVANCED_TILE.get(), 1);
|
||||
this.isAdvanced = true;
|
||||
}
|
||||
|
||||
}
|
|
@ -30,8 +30,6 @@ import net.minecraftforge.common.util.LazyOptional;
|
|||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
|
||||
|
||||
public abstract class TileEntityPhantomface extends TileEntityInventoryBase implements IPhantomTile {
|
||||
public static final int RANGE = 16;
|
||||
public BlockPos boundPosition;
|
||||
|
@ -176,7 +174,7 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl
|
|||
this.boundPosition = pos;
|
||||
}
|
||||
|
||||
@Override
|
||||
//@Override
|
||||
public int getGuiID() {
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -13,19 +13,15 @@ package de.ellpeck.actuallyadditions.mod.util;
|
|||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.network.PacketServerToClient;
|
||||
import de.ellpeck.actuallyadditions.mod.particle.ParticleBeam;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.particles.IParticleData;
|
||||
|
@ -34,9 +30,6 @@ import net.minecraft.util.math.vector.Vector3d;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.fml.network.NetworkRegistry;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public final class AssetUtil {
|
||||
|
||||
|
@ -92,7 +85,7 @@ public final class AssetUtil {
|
|||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void renderItemWithoutScrewingWithColors(ItemStack stack) {
|
||||
if (StackUtil.isValid(stack)) {
|
||||
/* if (StackUtil.isValid(stack)) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
ItemRenderer renderer = mc.getItemRenderer();
|
||||
TextureManager manager = mc.getTextureManager();
|
||||
|
@ -112,12 +105,12 @@ public final class AssetUtil {
|
|||
GlStateManager._disableBlend();
|
||||
manager.bind(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
manager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void renderStackToGui(ItemStack stack, int x, int y, float scale) {
|
||||
GlStateManager._pushMatrix();
|
||||
/* GlStateManager._pushMatrix();
|
||||
GlStateManager._enableBlend();
|
||||
GlStateManager._blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
|
@ -134,13 +127,13 @@ public final class AssetUtil {
|
|||
mc.font.setUnicodeFlag(flagBefore);
|
||||
|
||||
RenderHelper.turnOff();
|
||||
GlStateManager._popMatrix();
|
||||
GlStateManager._popMatrix();*/
|
||||
}
|
||||
|
||||
//Copied from Gui.class and changed
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void drawHorizontalGradientRect(int left, int top, int right, int bottom, int startColor, int endColor, float zLevel) {
|
||||
float f = (startColor >> 24 & 255) / 255.0F;
|
||||
/* float f = (startColor >> 24 & 255) / 255.0F;
|
||||
float f1 = (startColor >> 16 & 255) / 255.0F;
|
||||
float f2 = (startColor >> 8 & 255) / 255.0F;
|
||||
float f3 = (startColor & 255) / 255.0F;
|
||||
|
@ -164,7 +157,7 @@ public final class AssetUtil {
|
|||
GlStateManager._shadeModel(7424);
|
||||
GlStateManager._disableBlend();
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.enableTexture2D();
|
||||
GlStateManager.enableTexture2D();*/
|
||||
}
|
||||
|
||||
// @OnlyIn(Dist.CLIENT)
|
||||
|
@ -221,7 +214,7 @@ public final class AssetUtil {
|
|||
data.putFloat("Size", size);
|
||||
data.putInt("MaxAge", maxAge);
|
||||
data.putFloat("Alpha", alpha);
|
||||
PacketHandler.THE_NETWORK.sendToAllAround(new PacketServerToClient(data, PacketHandler.LASER_HANDLER), new NetworkRegistry.TargetPoint(world.provider.getDimension(), startX, startY, startZ, 96));
|
||||
//PacketHandler.THE_NETWORK.sendToAllAround(new PacketServerToClient(data, PacketHandler.LASER_HANDLER), new NetworkRegistry.TargetPoint(world.provider.getDimension(), startX, startY, startZ, 96)); //TODO
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -261,7 +254,7 @@ public final class AssetUtil {
|
|||
|
||||
GlStateManager._pushMatrix();
|
||||
|
||||
GlStateManager._disableLighting();
|
||||
/* GlStateManager._disableLighting();
|
||||
GlStateManager._enableBlend();
|
||||
GlStateManager._blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
|
||||
int func = GL11.glGetInteger(GL11.GL_ALPHA_TEST_FUNC);
|
||||
|
@ -270,7 +263,7 @@ public final class AssetUtil {
|
|||
GlStateManager.translate(firstX - TileEntityRendererDispatcher.staticPlayerX, firstY - TileEntityRendererDispatcher.staticPlayerY, firstZ - TileEntityRendererDispatcher.staticPlayerZ);
|
||||
GlStateManager.rotate((float) (180 * yaw / Math.PI), 0, 1, 0);
|
||||
GlStateManager.rotate((float) (180 * pitch / Math.PI), 0, 0, 1);
|
||||
GlStateManager.rotate((float) rot, 1, 0, 0);
|
||||
GlStateManager.rotate((float) rot, 1, 0, 0);*/
|
||||
|
||||
/*if(r != r2 || g != g2 || b != b2){
|
||||
render.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
|
@ -318,8 +311,8 @@ public final class AssetUtil {
|
|||
tessy.draw();
|
||||
}
|
||||
else{*/
|
||||
GlStateManager.disableTexture2D();
|
||||
render.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
|
||||
//GlStateManager.disableTexture2D();
|
||||
//render.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
|
||||
for (double i = 0; i < 4; i++) {
|
||||
double width = beamWidth * (i / 4.0);
|
||||
render.vertex(length, width, width).uv(0, 0).uv2(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex();
|
||||
|
@ -344,11 +337,11 @@ public final class AssetUtil {
|
|||
}
|
||||
tessy.end();
|
||||
|
||||
GlStateManager.enableTexture2D();
|
||||
//GlStateManager.enableTexture2D();
|
||||
//}
|
||||
|
||||
GlStateManager._alphaFunc(func, ref);
|
||||
GlStateManager._blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
//GlStateManager._alphaFunc(func, ref);
|
||||
//GlStateManager._blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager._disableBlend();
|
||||
GlStateManager._enableLighting();
|
||||
GlStateManager._popMatrix();
|
||||
|
|
|
@ -18,32 +18,33 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.event.world.BlockEvent.BreakEvent;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -75,7 +76,7 @@ public final class WorldUtil {
|
|||
ItemStack extracted = StackUtil.getEmpty();
|
||||
|
||||
if (ActuallyAdditions.commonCapsLoaded) {
|
||||
Object handler = extractWrapper.getSlotlessHandler();
|
||||
/* Object handler = extractWrapper.getSlotlessHandler();
|
||||
if (handler instanceof ISlotlessItemHandler) {
|
||||
ISlotlessItemHandler slotless = (ISlotlessItemHandler) handler;
|
||||
|
||||
|
@ -93,11 +94,11 @@ public final class WorldUtil {
|
|||
}
|
||||
//Leave the possibility to fall back to vanilla when there is a filter
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(extracted)) {
|
||||
IItemHandler handler = extractWrapper.getNormalHandler();
|
||||
/* IItemHandler handler = extractWrapper.getNormalHandler();
|
||||
if (handler != null) {
|
||||
for (int i = Math.max(0, slotStart); i < Math.min(slotEnd, handler.getSlots()); i++) {
|
||||
if (filter == null || !filter.needsCheck() || filter.check(handler.getStackInSlot(i))) {
|
||||
|
@ -108,7 +109,7 @@ public final class WorldUtil {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
return extracted;
|
||||
|
@ -117,32 +118,35 @@ public final class WorldUtil {
|
|||
public static void doEnergyInteraction(TileEntity tileFrom, TileEntity tileTo, Direction sideTo, int maxTransfer) {
|
||||
if (maxTransfer > 0) {
|
||||
Direction opp = sideTo == null
|
||||
? null
|
||||
: sideTo.getOpposite();
|
||||
IEnergyStorage handlerFrom = tileFrom.getCapability(CapabilityEnergy.ENERGY, sideTo);
|
||||
IEnergyStorage handlerTo = tileTo.getCapability(CapabilityEnergy.ENERGY, opp);
|
||||
if (handlerFrom != null && handlerTo != null) {
|
||||
int drain = handlerFrom.extractEnergy(maxTransfer, true);
|
||||
if (drain > 0) {
|
||||
int filled = handlerTo.receiveEnergy(drain, false);
|
||||
handlerFrom.extractEnergy(filled, false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
? null
|
||||
: sideTo.getOpposite();
|
||||
LazyOptional<IEnergyStorage> handlerFrom = tileFrom.getCapability(CapabilityEnergy.ENERGY, sideTo);
|
||||
LazyOptional<IEnergyStorage> handlerTo = tileTo.getCapability(CapabilityEnergy.ENERGY, opp);
|
||||
handlerFrom.ifPresent((from) -> {
|
||||
handlerTo.ifPresent((to) -> {
|
||||
int drain = from.extractEnergy(maxTransfer, true);
|
||||
if (drain > 0) {
|
||||
int filled = to.receiveEnergy(drain, false);
|
||||
to.extractEnergy(filled, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static void doFluidInteraction(TileEntity tileFrom, TileEntity tileTo, Direction sideTo, int maxTransfer) {
|
||||
if (maxTransfer > 0) {
|
||||
if (tileFrom.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, sideTo) && tileTo.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, sideTo.getOpposite())) {
|
||||
IFluidHandler handlerFrom = tileFrom.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, sideTo);
|
||||
IFluidHandler handlerTo = tileTo.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, sideTo.getOpposite());
|
||||
FluidStack drain = handlerFrom.drain(maxTransfer, false);
|
||||
if (drain != null) {
|
||||
int filled = handlerTo.fill(drain.copy(), true);
|
||||
handlerFrom.drain(filled, true);
|
||||
}
|
||||
}
|
||||
LazyOptional<IFluidHandler> optionalFrom = tileFrom.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, sideTo);
|
||||
LazyOptional<IFluidHandler> optionalTo = tileTo.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, sideTo.getOpposite());
|
||||
optionalFrom.ifPresent((from) -> {
|
||||
optionalTo.ifPresent((to) -> {
|
||||
FluidStack drain = from.drain(maxTransfer, IFluidHandler.FluidAction.SIMULATE);
|
||||
if (!drain.isEmpty()) {
|
||||
int filled = to.fill(drain.copy(), IFluidHandler.FluidAction.EXECUTE);
|
||||
from.drain(filled, IFluidHandler.FluidAction.EXECUTE);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,11 +169,11 @@ public final class WorldUtil {
|
|||
}
|
||||
|
||||
public static ItemStack useItemAtSide(Direction side, World world, BlockPos pos, ItemStack stack) {
|
||||
if (world instanceof WorldServer && StackUtil.isValid(stack) && pos != null) {
|
||||
if (world instanceof ServerWorld && StackUtil.isValid(stack) && pos != null) {
|
||||
BlockPos offsetPos = pos.relative(side);
|
||||
BlockState state = world.getBlockState(offsetPos);
|
||||
Block block = state.getBlock();
|
||||
boolean replaceable = block.canBeReplaced(world, offsetPos);
|
||||
boolean replaceable = false; //= block.canBeReplaced(world, offsetPos); //TODO
|
||||
|
||||
//Redstone
|
||||
if (replaceable && stack.getItem() == Items.REDSTONE) {
|
||||
|
@ -178,28 +182,28 @@ public final class WorldUtil {
|
|||
}
|
||||
|
||||
//Plants
|
||||
if (replaceable && stack.getItem() instanceof IPlantable) {
|
||||
/* if (replaceable && stack.getItem() instanceof IPlantable) { //TODO
|
||||
if (((IPlantable) stack.getItem()).getPlant(world, offsetPos).getBlock().canPlaceBlockAt(world, offsetPos)) {
|
||||
if (world.setBlock(offsetPos, ((IPlantable) stack.getItem()).getPlant(world, offsetPos), 2)) {
|
||||
return StackUtil.shrink(stack, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
//Everything else
|
||||
try {
|
||||
FakePlayer fake = FakePlayerFactory.getMinecraft((WorldServer) world);
|
||||
FakePlayer fake = FakePlayerFactory.getMinecraft((ServerWorld) world);
|
||||
if (fake.connection == null) {
|
||||
fake.connection = new NetHandlerSpaghettiServer(fake);
|
||||
}
|
||||
ItemStack heldBefore = fake.getMainHandItem();
|
||||
setHandItemWithoutAnnoyingSound(fake, Hand.MAIN_HAND, stack.copy());
|
||||
fake.gameMode.processRightClickBlock(fake, world, fake.getMainHandItem(), Hand.MAIN_HAND, offsetPos, side.getOpposite(), 0.5F, 0.5F, 0.5F);
|
||||
//fake.gameMode.useItemOn(fake, world, fake.getMainHandItem(), Hand.MAIN_HAND, offsetPos, side.getOpposite(), 0.5F, 0.5F, 0.5F); //TODO
|
||||
ItemStack result = fake.getItemInHand(Hand.MAIN_HAND);
|
||||
setHandItemWithoutAnnoyingSound(fake, Hand.MAIN_HAND, heldBefore);
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
ActuallyAdditions.LOGGER.error("Something that places Blocks at " + offsetPos.getX() + ", " + offsetPos.getY() + ", " + offsetPos.getZ() + " in World " + world.provider.getDimension() + " threw an Exception! Don't let that happen again!", e);
|
||||
ActuallyAdditions.LOGGER.error("Something that places Blocks at " + offsetPos.getX() + ", " + offsetPos.getY() + ", " + offsetPos.getZ() + " in World " + world.dimension() + " threw an Exception! Don't let that happen again!", e);
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
|
@ -208,12 +212,10 @@ public final class WorldUtil {
|
|||
public static boolean dropItemAtSide(Direction side, World world, BlockPos pos, ItemStack stack) {
|
||||
BlockPos coords = pos.relative(side);
|
||||
if (world.hasChunkAt(coords)) {
|
||||
EntityItem item = new EntityItem(world, coords.getX() + 0.5, coords.getY() + 0.5, coords.getZ() + 0.5, stack);
|
||||
item.motionX = 0;
|
||||
item.motionY = 0;
|
||||
item.motionZ = 0;
|
||||
ItemEntity item = new ItemEntity(world, coords.getX() + 0.5, coords.getY() + 0.5, coords.getZ() + 0.5, stack);
|
||||
item.setDeltaMovement(0,0,0);
|
||||
|
||||
return world.spawnEntity(item);
|
||||
return world.addFreshEntity(item);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -236,7 +238,7 @@ public final class WorldUtil {
|
|||
}
|
||||
|
||||
public static Direction getDirectionByPistonRotation(BlockState state) {
|
||||
return state.getValue(BlockDirectional.FACING);
|
||||
return state.getValue(BlockStateProperties.FACING);
|
||||
}
|
||||
|
||||
public static ArrayList<Material> getMaterialsAround(World world, BlockPos pos) {
|
||||
|
@ -255,9 +257,9 @@ public final class WorldUtil {
|
|||
private static RayTraceResult getMovingObjectPosWithReachDistance(World world, PlayerEntity player, double distance, boolean p1, boolean p2, boolean p3) {
|
||||
float f = player.xRot;
|
||||
float f1 = player.yRot;
|
||||
double d0 = player.posX;
|
||||
double d1 = player.posY + player.getEyeHeight();
|
||||
double d2 = player.posZ;
|
||||
double d0 = player.position().x;
|
||||
double d1 = player.position().y + player.getEyeHeight();
|
||||
double d2 = player.position().z;
|
||||
Vector3d vec3 = new Vector3d(d0, d1, d2);
|
||||
float f2 = MathHelper.cos(-f1 * 0.017453292F - (float) Math.PI);
|
||||
float f3 = MathHelper.sin(-f1 * 0.017453292F - (float) Math.PI);
|
||||
|
@ -266,7 +268,9 @@ public final class WorldUtil {
|
|||
float f6 = f3 * f4;
|
||||
float f7 = f2 * f4;
|
||||
Vector3d vec31 = vec3.add(f6 * distance, f5 * distance, f7 * distance);
|
||||
return world.clipWithInteractionOverride(vec3, vec31, p1, p2, p3);
|
||||
//return world.clipWithInteractionOverride(vec3, vec31, p1, p2, p3); //TODO
|
||||
|
||||
return new BlockRayTraceResult(Vector3d.ZERO, Direction.DOWN, BlockPos.ZERO, false);
|
||||
}
|
||||
|
||||
public static RayTraceResult getNearestBlockWithDefaultReachDistance(World world, PlayerEntity player) {
|
||||
|
@ -274,7 +278,8 @@ public final class WorldUtil {
|
|||
}
|
||||
|
||||
public static RayTraceResult getNearestBlockWithDefaultReachDistance(World world, PlayerEntity player, boolean stopOnLiquids, boolean ignoreBlockWithoutBoundingBox, boolean returnLastUncollidableBlock) {
|
||||
return getMovingObjectPosWithReachDistance(world, player, player.getEntityAttribute(PlayerEntity.REACH_DISTANCE).getAttributeValue(), stopOnLiquids, ignoreBlockWithoutBoundingBox, returnLastUncollidableBlock);
|
||||
return new BlockRayTraceResult(Vector3d.ZERO, Direction.DOWN, BlockPos.ZERO, false); //TODO
|
||||
//return getMovingObjectPosWithReachDistance(world, player, player.getAttribute(PlayerEntity.REACH_DISTANCE).getAttributeValue(), stopOnLiquids, ignoreBlockWithoutBoundingBox, returnLastUncollidableBlock);
|
||||
}
|
||||
|
||||
public static void setHandItemWithoutAnnoyingSound(PlayerEntity player, Hand hand, ItemStack stack) {
|
||||
|
@ -295,7 +300,7 @@ public final class WorldUtil {
|
|||
|
||||
BreakEvent event = new BreakEvent(world, pos, state, fake);
|
||||
if (!MinecraftForge.EVENT_BUS.post(event)) {
|
||||
return ForgeEventFactory.fireBlockHarvesting(drops, world, pos, state, 0, 1, false, fake);
|
||||
//return ForgeEventFactory.fireBlockHarvesting(drops, world, pos, state, 0, 1, false, fake); //TODO what?!
|
||||
}
|
||||
}
|
||||
return 0F;
|
||||
|
@ -315,13 +320,13 @@ public final class WorldUtil {
|
|||
Block block = state.getBlock();
|
||||
|
||||
if (player.isCreative()) {
|
||||
if (block.removedByPlayer(state, world, pos, player, false)) {
|
||||
if (block.removedByPlayer(state, world, pos, player, false, state.getFluidState())) {
|
||||
block.destroy(world, pos, state);
|
||||
}
|
||||
|
||||
// send update to client
|
||||
if (!world.isClientSide) {
|
||||
((ServerPlayerEntity) player).connection.send(new SPacketBlockChange(world, pos));
|
||||
//((ServerPlayerEntity) player).connection.send(new SPacketBlockChange(world, pos)); //TODO dunno what this is
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -338,14 +343,14 @@ public final class WorldUtil {
|
|||
}
|
||||
|
||||
TileEntity tileEntity = world.getBlockEntity(pos);
|
||||
if (block.removedByPlayer(state, world, pos, player, true)) { // boolean is if block can be harvested, checked above
|
||||
if (block.removedByPlayer(state, world, pos, player, true, state.getFluidState())) { // boolean is if block can be harvested, checked above
|
||||
block.destroy(world, pos, state);
|
||||
block.playerDestroy(world, player, pos, state, tileEntity, stack);
|
||||
block.popExperience(world, pos, xp);
|
||||
block.popExperience(((ServerWorld) world), pos, xp);
|
||||
}
|
||||
|
||||
// always send block update to client
|
||||
((ServerPlayerEntity) player).connection.send(new SPacketBlockChange(world, pos));
|
||||
//((ServerPlayerEntity) player).connection.send(new SPacketBlockChange(world, pos)); //TODO how
|
||||
return true;
|
||||
}
|
||||
// client sided handling
|
||||
|
@ -355,7 +360,7 @@ public final class WorldUtil {
|
|||
|
||||
// following code can be found in PlayerControllerMP.onPlayerDestroyBlock
|
||||
world.levelEvent(2001, pos, Block.getId(state));
|
||||
if (block.removedByPlayer(state, world, pos, player, true)) {
|
||||
if (block.removedByPlayer(state, world, pos, player, true, state.getFluidState())) {
|
||||
block.destroy(world, pos, state);
|
||||
}
|
||||
// callback to the tool
|
||||
|
|
Loading…
Reference in a new issue