Compare commits

..

No commits in common. "ac3551061dbc36ad9d6627c4802ef57d7c775960" and "789570e25d9c75c5acb53be1db06bba98641078d" have entirely different histories.

56 changed files with 817 additions and 746 deletions

View file

@ -10,10 +10,15 @@
package de.ellpeck.actuallyadditions.api.internal; 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 de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.potion.EffectInstance; import net.minecraft.potion.EffectInstance;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import java.util.List; import java.util.List;
@ -45,25 +50,25 @@ public interface IMethodHandler {
//Use Ingredient input on AA API class //Use Ingredient input on AA API class
boolean addCrusherRecipes(List<ItemStack> inputs, ItemStack outputOne, int outputOneAmount, ItemStack outputTwo, int outputTwoAmount, int outputTwoChance); boolean addCrusherRecipes(List<ItemStack> inputs, ItemStack outputOne, int outputOneAmount, ItemStack outputTwo, int outputTwoAmount, int outputTwoChance);
// IBookletPage generateTextPage(int id); IBookletPage generateTextPage(int id);
//
// IBookletPage generatePicturePage(int id, ResourceLocation resLoc, int textStartY); IBookletPage generatePicturePage(int id, ResourceLocation resLoc, int textStartY);
//
// IBookletPage generateCraftingPage(int id, IRecipe... recipes); IBookletPage generateCraftingPage(int id, IRecipe... recipes);
//
// IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result); IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result);
//
// IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages); IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages);
//
// IBookletPage generateTextPage(int id, int priority); IBookletPage generateTextPage(int id, int priority);
//
// IBookletPage generatePicturePage(int id, ResourceLocation resLoc, int textStartY, int priority); IBookletPage generatePicturePage(int id, ResourceLocation resLoc, int textStartY, int priority);
//
// IBookletPage generateCraftingPage(int id, int priority, IRecipe... recipes); IBookletPage generateCraftingPage(int id, int priority, IRecipe... recipes);
//
// IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result, int priority); IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result, int priority);
//
// IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, int priority, IBookletPage... pages); IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, int priority, IBookletPage... pages);
//
// IBookletChapter createTrial(String identifier, ItemStack displayStack, boolean textOnSecondPage); IBookletChapter createTrial(String identifier, ItemStack displayStack, boolean textOnSecondPage);
} }

View file

@ -48,7 +48,8 @@ public class ActuallyAdditionsClient {
ScreenManager.register(ActuallyContainers.FIREWORK_BOX_CONTAINER.get(), GuiFireworkBox::new); ScreenManager.register(ActuallyContainers.FIREWORK_BOX_CONTAINER.get(), GuiFireworkBox::new);
ScreenManager.register(ActuallyContainers.FLUID_COLLECTOR_CONTAINER.get(), GuiFluidCollector::new); ScreenManager.register(ActuallyContainers.FLUID_COLLECTOR_CONTAINER.get(), GuiFluidCollector::new);
ScreenManager.register(ActuallyContainers.FURNACE_DOUBLE_CONTAINER.get(), GuiFurnaceDouble::new); ScreenManager.register(ActuallyContainers.FURNACE_DOUBLE_CONTAINER.get(), GuiFurnaceDouble::new);
ScreenManager.register(ActuallyContainers.GRINDER_CONTAINER.get(), CrusherScreen::new); ScreenManager.register(ActuallyContainers.GRINDER_CONTAINER.get(), GuiGrinder::new);
ScreenManager.register(ActuallyContainers.INPUTTER_CONTAINER.get(), GuiInputter::new);
ScreenManager.register(ActuallyContainers.LASER_RELAY_ITEM_WHITELIST_CONTAINER.get(), GuiLaserRelayItemWhitelist::new); ScreenManager.register(ActuallyContainers.LASER_RELAY_ITEM_WHITELIST_CONTAINER.get(), GuiLaserRelayItemWhitelist::new);
ScreenManager.register(ActuallyContainers.MINER_CONTAINER.get(), GuiMiner::new); ScreenManager.register(ActuallyContainers.MINER_CONTAINER.get(), GuiMiner::new);
ScreenManager.register(ActuallyContainers.OIL_GENERATOR_CONTAINER.get(), GuiOilGenerator::new); ScreenManager.register(ActuallyContainers.OIL_GENERATOR_CONTAINER.get(), GuiOilGenerator::new);
@ -81,7 +82,7 @@ public class ActuallyAdditionsClient {
} }
// TODO: [port] validate that this works // TODO: [port] validate that this works
public static void sendBreakPacket(BlockPos pos) { public void sendBreakPacket(BlockPos pos) {
ClientPlayNetHandler connection = Minecraft.getInstance().getConnection(); ClientPlayNetHandler connection = Minecraft.getInstance().getConnection();
assert connection != null; assert connection != null;
assert Minecraft.getInstance().hitResult != null; assert Minecraft.getInstance().hitResult != null;

View file

@ -21,6 +21,8 @@ import net.minecraft.block.BlockState;
import net.minecraft.client.MainWindow; import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.PlayerEntity; 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.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -37,6 +39,7 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.network.NetworkHooks;
public class BlockPhantom extends BlockContainerBase implements IHudDisplay { public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
@ -104,14 +107,14 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
if (this.tryToggleRedstone(world, pos, player)) { if (this.tryToggleRedstone(world, pos, player)) {
return ActionResultType.PASS; return ActionResultType.PASS;
} }
/*
if (!world.isClientSide) { if (!world.isClientSide) {
TileEntity tile = world.getBlockEntity(pos); TileEntity tile = world.getBlockEntity(pos);
if (tile instanceof IPhantomTile && ((IPhantomTile) tile).getGuiID() != -1) { if (tile instanceof IPhantomTile && ((IPhantomTile) tile).getGuiID() != -1) {
NetworkHooks.openGui((ServerPlayerEntity) player, (INamedContainerProvider) tile, pos); NetworkHooks.openGui((ServerPlayerEntity) player, (INamedContainerProvider) tile, pos);
} }
} }
*/
return ActionResultType.PASS; return ActionResultType.PASS;
} }

View file

@ -29,7 +29,8 @@ 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<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<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<ContainerFurnaceDouble>> FURNACE_DOUBLE_CONTAINER = CONTAINERS.register("furnace_double_container", () -> IForgeContainerType.create(ContainerFurnaceDouble::fromNetwork));
public static final RegistryObject<ContainerType<CrusherContainer>> GRINDER_CONTAINER = CONTAINERS.register("grinder_container", () -> IForgeContainerType.create(CrusherContainer::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<ContainerLaserRelayItemWhitelist>> LASER_RELAY_ITEM_WHITELIST_CONTAINER = CONTAINERS.register("laser_relay_item_whitelist_container", () -> IForgeContainerType.create(ContainerLaserRelayItemWhitelist::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<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)); public static final RegistryObject<ContainerType<ContainerOilGenerator>> OIL_GENERATOR_CONTAINER = CONTAINERS.register("oil_generator_container", () -> IForgeContainerType.create(ContainerOilGenerator::fromNetwork));

View file

@ -22,11 +22,11 @@ import net.minecraft.network.PacketBuffer;
import java.util.Objects; import java.util.Objects;
public class CrusherContainer extends Container { public class ContainerGrinder extends Container {
public final TileEntityCrusher tileGrinder; public final TileEntityCrusher tileGrinder;
public final boolean isDouble; public final boolean isDouble;
public CrusherContainer(int windowId, PlayerInventory inventory, TileEntityCrusher tile) { public ContainerGrinder(int windowId, PlayerInventory inventory, TileEntityCrusher tile) {
super(ActuallyContainers.GRINDER_CONTAINER.get(), windowId); super(ActuallyContainers.GRINDER_CONTAINER.get(), windowId);
this.tileGrinder = tile; this.tileGrinder = tile;
this.isDouble = tile.isDouble; this.isDouble = tile.isDouble;
@ -56,8 +56,8 @@ public class CrusherContainer extends Container {
} }
} }
public static CrusherContainer fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { public static ContainerGrinder fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
return new CrusherContainer(windowId, inv, (TileEntityCrusher) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); return new ContainerGrinder(windowId, inv, (TileEntityCrusher) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos())));
} }
@Override @Override

View file

@ -8,7 +8,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -31,32 +30,31 @@ public class Buttons {
} }
@Override @Override
public void render(MatrixStack matrixStack, int x, int y, float f) { public void render(MatrixStack matrices, int x, int y, float f) {
if (this.visible) { if (this.visible) {
Minecraft.getInstance().getTextureManager().bind(this.resLoc); Minecraft.getInstance().getTextureManager().bind(this.resLoc);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); 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; this.isHovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height;
int k = this.getYImage(this.isHovered); int k = this.getHoverState(this.hovered);
GlStateManager._enableBlend(); GlStateManager._enableBlend();
GlStateManager.glBlendFuncSeparate(770, 771, 1, 0); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager._blendFunc(770, 771); GlStateManager._blendFunc(770, 771);
this.blit(matrixStack, this.x, this.y, this.smaller this.blit(matrices, this.x, this.y, this.smaller
? 200 ? 200
: 176, k * this.height, this.width, this.height); : 176, k * this.height, this.width, this.height);
//this.mouseDragged(mc, x, y); // The heck was this doing here? this.mouseDragged(mc, x, y);
int color = 14737632; int color = 14737632;
if (this.packedFGColor != 0) { if (this.packedFGColour != 0) {
color = this.packedFGColor; color = this.packedFGColour;
} else if (!this.active) { } else if (!this.enabled) {
color = 10526880; color = 10526880;
} else if (this.isHovered) { } else if (this.hovered) {
color = 16777120; color = 16777120;
} }
drawCenteredString(matrixStack, Minecraft.getInstance().font, this.getMessage().getString(), this.x + this.width / 2, this.y + (this.height - 8) / 2, color); this.drawCenteredString(mc.fontRenderer, this.displayString, this.x + this.width / 2, this.y + (this.height - 8) / 2, color);
} }
} }
} }
@ -66,21 +64,21 @@ public class Buttons {
public final ResourceLocation resLoc = AssetUtil.getGuiLocation("gui_inputter"); public final ResourceLocation resLoc = AssetUtil.getGuiLocation("gui_inputter");
public TinyButton(int id, int x, int y) { public TinyButton(int id, int x, int y) {
super(x, y, 8, 8, new StringTextComponent(""), Button::onPress); super(id, x, y, 8, 8, "");
} }
@Override @Override
public void render(MatrixStack matrixStack, int x, int y, float f) { public void drawButton(Minecraft mc, int x, int y, float f) {
if (this.visible) { if (this.visible) {
Minecraft.getInstance().getTextureManager().bind(this.resLoc); mc.getTextureManager().bind(this.resLoc);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); 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; this.hovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height;
int k = this.getYImage(this.isHovered); int k = this.getHoverState(this.hovered);
GlStateManager._enableBlend(); GlStateManager._enableBlend();
GlStateManager.glBlendFuncSeparate(770, 771, 1, 0); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager._blendFunc(770, 771); GlStateManager._blendFunc(770, 771);
this.blit(matrixStack, this.x, this.y, 192, k * 8, 8, 8); this.blit(matrices, this.x, this.y, 192, k * 8, 8, 8);
//this.mouseDragged(mc, x, y); this.mouseDragged(mc, x, y);
} }
} }
} }

View file

@ -18,7 +18,6 @@ import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -39,19 +38,19 @@ public class FilterSettingsGui extends AbstractGui {
public FilterSettingsGui(FilterSettings settings, int x, int y, List<Button> buttonList) { public FilterSettingsGui(FilterSettings settings, int x, int y, List<Button> buttonList) {
this.theSettings = settings; this.theSettings = settings;
this.whitelistButton = new Buttons.SmallerButton( x, y, new TranslationTextComponent(""), true, Button::onPress); //TODO these need translation keys this.whitelistButton = new Buttons.SmallerButton(this.theSettings.whitelistButtonId, x, y, true);
buttonList.add(this.whitelistButton); buttonList.add(this.whitelistButton);
y += 14; y += 14;
this.metaButton = new Buttons.SmallerButton( x, y, new TranslationTextComponent(""), true, Button::onPress); //TODO also button actions this.metaButton = new Buttons.SmallerButton(this.theSettings.metaButtonId, x, y, true);
buttonList.add(this.metaButton); buttonList.add(this.metaButton);
y += 14; y += 14;
this.nbtButton = new Buttons.SmallerButton( x, y, new TranslationTextComponent(""), true, Button::onPress); this.nbtButton = new Buttons.SmallerButton(this.theSettings.nbtButtonId, x, y, true);
buttonList.add(this.nbtButton); buttonList.add(this.nbtButton);
y += 14; y += 14;
this.oredictButton = new Buttons.SmallerButton( x, y, new TranslationTextComponent(""), true, Button::onPress); this.oredictButton = new Buttons.SmallerButton(this.theSettings.oredictButtonId, x, y, true);
buttonList.add(this.oredictButton); buttonList.add(this.oredictButton);
y += 15; y += 15;
this.modButton = new Buttons.SmallerButton( x, y, new TranslationTextComponent(""), true, Button::onPress); this.modButton = new Buttons.SmallerButton(this.theSettings.modButtonId, x, y, true);
buttonList.add(this.modButton); buttonList.add(this.modButton);
this.tick(); this.tick();
@ -104,7 +103,7 @@ public class FilterSettingsGui extends AbstractGui {
//list.addAll(mc.font.listFormattedStringToWidth(StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectModInfo"), 200)); //list.addAll(mc.font.listFormattedStringToWidth(StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectModInfo"), 200));
//GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font); //GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font);
} else if (this.oredictButton.isMouseOver(mouseX, mouseY)) { } else if (this.oredictButton.isMouseOver()) {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
list.add(TextFormatting.BOLD + (this.theSettings.respectOredict == 0 list.add(TextFormatting.BOLD + (this.theSettings.respectOredict == 0
? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreOredict") ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreOredict")

View file

@ -11,6 +11,9 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack; 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.Minecraft;
import net.minecraft.client.gui.AbstractGui; import net.minecraft.client.gui.AbstractGui;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
@ -18,11 +21,16 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fluids.FluidStack; 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) @OnlyIn(Dist.CLIENT)
public class FluidDisplay extends AbstractGui { public class FluidDisplay extends AbstractGui {
private FluidStack fluidReference; private FluidTank fluidReference;
private Fluid oldFluid; private Fluid oldFluid;
private int x; private int x;
@ -33,15 +41,15 @@ public class FluidDisplay extends AbstractGui {
private boolean drawTextNextTo; private boolean drawTextNextTo;
public FluidDisplay(int x, int y, FluidStack fluidReference, boolean outline, boolean drawTextNextTo) { public FluidDisplay(int x, int y, FluidTank fluidReference, boolean outline, boolean drawTextNextTo) {
this.setData(x, y, fluidReference, outline, drawTextNextTo); this.setData(x, y, fluidReference, outline, drawTextNextTo);
} }
public FluidDisplay(int x, int y, FluidStack fluidReference) { public FluidDisplay(int x, int y, FluidTank fluidReference) {
this(x, y, fluidReference, false, false); this(x, y, fluidReference, false, false);
} }
public void setData(int x, int y, FluidStack fluidReference, boolean outline, boolean drawTextNextTo) { public void setData(int x, int y, FluidTank fluidReference, boolean outline, boolean drawTextNextTo) {
this.x = x; this.x = x;
this.y = y; this.y = y;
this.fluidReference = fluidReference; this.fluidReference = fluidReference;
@ -50,7 +58,7 @@ public class FluidDisplay extends AbstractGui {
} }
public void draw(MatrixStack matrices) { public void draw(MatrixStack matrices) {
/* Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
mc.getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); mc.getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION);
int barX = this.x; int barX = this.x;
@ -93,7 +101,7 @@ public class FluidDisplay extends AbstractGui {
if (this.drawTextNextTo) { if (this.drawTextNextTo) {
this.drawString(mc.font, this.getOverlayText(), barX + 25, barY + 78, StringUtil.DECIMAL_COLOR_WHITE); this.drawString(mc.font, this.getOverlayText(), barX + 25, barY + 78, StringUtil.DECIMAL_COLOR_WHITE);
}*/ }
} }
public void render(MatrixStack matrices, int mouseX, int mouseY) { public void render(MatrixStack matrices, int mouseX, int mouseY) {
@ -103,17 +111,16 @@ public class FluidDisplay extends AbstractGui {
? 93 ? 93
: 85)) { : 85)) {
Minecraft mc = Minecraft.getInstance(); 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() { private String getOverlayText() {
/* NumberFormat format = NumberFormat.getInstance(); NumberFormat format = NumberFormat.getInstance();
FluidStack stack = this.fluidReference.getFluid(); FluidStack stack = this.fluidReference.getFluid();
String cap = format.format(this.fluidReference.getCapacity()); String cap = format.format(this.fluidReference.getCapacity());
return stack == null || stack.getFluid() == null return stack == null || stack.getFluid() == null
? "0/" + cap + " mB" ? "0/" + cap + " mB"
: format.format(this.fluidReference.getFluidAmount()) + "/" + cap + " mB " + stack.getLocalizedName();*/ : format.format(this.fluidReference.getFluidAmount()) + "/" + cap + " mB " + stack.getLocalizedName();
return "";
} }
} }

View file

@ -12,12 +12,23 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerBag; 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.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent; 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> { public class GuiBag extends GuiWtfMojang<ContainerBag> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_bag"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_bag");
@ -40,22 +51,22 @@ public class GuiBag extends GuiWtfMojang<ContainerBag> {
public void init() { public void init() {
super.init(); super.init();
// this.filter = new FilterSettingsGui(this.container.filter, this.leftPos + 138, this.topPos + 10, this.buttons); 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 this.buttonAutoInsert = new Button(0, this.leftPos - 21, this.topPos + 8, 20, 20, (this.container.autoInsert
// ? TextFormatting.DARK_GREEN ? TextFormatting.DARK_GREEN
// : TextFormatting.RED) + "I"); : TextFormatting.RED) + "I");
this.addButton(this.buttonAutoInsert); this.addButton(this.buttonAutoInsert);
} }
// @Override @Override
// protected void actionPerformed(Button button) throws IOException { protected void actionPerformed(Button button) throws IOException {
// CompoundNBT data = new CompoundNBT(); CompoundNBT data = new CompoundNBT();
// data.putInt("ButtonID", button.id); data.putInt("ButtonID", button.id);
// data.putInt("PlayerID", Minecraft.getInstance().player.getId()); data.putInt("PlayerID", Minecraft.getInstance().player.getId());
// data.putInt("WorldID", Minecraft.getInstance().level.provider.getDimension()); data.putInt("WorldID", Minecraft.getInstance().level.provider.getDimension());
// PacketHandler.THE_NETWORK.sendToServer(new PacketClientToServer(data, PacketHandler.GUI_BUTTON_TO_CONTAINER_HANDLER)); PacketHandler.THE_NETWORK.sendToServer(new PacketClientToServer(data, PacketHandler.GUI_BUTTON_TO_CONTAINER_HANDLER));
// } }
@Override @Override
public void tick() { public void tick() {
@ -67,19 +78,19 @@ public class GuiBag extends GuiWtfMojang<ContainerBag> {
// : TextFormatting.RED) + "I"; // : TextFormatting.RED) + "I";
} }
/* @Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(int x, int y) {
AssetUtil.displayNameString(this.font, this.imageWidth, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + "." + (this.isVoid AssetUtil.displayNameString(this.font, this.imageWidth, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + "." + (this.isVoid
? "voidBag" ? "voidBag"
: "bag") + ".name")); : "bag") + ".name"));
}*/ }
@Override @Override
public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks) { public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
super.render(stack, mouseX, mouseY, partialTicks); super.render(stack, mouseX, mouseY, partialTicks);
this.filter.drawHover(mouseX, mouseY); this.filter.drawHover(mouseX, mouseY);
/* if (this.buttonAutoInsert.isMouseOver()) { if (this.buttonAutoInsert.isMouseOver()) {
List<String> text = new ArrayList<>(); List<String> text = new ArrayList<>();
text.add(TextFormatting.BOLD + "Auto-Insert " + (this.container.autoInsert text.add(TextFormatting.BOLD + "Auto-Insert " + (this.container.autoInsert
? "On" ? "On"
@ -87,7 +98,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("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)); 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); this.renderToolTip(stack, text, mouseX, mouseY, this.getMinecraft().font);
}*/ }
} }
@Override @Override

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerBioReactor; import de.ellpeck.actuallyadditions.mod.inventory.ContainerBioReactor;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBioReactor; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBioReactor;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -42,7 +41,7 @@ public class GuiBioReactor extends GuiWtfMojang<ContainerBioReactor> {
@Override @Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) { public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
super.render(matrices, mouseX, mouseY, partialTicks); super.render(matrices, mouseX, mouseY, partialTicks);
//this.energy.render(mouseX, mouseY); this.energy.render(mouseX, mouseY);
} }
@Override @Override
@ -69,6 +68,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); drawCenteredString(matrices, this.font, this.tile.producePerTick + " " + I18n.get("actuallyadditions.cft"), this.leftPos + 87, this.topPos + 86, 0xFFFFFF);
} }
//this.energy.draw(); this.energy.draw();
} }
} }

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCanolaPress; import de.ellpeck.actuallyadditions.mod.inventory.ContainerCanolaPress;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -39,8 +38,8 @@ public class GuiCanolaPress extends GuiWtfMojang<ContainerCanolaPress> {
@Override @Override
public void init() { public void init() {
super.init(); super.init();
//this.energy = new EnergyDisplay(this.leftPos + 42, this.topPos + 5, this.press.storage); 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.fluid = new FluidDisplay(this.leftPos + 116, this.topPos + 5, this.press.tank);
} }
@Override @Override

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCoalGenerator; import de.ellpeck.actuallyadditions.mod.inventory.ContainerCoalGenerator;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;

View file

@ -14,15 +14,19 @@ import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCoffeeMachine; 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.tile.TileEntityCoffeeMachine;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import java.util.Collections;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiCoffeeMachine extends GuiWtfMojang<ContainerCoffeeMachine> { public class GuiCoffeeMachine extends GuiWtfMojang<ContainerCoffeeMachine> {
@ -43,11 +47,11 @@ public class GuiCoffeeMachine extends GuiWtfMojang<ContainerCoffeeMachine> {
public void init() { public void init() {
super.init(); super.init();
// Button buttonOkay = new Button(this.leftPos + 60, this.topPos + 11, 58, 20, StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ok")); Button buttonOkay = new Button(this.leftPos + 60, this.topPos + 11, 58, 20, StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ok"));
// this.addButton(buttonOkay); this.addButton(buttonOkay);
//
// this.energy = new EnergyDisplay(this.leftPos + 16, this.topPos + 5, this.machine.storage); 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); this.fluid = new FluidDisplay(this.leftPos - 30, this.topPos + 1, this.machine.tank, true, false);
} }
@Override @Override
@ -56,7 +60,7 @@ public class GuiCoffeeMachine extends GuiWtfMojang<ContainerCoffeeMachine> {
String text2 = this.machine.coffeeCacheAmount + "/" + TileEntityCoffeeMachine.COFFEE_CACHE_MAX_AMOUNT + " " + StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.coffee"); 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) { 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); this.energy.render(matrices, x, y);
@ -95,8 +99,8 @@ public class GuiCoffeeMachine extends GuiWtfMojang<ContainerCoffeeMachine> {
this.fluid.draw(matrices); this.fluid.draw(matrices);
} }
// @Override @Override
// public void actionPerformed(Button button) { public void actionPerformed(Button button) {
// PacketHandlerHelper.sendButtonPacket(this.machine, button.id); PacketHandlerHelper.sendButtonPacket(this.machine, button.id);
// } }
} }

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerDirectionalBreaker; import de.ellpeck.actuallyadditions.mod.inventory.ContainerDirectionalBreaker;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLongRangeBreaker; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLongRangeBreaker;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerDrill; import de.ellpeck.actuallyadditions.mod.inventory.ContainerDrill;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerDropper; import de.ellpeck.actuallyadditions.mod.inventory.ContainerDropper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper; import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnergizer; import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnergizer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnervator; import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnervator;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFarmer; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFarmer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFeeder; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFeeder;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder;
@ -23,6 +22,8 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import java.util.Arrays;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiFeeder extends GuiWtfMojang<ContainerFeeder> { public class GuiFeeder extends GuiWtfMojang<ContainerFeeder> {
@ -45,7 +46,7 @@ public class GuiFeeder extends GuiWtfMojang<ContainerFeeder> {
: this.tileFeeder.currentAnimalAmount >= TileEntityFeeder.THRESHOLD : this.tileFeeder.currentAnimalAmount >= TileEntityFeeder.THRESHOLD
? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.tooMany") ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.tooMany")
: StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.notEnough")}; : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.notEnough")};
//this.drawHoveringText(Arrays.asList(array), x, y); this.drawHoveringText(Arrays.asList(array), x, y);
} }
} }

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFermentingBarrel; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFermentingBarrel;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -47,8 +46,8 @@ public class GuiFermentingBarrel extends GuiWtfMojang<ContainerFermentingBarrel>
@Override @Override
public void init() { public void init() {
super.init(); super.init();
this.input = new FluidDisplay(this.leftPos + 60, this.topPos + 5, this.press.tanks.canolaTank); 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.tanks.oilTank); this.output = new FluidDisplay(this.leftPos + 98, this.topPos + 5, this.press.oilTank);
} }
@Override @Override

View file

@ -46,7 +46,7 @@ public class GuiFluidCollector extends GuiWtfMojang<ContainerFluidCollector> {
@Override @Override
public void init() { public void init() {
super.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 @Override

View file

@ -12,9 +12,12 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFurnaceDouble; 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.tile.TileEntityPoweredFurnace;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; 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.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@ -24,6 +27,9 @@ import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import java.io.IOException;
import java.util.Collections;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiFurnaceDouble extends GuiWtfMojang<ContainerFurnaceDouble> { public class GuiFurnaceDouble extends GuiWtfMojang<ContainerFurnaceDouble> {
@ -45,11 +51,11 @@ public class GuiFurnaceDouble extends GuiWtfMojang<ContainerFurnaceDouble> {
super.render(matrices, x, y, f); super.render(matrices, x, y, f);
this.energy.render(matrices, x, y); this.energy.render(matrices, x, y);
// if (this.buttonAutoSplit.isMouseOver(x, y)) { if (this.buttonAutoSplit.isMouseOver(x, y)) {
// this.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.tileFurnace.isAutoSplit this.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.tileFurnace.isAutoSplit
// ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.on") ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.on")
// : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.off"))), x, y); : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.off"))), x, y);
// } }
} }
@Override @Override
@ -57,8 +63,8 @@ public class GuiFurnaceDouble extends GuiWtfMojang<ContainerFurnaceDouble> {
super.init(); super.init();
this.energy = new EnergyDisplay(this.leftPos + 27, this.topPos + 5, this.tileFurnace.storage); 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.buttonAutoSplit = new GuiInputter.SmallerButton(0, this.leftPos, this.topPos, "S");
// this.addButton(this.buttonAutoSplit); this.addButton(this.buttonAutoSplit);
} }
@ -71,12 +77,12 @@ public class GuiFurnaceDouble extends GuiWtfMojang<ContainerFurnaceDouble> {
: TextFormatting.RED)); : TextFormatting.RED));
} }
// @Override @Override
// protected void actionPerformed(Button button) throws IOException { protected void actionPerformed(Button button) throws IOException {
// if (button.id == 0) { if (button.id == 0) {
// PacketHandlerHelper.sendButtonPacket(this.tileFurnace, button.id); PacketHandlerHelper.sendButtonPacket(this.tileFurnace, button.id);
// } }
// } }
@Override @Override
public void renderLabels(MatrixStack matrices, int x, int y) { public void renderLabels(MatrixStack matrices, int x, int y) {

View file

@ -12,22 +12,26 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.CrusherContainer; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerGrinder;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCrusher; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCrusher;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; 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.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import java.io.IOException;
import java.util.Collections;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class CrusherScreen extends GuiWtfMojang<CrusherContainer> { public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_grinder"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_grinder");
private static final ResourceLocation RES_LOC_DOUBLE = AssetUtil.getGuiLocation("gui_grinder_double"); private static final ResourceLocation RES_LOC_DOUBLE = AssetUtil.getGuiLocation("gui_grinder_double");
@ -37,7 +41,7 @@ public class CrusherScreen extends GuiWtfMojang<CrusherContainer> {
private Button buttonAutoSplit; private Button buttonAutoSplit;
public CrusherScreen(CrusherContainer container, PlayerInventory inventory, ITextComponent title) { public GuiGrinder(ContainerGrinder container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory); super(container, inventory);
this.tileGrinder = container.tileGrinder; this.tileGrinder = container.tileGrinder;
this.isDouble = container.isDouble; this.isDouble = container.isDouble;
@ -53,14 +57,15 @@ public class CrusherScreen extends GuiWtfMojang<CrusherContainer> {
: 42), this.topPos + 5, this.tileGrinder.storage); : 42), this.topPos + 5, this.tileGrinder.storage);
if (this.isDouble) { if (this.isDouble) {
this.buttonAutoSplit = new Buttons.SmallerButton( this.leftPos - 10, this.topPos, new StringTextComponent("S"), (button) -> actionPerformed(0)); this.buttonAutoSplit = new GuiInputter.SmallerButton(0, this.leftPos - 10, this.topPos, "S");
this.addButton(this.buttonAutoSplit); this.addButton(this.buttonAutoSplit);
} }
} }
protected void actionPerformed(int id) { @Override
if (this.isDouble && id == 0) { protected void actionPerformed(Button button) throws IOException {
PacketHandlerHelper.sendButtonPacket(this.tileGrinder, id); if (this.isDouble && button.id == 0) {
PacketHandlerHelper.sendButtonPacket(this.tileGrinder, button.id);
} }
} }
@ -76,13 +81,15 @@ public class CrusherScreen extends GuiWtfMojang<CrusherContainer> {
} }
@Override @Override
public void render(MatrixStack matrixStack, int x, int y, float f) { public void render(MatrixStack matrices, int x, int y, float f) {
super.render(matrixStack, x, y, f); super.render(matrices, x, y, f);
this.energy.render(matrixStack, x, y); this.energy.render(matrices, x, y);
if (this.isDouble && this.buttonAutoSplit.isMouseOver(x,y)) { if (this.isDouble && this.buttonAutoSplit.isMouseOver()) {
drawString(matrixStack, font, new TranslationTextComponent("info.actuallyadditions.gui.autosplititems." + (tileGrinder.isAutoSplit?"on":"off")).withStyle(TextFormatting.BOLD), x , y, 0xffffff); 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);
} }
} }
@ -119,10 +126,10 @@ public class CrusherScreen extends GuiWtfMojang<CrusherContainer> {
this.energy.draw(matrices); this.energy.draw(matrices);
} }
public static class CrusherDoubleScreen extends CrusherScreen { public static class GuiGrinderDouble extends GuiGrinder {
public CrusherDoubleScreen(CrusherContainer crusherContainer, PlayerInventory inventory, ITextComponent tile) { public GuiGrinderDouble(ContainerGrinder containerGrinder, PlayerInventory inventory, ITextComponent tile) {
super(crusherContainer, inventory, tile); super(containerGrinder, inventory, tile);
} }
} }
} }

View file

@ -14,6 +14,7 @@ import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerLaserRelayItemWhitelist; 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.tile.TileEntityLaserRelayItemAdvanced;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
@ -21,9 +22,13 @@ import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import java.util.ArrayList;
import java.util.List;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiLaserRelayItemWhitelist extends GuiWtfMojang<ContainerLaserRelayItemWhitelist> { public class GuiLaserRelayItemWhitelist extends GuiWtfMojang<ContainerLaserRelayItemWhitelist> {
@ -55,30 +60,30 @@ public class GuiLaserRelayItemWhitelist extends GuiWtfMojang<ContainerLaserRelay
public void init() { public void init() {
super.init(); super.init();
// this.leftFilter = new FilterSettingsGui(this.tile.leftFilter, this.leftPos + 3, this.topPos + 6, this.buttonList); 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.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.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.buttonSmartWhitelistRight = new Buttons.SmallerButton(3, this.leftPos + 157, this.topPos + 79, "S");
// this.addButton(this.buttonSmartWhitelistLeft); this.addButton(this.buttonSmartWhitelistLeft);
// this.addButton(this.buttonSmartWhitelistRight); this.addButton(this.buttonSmartWhitelistRight);
}
@Override
public void actionPerformed(Button button) {
PacketHandlerHelper.sendButtonPacket(this.tile, button.id);
} }
//
// @Override
// public void actionPerformed(Button button) {
// PacketHandlerHelper.sendButtonPacket(this.tile, button.id);
// }
@Override @Override
public void render(MatrixStack matrices, int x, int y, float f) { public void render(MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f); super.render(matrices, x, y, f);
//
// if (this.buttonSmartWhitelistLeft.isMouseOver() || this.buttonSmartWhitelistRight.isMouseOver()) { if (this.buttonSmartWhitelistLeft.isMouseOver() || this.buttonSmartWhitelistRight.isMouseOver()) {
// List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
// list.add(TextFormatting.BOLD + StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.smart")); list.add(TextFormatting.BOLD + StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.smart"));
// list.addAll(this.font.listFormattedStringToWidth(StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.smartInfo"), 200)); list.addAll(this.font.listFormattedStringToWidth(StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.smartInfo"), 200));
// this.drawHoveringText(list, x, y); this.drawHoveringText(list, x, y);
// } }
this.leftFilter.drawHover(x, y); this.leftFilter.drawHover(x, y);
this.rightFilter.drawHover(x, y); this.rightFilter.drawHover(x, y);

View file

@ -13,9 +13,11 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerMiner; 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.tile.TileEntityVerticalDigger;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
@ -40,13 +42,13 @@ public class GuiMiner extends GuiWtfMojang<ContainerMiner> {
public void init() { public void init() {
super.init(); super.init();
// Button buttonMode = new Button(this.leftPos + this.imageWidth / 2 - 51, this.topPos + 75, 50, 20, "Mode", button -> { Button buttonMode = new Button(this.leftPos + this.imageWidth / 2 - 51, this.topPos + 75, 50, 20, "Mode", button -> {
// }); });
// this.addButton(buttonMode); this.addButton(buttonMode);
//
// Button buttonReset = new Button(this.leftPos + this.imageWidth / 2 + 1, this.topPos + 75, 50, 20, "Reset", button -> { Button buttonReset = new Button(this.leftPos + this.imageWidth / 2 + 1, this.topPos + 75, 50, 20, "Reset", button -> {
// }); });
// this.addButton(buttonReset); this.addButton(buttonReset);
} }
@Override @Override
@ -70,8 +72,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); this.font.draw(matrices, mining, this.leftPos + this.imageWidth / 2 - this.font.width(mining) / 2, this.topPos + 8, StringUtil.DECIMAL_COLOR_GRAY_TEXT);
} }
// @Override @Override
// public void actionPerformed(Button button) { public void actionPerformed(Button button) {
// PacketHandlerHelper.sendButtonPacket(this.miner, button.id); PacketHandlerHelper.sendButtonPacket(this.miner, button.id);
// } }
} }

View file

@ -43,8 +43,8 @@ public class GuiOilGenerator extends GuiWtfMojang<ContainerOilGenerator> {
@Override @Override
public void init() { public void init() {
super.init(); super.init();
//this.energy = new EnergyDisplay(this.leftPos + 42, this.topPos + 5, this.generator.storage); 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.fluid = new FluidDisplay(this.leftPos + 116, this.topPos + 5, this.generator.tank);
} }
@Override @Override

View file

@ -12,15 +12,24 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerPhantomPlacer; 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.tile.TileEntityPhantomPlacer;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; 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.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiPhantomPlacer extends GuiWtfMojang<ContainerPhantomPlacer> { public class GuiPhantomPlacer extends GuiWtfMojang<ContainerPhantomPlacer> {
@ -38,44 +47,44 @@ public class GuiPhantomPlacer extends GuiWtfMojang<ContainerPhantomPlacer> {
public void init() { public void init() {
super.init(); super.init();
// if (!this.placer.isBreaker) { if (!this.placer.isBreaker) {
// this.addButton(new Button(0, this.leftPos + 63, this.topPos + 75, 50, 20, this.getSide())); this.addButton(new Button(0, this.leftPos + 63, this.topPos + 75, 50, 20, this.getSide()));
// } }
} }
@Override @Override
public void tick() { public void tick() {
super.tick(); super.tick();
// if (!this.placer.isBreaker) { if (!this.placer.isBreaker) {
// this.buttonList.get(0).displayString = this.getSide(); this.buttonList.get(0).displayString = this.getSide();
// } }
} }
@Override @Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) { public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
super.render(matrices, mouseX, mouseY, partialTicks); super.render(matrices, mouseX, mouseY, partialTicks);
// if (!this.placer.isBreaker && this.buttonList.get(0).isMouseOver()) { if (!this.placer.isBreaker && this.buttonList.get(0).isMouseOver()) {
// String loc = "info." + ActuallyAdditions.MODID + ".placer.sides"; String loc = "info." + ActuallyAdditions.MODID + ".placer.sides";
//
// List<String> textList = new ArrayList<>(); List<String> textList = new ArrayList<>();
// textList.add(TextFormatting.GOLD + StringUtil.localize(loc + ".1")); textList.add(TextFormatting.GOLD + StringUtil.localize(loc + ".1"));
// textList.addAll(this.font.listFormattedStringToWidth(StringUtil.localize(loc + ".2"), 200)); textList.addAll(this.font.listFormattedStringToWidth(StringUtil.localize(loc + ".2"), 200));
// this.drawHoveringText(textList, mouseX, mouseY); this.drawHoveringText(textList, mouseX, mouseY);
// } }
} }
// @Override @Override
// protected void actionPerformed(Button button) throws IOException { protected void actionPerformed(Button button) throws IOException {
// if (!this.placer.isBreaker) { if (!this.placer.isBreaker) {
// PacketHandlerHelper.sendButtonPacket(this.placer, button.id); PacketHandlerHelper.sendButtonPacket(this.placer, button.id);
// } }
// } }
// private String getSide() { private String getSide() {
// return GuiInputter.SIDES[this.placer.side + 1]; return GuiInputter.SIDES[this.placer.side + 1];
// } }
@Override @Override
public void renderLabels(MatrixStack matrices, int x, int y) { public void renderLabels(MatrixStack matrices, int x, int y) {

View file

@ -13,8 +13,10 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerRangedCollector; 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.tile.TileEntityRangedCollector;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
@ -41,14 +43,14 @@ public class GuiRangedCollector extends GuiWtfMojang<ContainerRangedCollector> {
public void init() { public void init() {
super.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 @Override
public void render(MatrixStack matrices, int x, int y, float f) { public void render(MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f); super.render(matrices, x, y, f);
//this.filter.drawHover(matrices, x, y); this.filter.drawHover(matrices, x, y);
} }
@Override @Override
@ -74,8 +76,8 @@ public class GuiRangedCollector extends GuiWtfMojang<ContainerRangedCollector> {
this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 86); this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 86);
} }
// @Override @Override
// public void actionPerformed(Button button) { public void actionPerformed(Button button) {
// PacketHandlerHelper.sendButtonPacket(this.collector, button.id); PacketHandlerHelper.sendButtonPacket(this.collector, button.id);
// } }
} }

View file

@ -13,12 +13,16 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerXPSolidifier; 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.tile.TileEntityXPSolidifier;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; 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.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -39,35 +43,35 @@ public class GuiXPSolidifier extends GuiWtfMojang<ContainerXPSolidifier> {
@Override @Override
public void init() { public void init() {
super.init(); super.init();
//
// Button buttonOne = new GuiInputter.SmallerButton(this.leftPos + 62, this.topPos + 44, new StringTextComponent("1"), btn -> { 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 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 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 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 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 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 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 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 -> { Button buttonAll = new GuiInputter.SmallerButton(this.leftPos + 99, this.topPos + 78, new StringTextComponent("All"), btn -> {
// }); });
//
// this.addButton(buttonOne); this.addButton(buttonOne);
// this.addButton(buttonFive); this.addButton(buttonFive);
// this.addButton(buttonTen); this.addButton(buttonTen);
// this.addButton(buttonTwenty); this.addButton(buttonTwenty);
// this.addButton(buttonThirty); this.addButton(buttonThirty);
// this.addButton(buttonForty); this.addButton(buttonForty);
// this.addButton(buttonFifty); this.addButton(buttonFifty);
// this.addButton(buttonSixtyFour); this.addButton(buttonSixtyFour);
// this.addButton(buttonAll); this.addButton(buttonAll);
} }
@Override @Override
@ -88,10 +92,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); drawCenteredString(matrices, this.font, Integer.toString(this.solidifier.amount), this.leftPos + 88, this.topPos + 30, StringUtil.DECIMAL_COLOR_WHITE);
} }
// @Override @Override
// public void actionPerformed(Button button) { public void actionPerformed(Button button) {
// PacketHandlerHelper.sendButtonPacket(this.solidifier, button.id); PacketHandlerHelper.sendButtonPacket(this.solidifier, button.id);
//
// this.solidifier.onButtonPressed(button.id, Minecraft.getInstance().player); this.solidifier.onButtonPressed(button.id, Minecraft.getInstance().player);
// } }
} }

View file

@ -12,17 +12,17 @@ package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.items.base.ItemArmorAA; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.items.base.*;
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.lens.ItemLens;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
import de.ellpeck.actuallyadditions.mod.material.ArmorMaterials; import de.ellpeck.actuallyadditions.mod.material.ArmorMaterials;
import de.ellpeck.actuallyadditions.mod.material.ToolMaterials; import de.ellpeck.actuallyadditions.mod.material.ToolMaterials;
import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTier; import net.minecraft.item.ItemTier;
import net.minecraft.item.Items;
import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries; 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> COFFEE = ITEMS.register("coffee", ItemCoffee::new);
public static final RegistryObject<Item> PHANTOM_CONNECTOR = ITEMS.register("phantom_connector", ItemPhantomConnector::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> RESONANT_RICE = ITEMS.register("resonant_rice", ItemResonantRice::new);
public static final RegistryObject<Item> FOOD = ITEMS.register("food", ItemBase::new); //just... food? //TODO public static final RegistryObject<Item> FOOD = ITEMS.register("food", ItemFoods::new); //just... food?
public static final RegistryObject<Item> JAM = ITEMS.register("jam", ItemJams::new); 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> KNIFE = ITEMS.register("knife", ItemKnife::new);
public static final RegistryObject<Item> CRAFTER_ON_A_STICK = ITEMS.register("crafter_on_a_stick", ItemCrafterOnAStick::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> 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> COFFEE_BEANS = ITEMS.register("coffee_beans", ItemCoffeeBean::new);
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> 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", 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> 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", ItemBase::new); //() -> new ItemSeed("seedFlax", ActuallyBlocks.FLAX, Items.STRING, 0)); 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", ItemBase::new); //() -> new ItemSeed("seedCoffeeBeans", ActuallyBlocks.COFFEE, COFFEE_BEANS, 0)); public static final RegistryObject<Item> COFFEE_SEED = ITEMS.register("coffee_seed", () -> new ItemSeed("seedCoffeeBeans", ActuallyBlocks.COFFEE, COFFEE_BEANS, 0));
// TOOLS & ARMOR // TOOLS & ARMOR
public static final RegistryObject<Item> HELM_QUARTZ = ITEMS.register("helm_quartz", () -> new ItemArmorAA(ArmorMaterials.QUARTZ, EquipmentSlotType.HEAD)); 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> 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> AXE_QUARTZ = ITEMS.register("axe_quartz", () -> new ItemAxeAA(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> SHOVEL_QUARTZ = ITEMS.register("shovel_quartz", () -> new ItemShovelAA(ToolMaterials.BLACK_QUARTZ));
public static final RegistryObject<Item> SWORD_QUARTZ = ITEMS.register("sword_quartz", () -> new ItemSwordAA(ToolMaterials.BLACK_QUARTZ)); public static final RegistryObject<Item> 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> 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)); 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> 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> 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", ItemBase::new); // () -> new ItemShovelAA(ToolMaterials.RESTONIA)); public static final RegistryObject<Item> SHOVEL_CRYSTAL_RESTONIA = ITEMS.register("shovel_crystal_restonia", () -> 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> 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> 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)); 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> 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> 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", ItemBase::new); //() -> new ItemShovelAA(ToolMaterials.PALIS)); public static final RegistryObject<Item> SHOVEL_CRYSTAL_PALIS = ITEMS.register("shovel_crystal_palis", () -> 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> 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> 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)); 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> 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> 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", ItemBase::new); //() -> new ItemShovelAA(ToolMaterials.DIAMATINE)); public static final RegistryObject<Item> SHOVEL_CRYSTAL_DIAMATINE = ITEMS.register("shovel_crystal_diamatine", () -> 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> 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> 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)); 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> 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> 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", ItemBase::new); // () -> new ItemShovelAA(ToolMaterials.VOID)); public static final RegistryObject<Item> SHOVEL_CRYSTAL_VOID = ITEMS.register("shovel_crystal_void", () -> 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> 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> 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)); 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> 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> 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", ItemBase::new); //() -> new ItemShovelAA(ToolMaterials.EMERADIC)); public static final RegistryObject<Item> SHOVEL_CRYSTAL_EMERADIC = ITEMS.register("shovel_crystal_emeradic", () -> 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> 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> 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)); 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> 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> 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", ItemBase::new); //() -> new ItemShovelAA(ToolMaterials.ENORI)); public static final RegistryObject<Item> SHOVEL_CRYSTAL_ENORI = ITEMS.register("shovel_crystal_enori", () -> 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> 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> 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)); public static final RegistryObject<Item> HELM_CRYSTAL_ENORI = ITEMS.register("helm_crystal_enori", () -> new ItemArmorAA(ArmorMaterials.ENORI, EquipmentSlotType.HEAD));

View file

@ -10,33 +10,20 @@
package de.ellpeck.actuallyadditions.mod.items; package de.ellpeck.actuallyadditions.mod.items;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; 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 net.minecraft.item.IItemTier; import net.minecraft.item.IItemTier;
import net.minecraft.item.ToolItem; import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ToolType;
public class ItemAxeAA extends ToolItem { import java.util.Collections;
private IItemTier tier; import java.util.Set;
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)
);
this.tier = tier; public class ItemAxeAA extends ItemToolAA {
}
/*
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); 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) { public ItemAxeAA(IItemTier material) {
@ -55,5 +42,5 @@ public class ItemAxeAA extends ToolItem {
@Override @Override
public Set<String> getToolClasses(ItemStack stack) { public Set<String> getToolClasses(ItemStack stack) {
return Collections.singleton("axe"); return Collections.singleton("axe");
}*/ }
} }

View file

@ -16,6 +16,6 @@ public class ItemCoffeeBean extends ItemFoodBase {
public ItemCoffeeBean() { public ItemCoffeeBean() {
super(1, 1F, false); super(1, 1F, false);
//this.setMaxDamage(0); this.setMaxDamage(0);
} }
} }

View file

@ -10,33 +10,20 @@
package de.ellpeck.actuallyadditions.mod.items; package de.ellpeck.actuallyadditions.mod.items;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; 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 net.minecraft.item.IItemTier; import net.minecraft.item.IItemTier;
import net.minecraft.item.ToolItem; import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ToolType;
public class ItemPickaxeAA extends ToolItem { import java.util.Collections;
private final IItemTier tier; import java.util.Set;
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)
);
this.tier = tier; public class ItemPickaxeAA extends ItemToolAA {
}
/*
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); 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) { public ItemPickaxeAA(IItemTier material) {
@ -89,5 +76,5 @@ public class ItemPickaxeAA extends ToolItem {
@Override @Override
public Set<String> getToolClasses(ItemStack stack) { public Set<String> getToolClasses(ItemStack stack) {
return Collections.singleton("pickaxe"); return Collections.singleton("pickaxe");
}*/ }
} }

View file

@ -15,40 +15,39 @@ import de.ellpeck.actuallyadditions.mod.items.base.ItemToolAA;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.item.*; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.tags.ITag; import net.minecraft.item.IItemTier;
import net.minecraft.util.ActionResultType; 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 javax.annotation.Nonnull;
import java.util.Collections; import java.util.Collections;
import java.util.Set; import java.util.Set;
public class ItemShovelAA extends ItemToolAA { 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_BLOCK, 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_LAYER, Blocks.SOUL_SAND, Blocks.GRASS_PATH);
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) { public ItemShovelAA(IItemTier material) {
super(p_i48512_1_, p_i48512_2_, p_i48512_3_, p_i48512_4_, p_i48512_5_, name, repairItem, repairTag); super(1.5F, -3.0F, material, this.repairItem, unlocalizedName, this.rarity, EFFECTIVE_ON);
this.setHarvestLevel("shovel", material.getLevel());
} }
// public ItemShovelAA(IItemTier material) {
//// super(1.5F, -3.0F, material, this.repairItem, unlocalizedName, this.rarity, EFFECTIVE_ON);
//// this.setHarvestLevel("shovel", material.getLevel());
// }
@Override @Override
public boolean isCorrectToolForDrops(BlockState blockIn) { public boolean isCorrectToolForDrops(BlockState blockIn) {
Block block = blockIn.getBlock(); Block block = blockIn.getBlock();
return block == Blocks.SNOW_BLOCK || block == Blocks.SNOW; return block == Blocks.SNOW_LAYER || block == Blocks.SNOW;
} }
@Nonnull
@Override @Override
public ActionResultType useOn(ItemUseContext useContext) { public EnumActionResult onItemUse(PlayerEntity playerIn, World worldIn, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) {
return Items.IRON_SHOVEL.useOn(useContext); return Items.IRON_SHOVEL.onItemUse(playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ);
} }
//@Override @Override
public Set<String> getToolClasses(ItemStack stack) { public Set<String> getToolClasses(ItemStack stack) {
return Collections.singleton("shovel"); return Collections.singleton("shovel");
} }

View file

@ -12,6 +12,6 @@ package de.ellpeck.actuallyadditions.mod.items.base;
public class ItemFoodBase extends ItemBase { public class ItemFoodBase extends ItemBase {
public ItemFoodBase(int heal, float saturation, boolean wolfFood) { public ItemFoodBase(int heal, float saturation, boolean wolfFood) {
//super(heal, saturation, wolfFood); super(heal, saturation, wolfFood);
} }
} }

View file

@ -33,7 +33,7 @@ public class ItemFoodSeed /*extends ItemSeedFood */{ //TODO what is this?!
this.maxUseDuration = maxUseDuration; this.maxUseDuration = maxUseDuration;
if (plant instanceof BlockPlant) { if (plant instanceof BlockPlant) {
//((BlockPlant) plant).doStuff(this, returnItem, returnMeta); ((BlockPlant) plant).doStuff(this, returnItem, returnMeta);
} }
} }

View file

@ -10,30 +10,17 @@
package de.ellpeck.actuallyadditions.mod.items.base; package de.ellpeck.actuallyadditions.mod.items.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; 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 net.minecraft.item.HoeItem; import net.minecraft.item.HoeItem;
import net.minecraft.item.IItemTier; import net.minecraft.item.IItemTier;
import net.minecraftforge.common.ToolType; import net.minecraft.item.ItemStack;
public class ItemHoeAA extends HoeItem { public class ItemHoeAA extends HoeItem implements IDisableableItem {
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)
);
this.tier = tier; private final ItemStack repairItem;
}
/* private final ItemStack repairItem;
private final boolean disabled; private final boolean disabled;
public ItemHoeAA(IItemTier toolMat) { public ItemHoeAA(IItemTier toolMat) {
@ -56,5 +43,5 @@ public class ItemHoeAA extends HoeItem {
@Override @Override
public boolean isDisabled() { public boolean isDisabled() {
return this.disabled; return this.disabled;
}*/ }
} }

View file

@ -28,7 +28,7 @@ public class ItemSeed /* extends ItemSeeds*/ {
this.plant = plant; this.plant = plant;
if (plant instanceof BlockPlant) { if (plant instanceof BlockPlant) {
//((BlockPlant) plant).doStuff(this, returnItem, returnMeta); //TODO ((BlockPlant) plant).doStuff(this, returnItem, returnMeta);
} }
} }

View file

@ -10,28 +10,18 @@
package de.ellpeck.actuallyadditions.mod.items.base; package de.ellpeck.actuallyadditions.mod.items.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; 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 net.minecraft.item.IItemTier; import net.minecraft.item.IItemTier;
import net.minecraft.item.ItemStack;
import net.minecraft.item.SwordItem; import net.minecraft.item.SwordItem;
import net.minecraftforge.common.ToolType;
public class ItemSwordAA extends SwordItem { public class ItemSwordAA extends SwordItem implements IDisableableItem {
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) { public ItemSwordAA(IItemTier toolMat) {
super(toolMat); super(toolMat);
@ -58,5 +48,5 @@ public class ItemSwordAA extends SwordItem {
@Override @Override
public boolean isDisabled() { public boolean isDisabled() {
return this.disabled; return this.disabled;
}*/ }
} }

View file

@ -22,8 +22,11 @@ import net.minecraft.item.BlockItem;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; 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.List;
import java.util.Map; import java.util.Map;
@ -58,7 +61,7 @@ public class LensColor extends Lens {
ItemStack returnStack = this.tryConvert(new ItemStack(block), hitState, hitBlock, tile); ItemStack returnStack = this.tryConvert(new ItemStack(block), hitState, hitBlock, tile);
if (returnStack != null && returnStack.getItem() instanceof BlockItem) { if (returnStack != null && returnStack.getItem() instanceof BlockItem) {
Block toPlace = Block.byItem(returnStack.getItem()); Block toPlace = Block.byItem(returnStack.getItem());
BlockState state2Place = toPlace.defaultBlockState(); //getStateForPlacement(tile.getWorldObject(), hitBlock, Direction.UP, 0, 0, 0, FakePlayerFactory.getMinecraft((ServerWorld) tile.getWorldObject()), Hand.MAIN_HAND); //TODO BlockState state2Place = toPlace.getStateForPlacement(tile.getWorldObject(), hitBlock, Direction.UP, 0, 0, 0, returnStack.getMetadata(), FakePlayerFactory.getMinecraft((ServerWorld) tile.getWorldObject()), Hand.MAIN_HAND);
tile.getWorldObject().setBlock(hitBlock, state2Place, 2); tile.getWorldObject().setBlock(hitBlock, state2Place, 2);
tile.extractEnergy(ENERGY_USE); tile.extractEnergy(ENERGY_USE);
} }

View file

@ -15,15 +15,21 @@ import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.api.lens.Lens;
import de.ellpeck.actuallyadditions.api.recipe.WeightedOre; import de.ellpeck.actuallyadditions.api.recipe.WeightedOre;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; 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.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues; 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.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.NetherrackBlock; import net.minecraft.block.NetherrackBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.WeightedRandom; import net.minecraft.util.WeightedRandom;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.Tags; import net.minecraftforge.common.util.FakePlayerFactory;
import java.util.List; import java.util.List;
@ -119,7 +125,7 @@ public class LensMining extends Lens {
List<WeightedOre> ores = null; List<WeightedOre> ores = null;
Block hitBlock = hitState.getBlock(); Block hitBlock = hitState.getBlock();
if (hitBlock.is(Tags.Blocks.STONE)) { //TODO maybe? if (hitBlock instanceof BlockStone) {
ores = ActuallyAdditionsAPI.STONE_ORES; ores = ActuallyAdditionsAPI.STONE_ORES;
} else if (hitBlock instanceof NetherrackBlock) { } else if (hitBlock instanceof NetherrackBlock) {
ores = ActuallyAdditionsAPI.NETHERRACK_ORES; ores = ActuallyAdditionsAPI.NETHERRACK_ORES;
@ -133,7 +139,7 @@ public class LensMining extends Lens {
boolean found = false; boolean found = false;
while (!found) { while (!found) {
WeightedOre ore = WeightedRandom.getRandomItem(tile.getWorldObject().random, ores, totalWeight); WeightedOre ore = WeightedRandom.getRandomItem(tile.getWorldObject().random, ores, totalWeight);
/* if (ore != null) { if (ore != null) {
List<ItemStack> stacks = OreDictionary.getOres(ore.name, false); List<ItemStack> stacks = OreDictionary.getOres(ore.name, false);
if (stacks != null && !stacks.isEmpty()) { if (stacks != null && !stacks.isEmpty()) {
for (ItemStack aStack : stacks) { for (ItemStack aStack : stacks) {
@ -148,19 +154,19 @@ public class LensMining extends Lens {
} }
} }
} }
}*/ }
} }
if (tile.getEnergy() >= adaptedUse) { if (tile.getEnergy() >= adaptedUse) {
Block block = Block.byItem(stack.getItem()); 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); 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().setBlock(hitPos, state, 2);
tile.getWorldObject().levelEvent(2001, hitPos, Block.getId(state)); tile.getWorldObject().levelEvent(2001, hitPos, Block.getId(state));
tile.extractEnergy(adaptedUse); tile.extractEnergy(adaptedUse);
}*/ }
} }
} }
} }

View file

@ -14,117 +14,126 @@ import net.minecraft.block.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.item.Rarity; import net.minecraft.item.Rarity;
import net.minecraft.potion.Effect; import net.minecraft.potion.Potion;
import net.minecraft.potion.Effects;
@Deprecated @Deprecated
public enum ThePotionRings { public enum ThePotionRings {
SPEED( SPEED(
8171462, MobEffects.SPEED.getName(),
Effects.MOVEMENT_SPEED, 8171462,
0, MobEffects.SPEED,
1, 0,
10, 1,
false, 10,
Rarity.UNCOMMON, false,
new ItemStack(Items.SUGAR) Rarity.UNCOMMON,
new ItemStack(Items.SUGAR)
), ),
//Slowness //Slowness
HASTE( HASTE(
14270531, MobEffects.HASTE.getName(),
Effects.DIG_SPEED, // todo: wrong 14270531,
0, MobEffects.HASTE,
1, 0,
10, 1,
false, 10,
Rarity.EPIC, false,
new ItemStack(Items.REPEATER) Rarity.EPIC,
new ItemStack(Items.REPEATER)
), ),
//Mining Fatigue //Mining Fatigue
STRENGTH( STRENGTH(
9643043, MobEffects.STRENGTH.getName(),
Effects.DAMAGE_BOOST, // TODO: wrong? 9643043,
0, MobEffects.STRENGTH,
1, 0,
10, 1,
false, 10,
Rarity.RARE, false,
new ItemStack(Items.BLAZE_POWDER) Rarity.RARE,
new ItemStack(Items.BLAZE_POWDER)
), ),
//Health (Not Happening) //Health (Not Happening)
//Damage //Damage
JUMP_BOOST( JUMP_BOOST(
7889559, MobEffects.JUMP_BOOST.getName(),
Effects.JUMP, 7889559,
0, MobEffects.JUMP_BOOST,
1, 0,
10, 1,
false, 10,
Rarity.RARE, false,
new ItemStack(Blocks.PISTON) Rarity.RARE,
new ItemStack(Blocks.PISTON)
), ),
//Nausea //Nausea
REGEN( REGEN(
13458603, MobEffects.REGENERATION.getName(),
Effects.REGENERATION, 13458603,
0, MobEffects.REGENERATION,
1, 0,
50, 1,
true, 50,
Rarity.RARE, true,
new ItemStack(Items.GHAST_TEAR) Rarity.RARE,
new ItemStack(Items.GHAST_TEAR)
), ),
RESISTANCE( RESISTANCE(
10044730, MobEffects.RESISTANCE.getName(),
Effects.DAMAGE_RESISTANCE, 10044730,
0, MobEffects.RESISTANCE,
1, 0,
10, 1,
false, 10,
Rarity.EPIC, false,
new ItemStack(Items.SLIME_BALL) Rarity.EPIC,
new ItemStack(Items.SLIME_BALL)
), ),
FIRE_RESISTANCE( FIRE_RESISTANCE(
14981690, MobEffects.FIRE_RESISTANCE.getName(),
Effects.FIRE_RESISTANCE, 14981690,
0, MobEffects.FIRE_RESISTANCE,
0, 0,
10, 0,
false, 10,
Rarity.UNCOMMON, false,
new ItemStack(Items.MAGMA_CREAM) Rarity.UNCOMMON,
new ItemStack(Items.MAGMA_CREAM)
), ),
WATER_BREATHING( WATER_BREATHING(
3035801, MobEffects.WATER_BREATHING.getName(),
Effects.WATER_BREATHING, 3035801,
0, MobEffects.WATER_BREATHING,
0, 0,
10, 0,
false, 10,
Rarity.RARE, false,
new ItemStack(Items.TROPICAL_FISH) Rarity.RARE,
new ItemStack(Items.FISH, 1, 3)
), ),
INVISIBILITY( INVISIBILITY(
8356754, MobEffects.INVISIBILITY.getName(),
Effects.INVISIBILITY, 8356754,
0, MobEffects.INVISIBILITY,
0, 0,
10, 0,
false, 10,
Rarity.EPIC, false,
new ItemStack(Items.FERMENTED_SPIDER_EYE) Rarity.EPIC,
new ItemStack(Items.FERMENTED_SPIDER_EYE)
), ),
//Blindness //Blindness
NIGHT_VISION( NIGHT_VISION(
2039713, MobEffects.NIGHT_VISION.getName(),
Effects.NIGHT_VISION, 2039713,
0, MobEffects.NIGHT_VISION,
0, 0,
300, 0,
false, 300,
Rarity.RARE, false,
new ItemStack(Items.GOLDEN_CARROT) Rarity.RARE,
new ItemStack(Items.GOLDEN_CARROT)
); );
//Hunger //Hunger
//Weakness //Weakness
@ -136,18 +145,18 @@ public enum ThePotionRings {
public final String name; public final String name;
public final int color; public final int color;
public final Rarity rarity; public final Rarity rarity;
public final Effect effect; public final int effectID;
public final int normalAmplifier; public final int normalAmplifier;
public final int advancedAmplifier; public final int advancedAmplifier;
public final int activeTime; public final int activeTime;
public final boolean needsWaitBeforeActivating; public final boolean needsWaitBeforeActivating;
public final ItemStack craftingItem; public final ItemStack craftingItem;
ThePotionRings(int color, Effect effect, int normalAmplifier, int advancedAmplifier, int activeTime, boolean needsWaitBeforeActivating, Rarity rarity, ItemStack craftingItem) { ThePotionRings(String name, int color, Potion effect, int normalAmplifier, int advancedAmplifier, int activeTime, boolean needsWaitBeforeActivating, Rarity rarity, ItemStack craftingItem) {
this.name = effect.getDisplayName().getString(); this.name = name;
this.color = color; this.color = color;
this.rarity = rarity; this.rarity = rarity;
this.effect = effect; this.effectID = Potion.getIdFromPotion(effect);
this.normalAmplifier = normalAmplifier; this.normalAmplifier = normalAmplifier;
this.advancedAmplifier = advancedAmplifier; this.advancedAmplifier = advancedAmplifier;
this.activeTime = activeTime; this.activeTime = activeTime;

View file

@ -10,18 +10,38 @@
package de.ellpeck.actuallyadditions.mod.misc.apiimpl; 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.IAtomicReconstructor;
import de.ellpeck.actuallyadditions.api.internal.IMethodHandler; import de.ellpeck.actuallyadditions.api.internal.IMethodHandler;
import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.api.lens.Lens;
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient; 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.tile.TileEntityAtomicReconstructor;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState; 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.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.potion.Effect; import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance; import net.minecraft.potion.EffectInstance;
import net.minecraft.util.Direction; 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.BlockPos;
import net.minecraft.util.math.vector.Vector3i;
import net.minecraftforge.common.util.FakePlayerFactory;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -117,7 +137,7 @@ public class MethodHandler implements IMethodHandler {
@Override @Override
public boolean invokeConversionLens(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) { public boolean invokeConversionLens(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) {
/* if (hitBlock != null) { if (hitBlock != null) {
int range = 1; int range = 1;
int rangeX = 0; int rangeX = 0;
int rangeY = 0; int rangeY = 0;
@ -155,7 +175,7 @@ public class MethodHandler implements IMethodHandler {
recipe.transformHook(ItemStack.EMPTY, state, pos, tile); recipe.transformHook(ItemStack.EMPTY, state, pos, tile);
if (output.getItem() instanceof BlockItem) { if (output.getItem() instanceof BlockItem) {
Block toPlace = Block.byItem(output.getItem()); Block toPlace = Block.byItem(output.getItem());
BlockState state2Place = toPlace.defaultBlockState(); //.getStateForPlacement(tile.getWorldObject(), pos, facing, 0, 0, 0, output.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), Hand.MAIN_HAND); //TODO BlockState state2Place = toPlace.getStateForPlacement(tile.getWorldObject(), pos, facing, 0, 0, 0, output.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), Hand.MAIN_HAND);
tile.getWorldObject().setBlock(pos, state2Place, 2); tile.getWorldObject().setBlock(pos, state2Place, 2);
} else { } else {
ItemEntity item = new ItemEntity(tile.getWorldObject(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, output.copy()); ItemEntity item = new ItemEntity(tile.getWorldObject(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, output.copy());
@ -179,7 +199,7 @@ public class MethodHandler implements IMethodHandler {
List<ItemEntity> items = tile.getWorldObject().getEntitiesOfClass(ItemEntity.class, aabb); List<ItemEntity> items = tile.getWorldObject().getEntitiesOfClass(ItemEntity.class, aabb);
for (ItemEntity item : items) { for (ItemEntity item : items) {
ItemStack stack = item.getItem(); ItemStack stack = item.getItem();
if (item.isAlive() && StackUtil.isValid(stack) && !item.getPersistentData().getBoolean("aa_cnv")) { if (item.isAlive() && StackUtil.isValid(stack) && !item.getEntityData().getBoolean("aa_cnv")) {
LensConversionRecipe recipe = LensRecipeHandler.findMatchingRecipe(stack, tile.getLens()); LensConversionRecipe recipe = LensRecipeHandler.findMatchingRecipe(stack, tile.getLens());
if (recipe != null) { if (recipe != null) {
int itemsPossible = Math.min(tile.getEnergy() / recipe.getEnergyUsed(), stack.getCount()); int itemsPossible = Math.min(tile.getEnergy() / recipe.getEnergyUsed(), stack.getCount());
@ -200,7 +220,7 @@ public class MethodHandler implements IMethodHandler {
outputCopy.setCount(itemsPossible); outputCopy.setCount(itemsPossible);
ItemEntity newItem = new ItemEntity(tile.getWorldObject(), item.getX(), item.getY(), item.getZ(), outputCopy); ItemEntity newItem = new ItemEntity(tile.getWorldObject(), item.getX(), item.getY(), item.getZ(), outputCopy);
newItem.getPersistentData().putBoolean("aa_cnv", true); newItem.getEntityData().putBoolean("aa_cnv", true);
tile.getWorldObject().addFreshEntity(newItem); tile.getWorldObject().addFreshEntity(newItem);
tile.extractEnergy(recipe.getEnergyUsed() * itemsPossible); tile.extractEnergy(recipe.getEnergyUsed() * itemsPossible);
@ -210,7 +230,7 @@ public class MethodHandler implements IMethodHandler {
} }
} }
return !hitState.getBlock().isAir(hitState, tile.getWorldObject(), hitBlock); return !hitState.getBlock().isAir(hitState, tile.getWorldObject(), hitBlock);
}*/ }
return false; return false;
} }
@ -241,7 +261,7 @@ public class MethodHandler implements IMethodHandler {
@Override @Override
public boolean addCrusherRecipes(List<ItemStack> inputs, List<ItemStack> outputOnes, int outputOneAmounts, List<ItemStack> outputTwos, int outputTwoAmounts, int outputTwoChance) { public boolean addCrusherRecipes(List<ItemStack> inputs, List<ItemStack> outputOnes, int outputOneAmounts, List<ItemStack> outputTwos, int outputTwoAmounts, int outputTwoChance) {
boolean hasWorkedOnce = false; boolean hasWorkedOnce = false;
/* for (ItemStack input : inputs) { for (ItemStack input : inputs) {
if (StackUtil.isValid(input) && CrusherRecipeRegistry.getRecipeFromInput(input) == null) { if (StackUtil.isValid(input) && CrusherRecipeRegistry.getRecipeFromInput(input) == null) {
for (ItemStack outputOne : outputOnes) { for (ItemStack outputOne : outputOnes) {
if (StackUtil.isValid(outputOne) && !CrusherRecipeRegistry.hasBlacklistedOutput(outputOne, ConfigStringListValues.CRUSHER_OUTPUT_BLACKLIST.getValue())) { if (StackUtil.isValid(outputOne) && !CrusherRecipeRegistry.hasBlacklistedOutput(outputOne, ConfigStringListValues.CRUSHER_OUTPUT_BLACKLIST.getValue())) {
@ -265,14 +285,14 @@ public class MethodHandler implements IMethodHandler {
} }
} }
} }
}*/ //TODO }
return hasWorkedOnce; return hasWorkedOnce;
} }
@Override @Override
public boolean addCrusherRecipes(List<ItemStack> inputs, ItemStack outputOne, int outputOneAmount, ItemStack outputTwo, int outputTwoAmount, int outputTwoChance) { public boolean addCrusherRecipes(List<ItemStack> inputs, ItemStack outputOne, int outputOneAmount, ItemStack outputTwo, int outputTwoAmount, int outputTwoChance) {
boolean hasWorkedOnce = false; boolean hasWorkedOnce = false;
/* for (ItemStack input : inputs) { for (ItemStack input : inputs) {
if (StackUtil.isValid(input) && CrusherRecipeRegistry.getRecipeFromInput(input) == null) { if (StackUtil.isValid(input) && CrusherRecipeRegistry.getRecipeFromInput(input) == null) {
if (StackUtil.isValid(outputOne) && !CrusherRecipeRegistry.hasBlacklistedOutput(outputOne, ConfigStringListValues.CRUSHER_OUTPUT_BLACKLIST.getValue())) { if (StackUtil.isValid(outputOne) && !CrusherRecipeRegistry.hasBlacklistedOutput(outputOne, ConfigStringListValues.CRUSHER_OUTPUT_BLACKLIST.getValue())) {
ItemStack outputOneCopy = outputOne.copy(); ItemStack outputOneCopy = outputOne.copy();
@ -290,62 +310,62 @@ public class MethodHandler implements IMethodHandler {
} }
} }
} }
}*/ }
return hasWorkedOnce; return hasWorkedOnce;
} }
// @Override @Override
// public IBookletPage generateTextPage(int id) { public IBookletPage generateTextPage(int id) {
// return this.generateTextPage(id, 0); return this.generateTextPage(id, 0);
// } }
// @Override @Override
// public IBookletPage generatePicturePage(int id, ResourceLocation resLoc, int textStartY) { public IBookletPage generatePicturePage(int id, ResourceLocation resLoc, int textStartY) {
// return this.generatePicturePage(id, resLoc, textStartY, 0); return this.generatePicturePage(id, resLoc, textStartY, 0);
// } }
// @Override @Override
// public IBookletPage generateCraftingPage(int id, IRecipe... recipes) { public IBookletPage generateCraftingPage(int id, IRecipe... recipes) {
// return this.generateCraftingPage(id, 0, recipes); return this.generateCraftingPage(id, 0, recipes);
// } }
// @Override @Override
// public IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result) { public IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result) {
// return this.generateFurnacePage(id, input, result, 0); return this.generateFurnacePage(id, input, result, 0);
// } }
// @Override @Override
// public IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) { public IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) {
// return this.generateBookletChapter(identifier, entry, displayStack, 0, pages); return this.generateBookletChapter(identifier, entry, displayStack, 0, pages);
// } }
// @Override @Override
// public IBookletPage generateTextPage(int id, int priority) { public IBookletPage generateTextPage(int id, int priority) {
// return new PageTextOnly(id, priority); return new PageTextOnly(id, priority);
// } }
// @Override @Override
// public IBookletPage generatePicturePage(int id, ResourceLocation resLoc, int textStartY, int priority) { public IBookletPage generatePicturePage(int id, ResourceLocation resLoc, int textStartY, int priority) {
// return new PagePicture(id, resLoc, textStartY, priority); return new PagePicture(id, resLoc, textStartY, priority);
// } }
// @Override @Override
// public IBookletPage generateCraftingPage(int id, int priority, IRecipe... recipes) { public IBookletPage generateCraftingPage(int id, int priority, IRecipe... recipes) {
// return new PageCrafting(id, priority, recipes); return new PageCrafting(id, priority, recipes);
// } }
// @Override @Override
// public IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result, int priority) { public IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result, int priority) {
// return new PageFurnace(id, result, priority); return new PageFurnace(id, result, priority);
// } }
// @Override @Override
// public IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, int priority, IBookletPage... pages) { public IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, int priority, IBookletPage... pages) {
// return new BookletChapter(identifier, entry, displayStack, priority, pages); return new BookletChapter(identifier, entry, displayStack, priority, pages);
// } }
// @Override @Override
// public IBookletChapter createTrial(String identifier, ItemStack displayStack, boolean textOnSecondPage) { public IBookletChapter createTrial(String identifier, ItemStack displayStack, boolean textOnSecondPage) {
// return new BookletChapterTrials(identifier, displayStack, textOnSecondPage); return new BookletChapterTrials(identifier, displayStack, textOnSecondPage);
// } }
} }

View file

@ -62,7 +62,7 @@ public class CactusFarmerBehavior implements IFarmerBehavior {
BlockState upState = world.getBlockState(up); BlockState upState = world.getBlockState(up);
if (upState.getBlock() == Blocks.CACTUS) { if (upState.getBlock() == Blocks.CACTUS) {
NonNullList<ItemStack> drops = NonNullList.create(); 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 (!drops.isEmpty()) {
if (farmer.canAddToOutput(drops)) { if (farmer.canAddToOutput(drops)) {

View file

@ -97,7 +97,7 @@ public class DefaultFarmerBehavior implements IFarmerBehavior {
List<ItemStack> seeds = new ArrayList<>(); List<ItemStack> seeds = new ArrayList<>();
List<ItemStack> other = new ArrayList<>(); List<ItemStack> other = new ArrayList<>();
NonNullList<ItemStack> drops = NonNullList.create(); 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) { for (ItemStack stack : drops) {
if (this.getPlantableFromStack(stack) != null) { if (this.getPlantableFromStack(stack) != null) {
seeds.add(stack); seeds.add(stack);
@ -177,7 +177,7 @@ public class DefaultFarmerBehavior implements IFarmerBehavior {
if (!player.mayUseItemAt(pos.relative(Direction.UP), Direction.UP, itemstack)) { if (!player.mayUseItemAt(pos.relative(Direction.UP), Direction.UP, itemstack)) {
return ActionResultType.FAIL; return ActionResultType.FAIL;
} else { } 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) { if (hook != 0) {
return hook > 0 return hook > 0
? ActionResultType.SUCCESS ? ActionResultType.SUCCESS
@ -205,7 +205,7 @@ public class DefaultFarmerBehavior implements IFarmerBehavior {
} }
} }
} }
*/
return ActionResultType.PASS; return ActionResultType.PASS;
} }
} }

View file

@ -58,7 +58,7 @@ public class MelonPumpkinFarmerBehavior implements IFarmerBehavior {
Block block = state.getBlock(); Block block = state.getBlock();
if (block == Blocks.PUMPKIN || block == Blocks.MELON) { if (block == Blocks.PUMPKIN || block == Blocks.MELON) {
NonNullList<ItemStack> drops = NonNullList.create(); NonNullList<ItemStack> drops = NonNullList.create();
//block.getDrops(drops, world, pos, state, 0); block.getDrops(drops, world, pos, state, 0);
if (!drops.isEmpty()) { if (!drops.isEmpty()) {
if (farmer.canAddToOutput(drops)) { if (farmer.canAddToOutput(drops)) {
world.levelEvent(2001, pos, Block.getId(state)); world.levelEvent(2001, pos, Block.getId(state));

View file

@ -52,7 +52,7 @@ public class NetherWartFarmerBehavior implements IFarmerBehavior {
if (state.getBlock() instanceof NetherWartBlock) { if (state.getBlock() instanceof NetherWartBlock) {
if (state.getValue(BlockStateProperties.AGE_3) >= 3) { if (state.getValue(BlockStateProperties.AGE_3) >= 3) {
NonNullList<ItemStack> drops = NonNullList.create(); NonNullList<ItemStack> drops = NonNullList.create();
//state.getBlock().getDrops(drops, world, pos, state, 0); state.getBlock().getDrops(drops, world, pos, state, 0);
if (!drops.isEmpty()) { if (!drops.isEmpty()) {
boolean toInput = farmer.canAddToSeeds(drops); boolean toInput = farmer.canAddToSeeds(drops);
if (toInput || farmer.canAddToOutput(drops)) { if (toInput || farmer.canAddToOutput(drops)) {

View file

@ -55,7 +55,7 @@ public class ReedFarmerBehavior implements IFarmerBehavior {
BlockState upState = world.getBlockState(up); BlockState upState = world.getBlockState(up);
if (upState.getBlock() instanceof SugarCaneBlock) { if (upState.getBlock() instanceof SugarCaneBlock) {
NonNullList<ItemStack> drops = NonNullList.create(); 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 (!drops.isEmpty()) {
if (farmer.canAddToOutput(drops)) { if (farmer.canAddToOutput(drops)) {

View file

@ -18,6 +18,7 @@ import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import org.apache.commons.lang3.ArrayUtils;
public class FilterSettings { public class FilterSettings {
@ -85,43 +86,46 @@ public class FilterSettings {
return true; return true;
} }
// if (oredict != 0) { if (oredict != 0) {
// boolean firstEmpty = ArrayUtils.isEmpty(firstIds); int[] firstIds = OreDictionary.getOreIDs(first);
// boolean secondEmpty = ArrayUtils.isEmpty(secondIds); int[] secondIds = OreDictionary.getOreIDs(second);
// boolean firstEmpty = ArrayUtils.isEmpty(firstIds);
// //Both empty, meaning none has OreDict entries, so they are equal boolean secondEmpty = ArrayUtils.isEmpty(secondIds);
// if (firstEmpty && secondEmpty) {
// return true; //Both empty, meaning none has OreDict entries, so they are equal
// } if (firstEmpty && secondEmpty) {
// //Only one empty, meaning they are not equal return true;
// else if (firstEmpty || secondEmpty) { }
// return false; //Only one empty, meaning they are not equal
// } else { else if (firstEmpty || secondEmpty) {
// for (int id : firstIds) { return false;
// if (ArrayUtils.contains(secondIds, id)) { } else {
// //Needs to match only one id, so return true on first match for (int id : firstIds) {
// if (oredict == 1) { if (ArrayUtils.contains(secondIds, id)) {
// return true; //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; //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 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) { if (firstItem != secondItem) {
return false; return false;
} }
boolean metaFine = !meta || first.getItemDamage() == second.getItemDamage();
boolean nbtFine = !nbt || ItemStack.tagMatches(first, second); boolean nbtFine = !nbt || ItemStack.tagMatches(first, second);
if (nbtFine) { if (metaFine && nbtFine) {
return true; return true;
} }
return false; return false;
@ -135,11 +139,11 @@ public class FilterSettings {
compound.putBoolean("Mod", this.respectMod); compound.putBoolean("Mod", this.respectMod);
compound.putInt("Oredict", this.respectOredict); compound.putInt("Oredict", this.respectOredict);
TileEntityInventoryBase.saveSlots(this.filterInventory, compound); TileEntityInventoryBase.saveSlots(this.filterInventory, compound);
tag.put(name, compound); tag.setTag(name, compound);
} }
public void readFromNBT(CompoundNBT tag, String name) { public void readFromNBT(CompoundNBT tag, String name) {
CompoundNBT compound = tag.getCompound(name); CompoundNBT compound = tag.getCompoundTag(name);
this.isWhitelist = compound.getBoolean("Whitelist"); this.isWhitelist = compound.getBoolean("Whitelist");
this.respectMeta = compound.getBoolean("Meta"); this.respectMeta = compound.getBoolean("Meta");
this.respectNBT = compound.getBoolean("NBT"); this.respectNBT = compound.getBoolean("NBT");

View file

@ -12,9 +12,10 @@ package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe; import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe;
import de.ellpeck.actuallyadditions.mod.inventory.CrusherContainer; import de.ellpeck.actuallyadditions.mod.inventory.ContainerGrinder;
import de.ellpeck.actuallyadditions.mod.misc.SoundHandler; import de.ellpeck.actuallyadditions.mod.misc.SoundHandler;
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; 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.IAcceptor;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
@ -176,7 +177,7 @@ public class TileEntityCrusher extends TileEntityInventoryBase implements IButto
@Override @Override
public IAcceptor getAcceptor() { public IAcceptor getAcceptor() {
return (slot, stack, automation) -> !automation || (slot == SLOT_INPUT_1 || slot == SLOT_INPUT_2); /*CrusherRecipeRegistry.getRecipeFromInput(stack) != null*/ //TODO return (slot, stack, automation) -> !automation || (slot == SLOT_INPUT_1 || slot == SLOT_INPUT_2) && CrusherRecipeRegistry.getRecipeFromInput(stack) != null;
} }
@Override @Override
@ -287,6 +288,6 @@ public class TileEntityCrusher extends TileEntityInventoryBase implements IButto
@Nullable @Nullable
@Override @Override
public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) { public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) {
return new CrusherContainer(windowId, playerInventory, this); return new ContainerGrinder(windowId, playerInventory, this);
} }
} }

View file

@ -1,118 +1,117 @@
///* /*
// * This file ("TileEntityFurnaceSolar.java") is part of the Actually Additions mod for Minecraft. * This file ("TileEntityFurnaceSolar.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// * *
// * © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
// */ */
//
//package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
//
//import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import net.minecraft.block.BlockState;
//import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT;
//import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity;
//import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction;
//import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos;
//import net.minecraft.util.math.BlockPos; import net.minecraftforge.common.util.LazyOptional;
//import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.IEnergyStorage;
//import net.minecraftforge.energy.IEnergyStorage;
// import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
//import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
// public class TileEntityFurnaceSolar extends TileEntityBase implements ISharingEnergyProvider, IEnergyDisplay {
//public class TileEntityFurnaceSolar extends TileEntityBase implements ISharingEnergyProvider, IEnergyDisplay {
// public static final int PRODUCE = 8;
// public static final int PRODUCE = 8; public final CustomEnergyStorage storage = new CustomEnergyStorage(30000, 0, 100);
// public final CustomEnergyStorage storage = new CustomEnergyStorage(30000, 0, 100); public final LazyOptional<IEnergyStorage> lazyEnergy = LazyOptional.of(() -> this.storage);
// public final LazyOptional<IEnergyStorage> lazyEnergy = LazyOptional.of(() -> this.storage); private int oldEnergy;
// private int oldEnergy;
// public TileEntityFurnaceSolar() {
// public TileEntityFurnaceSolar() { super(ActuallyTiles.SOLAR_TILE.get());
// super(ActuallyBlocks.SO.SOLAR_TILE.get()); }
// }
// @Override
// @Override public void writeSyncableNBT(CompoundNBT compound, NBTType type) {
// public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type);
// super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound);
// this.storage.writeToNBT(compound); }
// }
// @Override
// @Override public void readSyncableNBT(CompoundNBT compound, NBTType type) {
// public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type);
// super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound);
// this.storage.readFromNBT(compound); }
// }
// @Override
// @Override public void updateEntity() {
// public void updateEntity() { super.updateEntity();
// super.updateEntity(); if (!this.level.isClientSide) {
// if (!this.level.isClientSide) { int power = this.getPowerToGenerate(PRODUCE);
// int power = this.getPowerToGenerate(PRODUCE); if (this.level.isDay() && power > 0) {
// if (this.level.isDay() && power > 0) { if (power <= this.storage.getMaxEnergyStored() - this.storage.getEnergyStored()) {
// if (power <= this.storage.getMaxEnergyStored() - this.storage.getEnergyStored()) { this.storage.receiveEnergyInternal(power, false);
// this.storage.receiveEnergyInternal(power, false); this.setChanged();
// this.setChanged(); }
// } }
// }
// if (this.oldEnergy != this.storage.getEnergyStored() && this.sendUpdateWithInterval()) {
// if (this.oldEnergy != this.storage.getEnergyStored() && this.sendUpdateWithInterval()) { this.oldEnergy = this.storage.getEnergyStored();
// this.oldEnergy = this.storage.getEnergyStored(); }
// } }
// } }
// }
// public int getPowerToGenerate(int power) {
// public int getPowerToGenerate(int power) { for (int y = 1; y <= this.level.getMaxBuildHeight() - this.worldPosition.getY(); y++) {
// for (int y = 1; y <= this.level.getMaxBuildHeight() - this.worldPosition.getY(); y++) { if (power > 0) {
// if (power > 0) { BlockPos pos = this.worldPosition.above(y);
// BlockPos pos = this.worldPosition.above(y); BlockState state = this.level.getBlockState(pos);
// BlockState state = this.level.getBlockState(pos);
// if (state.getMaterial().isSolidBlocking()) {
// if (state.getMaterial().isSolidBlocking()) { power = 0;
// power = 0; } else if (!state.getBlock().isAir(state, this.level, pos)) {
// } else if (!state.getBlock().isAir(state, this.level, pos)) { power--;
// power--; }
// } } else {
// } else { break;
// break; }
// } }
// }
// return power;
// return power; }
// }
// @Override
// @Override public CustomEnergyStorage getEnergyStorage() {
// public CustomEnergyStorage getEnergyStorage() { return this.storage;
// return this.storage; }
// }
// @Override
// @Override public boolean needsHoldShift() {
// public boolean needsHoldShift() { return false;
// return false; }
// }
// @Override
// @Override public int getEnergyToSplitShare() {
// public int getEnergyToSplitShare() { return this.storage.getEnergyStored();
// return this.storage.getEnergyStored(); }
// }
// @Override
// @Override public boolean doesShareEnergy() {
// public boolean doesShareEnergy() { return true;
// return true; }
// }
// @Override
// @Override public Direction[] getEnergyShareSides() {
// public Direction[] getEnergyShareSides() { return Direction.values();
// return Direction.values(); }
// }
// @Override
// @Override public boolean canShareTo(TileEntity tile) {
// public boolean canShareTo(TileEntity tile) { return true;
// return true; }
// }
// @Override
// @Override public LazyOptional<IEnergyStorage> getEnergyStorage(Direction facing) {
// public LazyOptional<IEnergyStorage> getEnergyStorage(Direction facing) { return this.lazyEnergy;
// return this.lazyEnergy; }
// } }
//}

View file

@ -0,0 +1,20 @@
/*
* 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;
}
}

View file

@ -30,6 +30,8 @@ import net.minecraftforge.common.util.LazyOptional;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
public abstract class TileEntityPhantomface extends TileEntityInventoryBase implements IPhantomTile { public abstract class TileEntityPhantomface extends TileEntityInventoryBase implements IPhantomTile {
public static final int RANGE = 16; public static final int RANGE = 16;
public BlockPos boundPosition; public BlockPos boundPosition;
@ -174,7 +176,7 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl
this.boundPosition = pos; this.boundPosition = pos;
} }
//@Override @Override
public int getGuiID() { public int getGuiID() {
return -1; return -1;
} }

View file

@ -13,15 +13,19 @@ package de.ellpeck.actuallyadditions.mod.util;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; 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.particle.ParticleBeam;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.particle.Particle; import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.model.ItemCameraTransforms; 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.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.particles.IParticleData; import net.minecraft.particles.IParticleData;
@ -30,6 +34,9 @@ import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; 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 { public final class AssetUtil {
@ -85,7 +92,7 @@ public final class AssetUtil {
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static void renderItemWithoutScrewingWithColors(ItemStack stack) { public static void renderItemWithoutScrewingWithColors(ItemStack stack) {
/* if (StackUtil.isValid(stack)) { if (StackUtil.isValid(stack)) {
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
ItemRenderer renderer = mc.getItemRenderer(); ItemRenderer renderer = mc.getItemRenderer();
TextureManager manager = mc.getTextureManager(); TextureManager manager = mc.getTextureManager();
@ -105,12 +112,12 @@ public final class AssetUtil {
GlStateManager._disableBlend(); GlStateManager._disableBlend();
manager.bind(TextureMap.LOCATION_BLOCKS_TEXTURE); manager.bind(TextureMap.LOCATION_BLOCKS_TEXTURE);
manager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); manager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
}*/ }
} }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static void renderStackToGui(ItemStack stack, int x, int y, float scale) { public static void renderStackToGui(ItemStack stack, int x, int y, float scale) {
/* GlStateManager._pushMatrix(); GlStateManager._pushMatrix();
GlStateManager._enableBlend(); GlStateManager._enableBlend();
GlStateManager._blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager._blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderHelper.enableGUIStandardItemLighting(); RenderHelper.enableGUIStandardItemLighting();
@ -127,13 +134,13 @@ public final class AssetUtil {
mc.font.setUnicodeFlag(flagBefore); mc.font.setUnicodeFlag(flagBefore);
RenderHelper.turnOff(); RenderHelper.turnOff();
GlStateManager._popMatrix();*/ GlStateManager._popMatrix();
} }
//Copied from Gui.class and changed //Copied from Gui.class and changed
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static void drawHorizontalGradientRect(int left, int top, int right, int bottom, int startColor, int endColor, float zLevel) { 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 f1 = (startColor >> 16 & 255) / 255.0F;
float f2 = (startColor >> 8 & 255) / 255.0F; float f2 = (startColor >> 8 & 255) / 255.0F;
float f3 = (startColor & 255) / 255.0F; float f3 = (startColor & 255) / 255.0F;
@ -157,7 +164,7 @@ public final class AssetUtil {
GlStateManager._shadeModel(7424); GlStateManager._shadeModel(7424);
GlStateManager._disableBlend(); GlStateManager._disableBlend();
GlStateManager.enableAlpha(); GlStateManager.enableAlpha();
GlStateManager.enableTexture2D();*/ GlStateManager.enableTexture2D();
} }
// @OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
@ -214,7 +221,7 @@ public final class AssetUtil {
data.putFloat("Size", size); data.putFloat("Size", size);
data.putInt("MaxAge", maxAge); data.putInt("MaxAge", maxAge);
data.putFloat("Alpha", alpha); data.putFloat("Alpha", alpha);
//PacketHandler.THE_NETWORK.sendToAllAround(new PacketServerToClient(data, PacketHandler.LASER_HANDLER), new NetworkRegistry.TargetPoint(world.provider.getDimension(), startX, startY, startZ, 96)); //TODO PacketHandler.THE_NETWORK.sendToAllAround(new PacketServerToClient(data, PacketHandler.LASER_HANDLER), new NetworkRegistry.TargetPoint(world.provider.getDimension(), startX, startY, startZ, 96));
} }
} }
@ -254,7 +261,7 @@ public final class AssetUtil {
GlStateManager._pushMatrix(); GlStateManager._pushMatrix();
/* GlStateManager._disableLighting(); GlStateManager._disableLighting();
GlStateManager._enableBlend(); GlStateManager._enableBlend();
GlStateManager._blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); GlStateManager._blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
int func = GL11.glGetInteger(GL11.GL_ALPHA_TEST_FUNC); int func = GL11.glGetInteger(GL11.GL_ALPHA_TEST_FUNC);
@ -263,7 +270,7 @@ public final class AssetUtil {
GlStateManager.translate(firstX - TileEntityRendererDispatcher.staticPlayerX, firstY - TileEntityRendererDispatcher.staticPlayerY, firstZ - TileEntityRendererDispatcher.staticPlayerZ); 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 * yaw / Math.PI), 0, 1, 0);
GlStateManager.rotate((float) (180 * pitch / Math.PI), 0, 0, 1); 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){ /*if(r != r2 || g != g2 || b != b2){
render.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); render.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
@ -311,8 +318,8 @@ public final class AssetUtil {
tessy.draw(); tessy.draw();
} }
else{*/ else{*/
//GlStateManager.disableTexture2D(); GlStateManager.disableTexture2D();
//render.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR); render.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
for (double i = 0; i < 4; i++) { for (double i = 0; i < 4; i++) {
double width = beamWidth * (i / 4.0); 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(); render.vertex(length, width, width).uv(0, 0).uv2(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex();
@ -337,11 +344,11 @@ public final class AssetUtil {
} }
tessy.end(); tessy.end();
//GlStateManager.enableTexture2D(); GlStateManager.enableTexture2D();
//} //}
//GlStateManager._alphaFunc(func, ref); GlStateManager._alphaFunc(func, ref);
//GlStateManager._blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager._blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
GlStateManager._disableBlend(); GlStateManager._disableBlend();
GlStateManager._enableLighting(); GlStateManager._enableLighting();
GlStateManager._popMatrix(); GlStateManager._popMatrix();

View file

@ -18,33 +18,32 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.common.util.FakePlayerFactory; import net.minecraftforge.common.util.FakePlayerFactory;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.energy.IEnergyStorage;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.event.world.BlockEvent.BreakEvent; import net.minecraftforge.event.world.BlockEvent.BreakEvent;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.items.IItemHandler;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -76,7 +75,7 @@ public final class WorldUtil {
ItemStack extracted = StackUtil.getEmpty(); ItemStack extracted = StackUtil.getEmpty();
if (ActuallyAdditions.commonCapsLoaded) { if (ActuallyAdditions.commonCapsLoaded) {
/* Object handler = extractWrapper.getSlotlessHandler(); Object handler = extractWrapper.getSlotlessHandler();
if (handler instanceof ISlotlessItemHandler) { if (handler instanceof ISlotlessItemHandler) {
ISlotlessItemHandler slotless = (ISlotlessItemHandler) handler; ISlotlessItemHandler slotless = (ISlotlessItemHandler) handler;
@ -94,11 +93,11 @@ public final class WorldUtil {
} }
//Leave the possibility to fall back to vanilla when there is a filter //Leave the possibility to fall back to vanilla when there is a filter
} }
}*/ }
} }
if (!StackUtil.isValid(extracted)) { if (!StackUtil.isValid(extracted)) {
/* IItemHandler handler = extractWrapper.getNormalHandler(); IItemHandler handler = extractWrapper.getNormalHandler();
if (handler != null) { if (handler != null) {
for (int i = Math.max(0, slotStart); i < Math.min(slotEnd, handler.getSlots()); i++) { for (int i = Math.max(0, slotStart); i < Math.min(slotEnd, handler.getSlots()); i++) {
if (filter == null || !filter.needsCheck() || filter.check(handler.getStackInSlot(i))) { if (filter == null || !filter.needsCheck() || filter.check(handler.getStackInSlot(i))) {
@ -109,7 +108,7 @@ public final class WorldUtil {
} }
} }
} }
}*/ }
} }
return extracted; return extracted;
@ -118,35 +117,32 @@ public final class WorldUtil {
public static void doEnergyInteraction(TileEntity tileFrom, TileEntity tileTo, Direction sideTo, int maxTransfer) { public static void doEnergyInteraction(TileEntity tileFrom, TileEntity tileTo, Direction sideTo, int maxTransfer) {
if (maxTransfer > 0) { if (maxTransfer > 0) {
Direction opp = sideTo == null Direction opp = sideTo == null
? null ? null
: sideTo.getOpposite(); : sideTo.getOpposite();
LazyOptional<IEnergyStorage> handlerFrom = tileFrom.getCapability(CapabilityEnergy.ENERGY, sideTo); IEnergyStorage handlerFrom = tileFrom.getCapability(CapabilityEnergy.ENERGY, sideTo);
LazyOptional<IEnergyStorage> handlerTo = tileTo.getCapability(CapabilityEnergy.ENERGY, opp); IEnergyStorage handlerTo = tileTo.getCapability(CapabilityEnergy.ENERGY, opp);
handlerFrom.ifPresent((from) -> { if (handlerFrom != null && handlerTo != null) {
handlerTo.ifPresent((to) -> { int drain = handlerFrom.extractEnergy(maxTransfer, true);
int drain = from.extractEnergy(maxTransfer, true); if (drain > 0) {
if (drain > 0) { int filled = handlerTo.receiveEnergy(drain, false);
int filled = to.receiveEnergy(drain, false); handlerFrom.extractEnergy(filled, false);
to.extractEnergy(filled, false); return;
} }
}); }
});
} }
} }
public static void doFluidInteraction(TileEntity tileFrom, TileEntity tileTo, Direction sideTo, int maxTransfer) { public static void doFluidInteraction(TileEntity tileFrom, TileEntity tileTo, Direction sideTo, int maxTransfer) {
if (maxTransfer > 0) { if (maxTransfer > 0) {
LazyOptional<IFluidHandler> optionalFrom = tileFrom.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, sideTo); if (tileFrom.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, sideTo) && tileTo.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, sideTo.getOpposite())) {
LazyOptional<IFluidHandler> optionalTo = tileTo.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, sideTo.getOpposite()); IFluidHandler handlerFrom = tileFrom.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, sideTo);
optionalFrom.ifPresent((from) -> { IFluidHandler handlerTo = tileTo.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, sideTo.getOpposite());
optionalTo.ifPresent((to) -> { FluidStack drain = handlerFrom.drain(maxTransfer, false);
FluidStack drain = from.drain(maxTransfer, IFluidHandler.FluidAction.SIMULATE); if (drain != null) {
if (!drain.isEmpty()) { int filled = handlerTo.fill(drain.copy(), true);
int filled = to.fill(drain.copy(), IFluidHandler.FluidAction.EXECUTE); handlerFrom.drain(filled, true);
from.drain(filled, IFluidHandler.FluidAction.EXECUTE); }
} }
});
});
} }
} }
@ -169,11 +165,11 @@ public final class WorldUtil {
} }
public static ItemStack useItemAtSide(Direction side, World world, BlockPos pos, ItemStack stack) { public static ItemStack useItemAtSide(Direction side, World world, BlockPos pos, ItemStack stack) {
if (world instanceof ServerWorld && StackUtil.isValid(stack) && pos != null) { if (world instanceof WorldServer && StackUtil.isValid(stack) && pos != null) {
BlockPos offsetPos = pos.relative(side); BlockPos offsetPos = pos.relative(side);
BlockState state = world.getBlockState(offsetPos); BlockState state = world.getBlockState(offsetPos);
Block block = state.getBlock(); Block block = state.getBlock();
boolean replaceable = false; //= block.canBeReplaced(world, offsetPos); //TODO boolean replaceable = block.canBeReplaced(world, offsetPos);
//Redstone //Redstone
if (replaceable && stack.getItem() == Items.REDSTONE) { if (replaceable && stack.getItem() == Items.REDSTONE) {
@ -182,28 +178,28 @@ public final class WorldUtil {
} }
//Plants //Plants
/* if (replaceable && stack.getItem() instanceof IPlantable) { //TODO if (replaceable && stack.getItem() instanceof IPlantable) {
if (((IPlantable) stack.getItem()).getPlant(world, offsetPos).getBlock().canPlaceBlockAt(world, offsetPos)) { if (((IPlantable) stack.getItem()).getPlant(world, offsetPos).getBlock().canPlaceBlockAt(world, offsetPos)) {
if (world.setBlock(offsetPos, ((IPlantable) stack.getItem()).getPlant(world, offsetPos), 2)) { if (world.setBlock(offsetPos, ((IPlantable) stack.getItem()).getPlant(world, offsetPos), 2)) {
return StackUtil.shrink(stack, 1); return StackUtil.shrink(stack, 1);
} }
} }
}*/ }
//Everything else //Everything else
try { try {
FakePlayer fake = FakePlayerFactory.getMinecraft((ServerWorld) world); FakePlayer fake = FakePlayerFactory.getMinecraft((WorldServer) world);
if (fake.connection == null) { if (fake.connection == null) {
fake.connection = new NetHandlerSpaghettiServer(fake); fake.connection = new NetHandlerSpaghettiServer(fake);
} }
ItemStack heldBefore = fake.getMainHandItem(); ItemStack heldBefore = fake.getMainHandItem();
setHandItemWithoutAnnoyingSound(fake, Hand.MAIN_HAND, stack.copy()); setHandItemWithoutAnnoyingSound(fake, Hand.MAIN_HAND, stack.copy());
//fake.gameMode.useItemOn(fake, world, fake.getMainHandItem(), Hand.MAIN_HAND, offsetPos, side.getOpposite(), 0.5F, 0.5F, 0.5F); //TODO fake.gameMode.processRightClickBlock(fake, world, fake.getMainHandItem(), Hand.MAIN_HAND, offsetPos, side.getOpposite(), 0.5F, 0.5F, 0.5F);
ItemStack result = fake.getItemInHand(Hand.MAIN_HAND); ItemStack result = fake.getItemInHand(Hand.MAIN_HAND);
setHandItemWithoutAnnoyingSound(fake, Hand.MAIN_HAND, heldBefore); setHandItemWithoutAnnoyingSound(fake, Hand.MAIN_HAND, heldBefore);
return result; return result;
} catch (Exception e) { } catch (Exception 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); 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);
} }
} }
return stack; return stack;
@ -212,10 +208,12 @@ public final class WorldUtil {
public static boolean dropItemAtSide(Direction side, World world, BlockPos pos, ItemStack stack) { public static boolean dropItemAtSide(Direction side, World world, BlockPos pos, ItemStack stack) {
BlockPos coords = pos.relative(side); BlockPos coords = pos.relative(side);
if (world.hasChunkAt(coords)) { if (world.hasChunkAt(coords)) {
ItemEntity item = new ItemEntity(world, coords.getX() + 0.5, coords.getY() + 0.5, coords.getZ() + 0.5, stack); EntityItem item = new EntityItem(world, coords.getX() + 0.5, coords.getY() + 0.5, coords.getZ() + 0.5, stack);
item.setDeltaMovement(0,0,0); item.motionX = 0;
item.motionY = 0;
item.motionZ = 0;
return world.addFreshEntity(item); return world.spawnEntity(item);
} }
return false; return false;
} }
@ -238,7 +236,7 @@ public final class WorldUtil {
} }
public static Direction getDirectionByPistonRotation(BlockState state) { public static Direction getDirectionByPistonRotation(BlockState state) {
return state.getValue(BlockStateProperties.FACING); return state.getValue(BlockDirectional.FACING);
} }
public static ArrayList<Material> getMaterialsAround(World world, BlockPos pos) { public static ArrayList<Material> getMaterialsAround(World world, BlockPos pos) {
@ -257,9 +255,9 @@ public final class WorldUtil {
private static RayTraceResult getMovingObjectPosWithReachDistance(World world, PlayerEntity player, double distance, boolean p1, boolean p2, boolean p3) { private static RayTraceResult getMovingObjectPosWithReachDistance(World world, PlayerEntity player, double distance, boolean p1, boolean p2, boolean p3) {
float f = player.xRot; float f = player.xRot;
float f1 = player.yRot; float f1 = player.yRot;
double d0 = player.position().x; double d0 = player.posX;
double d1 = player.position().y + player.getEyeHeight(); double d1 = player.posY + player.getEyeHeight();
double d2 = player.position().z; double d2 = player.posZ;
Vector3d vec3 = new Vector3d(d0, d1, d2); Vector3d vec3 = new Vector3d(d0, d1, d2);
float f2 = MathHelper.cos(-f1 * 0.017453292F - (float) Math.PI); float f2 = MathHelper.cos(-f1 * 0.017453292F - (float) Math.PI);
float f3 = MathHelper.sin(-f1 * 0.017453292F - (float) Math.PI); float f3 = MathHelper.sin(-f1 * 0.017453292F - (float) Math.PI);
@ -268,9 +266,7 @@ public final class WorldUtil {
float f6 = f3 * f4; float f6 = f3 * f4;
float f7 = f2 * f4; float f7 = f2 * f4;
Vector3d vec31 = vec3.add(f6 * distance, f5 * distance, f7 * distance); Vector3d vec31 = vec3.add(f6 * distance, f5 * distance, f7 * distance);
//return world.clipWithInteractionOverride(vec3, vec31, p1, p2, p3); //TODO return world.clipWithInteractionOverride(vec3, vec31, p1, p2, p3);
return new BlockRayTraceResult(Vector3d.ZERO, Direction.DOWN, BlockPos.ZERO, false);
} }
public static RayTraceResult getNearestBlockWithDefaultReachDistance(World world, PlayerEntity player) { public static RayTraceResult getNearestBlockWithDefaultReachDistance(World world, PlayerEntity player) {
@ -278,8 +274,7 @@ public final class WorldUtil {
} }
public static RayTraceResult getNearestBlockWithDefaultReachDistance(World world, PlayerEntity player, boolean stopOnLiquids, boolean ignoreBlockWithoutBoundingBox, boolean returnLastUncollidableBlock) { public static RayTraceResult getNearestBlockWithDefaultReachDistance(World world, PlayerEntity player, boolean stopOnLiquids, boolean ignoreBlockWithoutBoundingBox, boolean returnLastUncollidableBlock) {
return new BlockRayTraceResult(Vector3d.ZERO, Direction.DOWN, BlockPos.ZERO, false); //TODO return getMovingObjectPosWithReachDistance(world, player, player.getEntityAttribute(PlayerEntity.REACH_DISTANCE).getAttributeValue(), stopOnLiquids, ignoreBlockWithoutBoundingBox, returnLastUncollidableBlock);
//return getMovingObjectPosWithReachDistance(world, player, player.getAttribute(PlayerEntity.REACH_DISTANCE).getAttributeValue(), stopOnLiquids, ignoreBlockWithoutBoundingBox, returnLastUncollidableBlock);
} }
public static void setHandItemWithoutAnnoyingSound(PlayerEntity player, Hand hand, ItemStack stack) { public static void setHandItemWithoutAnnoyingSound(PlayerEntity player, Hand hand, ItemStack stack) {
@ -300,7 +295,7 @@ public final class WorldUtil {
BreakEvent event = new BreakEvent(world, pos, state, fake); BreakEvent event = new BreakEvent(world, pos, state, fake);
if (!MinecraftForge.EVENT_BUS.post(event)) { if (!MinecraftForge.EVENT_BUS.post(event)) {
//return ForgeEventFactory.fireBlockHarvesting(drops, world, pos, state, 0, 1, false, fake); //TODO what?! return ForgeEventFactory.fireBlockHarvesting(drops, world, pos, state, 0, 1, false, fake);
} }
} }
return 0F; return 0F;
@ -320,13 +315,13 @@ public final class WorldUtil {
Block block = state.getBlock(); Block block = state.getBlock();
if (player.isCreative()) { if (player.isCreative()) {
if (block.removedByPlayer(state, world, pos, player, false, state.getFluidState())) { if (block.removedByPlayer(state, world, pos, player, false)) {
block.destroy(world, pos, state); block.destroy(world, pos, state);
} }
// send update to client // send update to client
if (!world.isClientSide) { if (!world.isClientSide) {
//((ServerPlayerEntity) player).connection.send(new SPacketBlockChange(world, pos)); //TODO dunno what this is ((ServerPlayerEntity) player).connection.send(new SPacketBlockChange(world, pos));
} }
return true; return true;
} }
@ -343,14 +338,14 @@ public final class WorldUtil {
} }
TileEntity tileEntity = world.getBlockEntity(pos); TileEntity tileEntity = world.getBlockEntity(pos);
if (block.removedByPlayer(state, world, pos, player, true, state.getFluidState())) { // boolean is if block can be harvested, checked above if (block.removedByPlayer(state, world, pos, player, true)) { // boolean is if block can be harvested, checked above
block.destroy(world, pos, state); block.destroy(world, pos, state);
block.playerDestroy(world, player, pos, state, tileEntity, stack); block.playerDestroy(world, player, pos, state, tileEntity, stack);
block.popExperience(((ServerWorld) world), pos, xp); block.popExperience(world, pos, xp);
} }
// always send block update to client // always send block update to client
//((ServerPlayerEntity) player).connection.send(new SPacketBlockChange(world, pos)); //TODO how ((ServerPlayerEntity) player).connection.send(new SPacketBlockChange(world, pos));
return true; return true;
} }
// client sided handling // client sided handling
@ -360,7 +355,7 @@ public final class WorldUtil {
// following code can be found in PlayerControllerMP.onPlayerDestroyBlock // following code can be found in PlayerControllerMP.onPlayerDestroyBlock
world.levelEvent(2001, pos, Block.getId(state)); world.levelEvent(2001, pos, Block.getId(state));
if (block.removedByPlayer(state, world, pos, player, true, state.getFluidState())) { if (block.removedByPlayer(state, world, pos, player, true)) {
block.destroy(world, pos, state); block.destroy(world, pos, state);
} }
// callback to the tool // callback to the tool