Compare commits

..

10 commits

Author SHA1 Message Date
Flanks255
ac3551061d COMPILE 2021-11-21 14:18:00 -06:00
Flanks255
eb3072bcbe ?! 2021-11-21 14:05:27 -06:00
Michael Hillcox
b3a00f8d4e fix: rings 2021-11-21 20:02:08 +00:00
Michael Hillcox
3980b8dc46 Merge remote-tracking branch 'origin/1.16' into 1.16 2021-11-21 19:57:32 +00:00
Michael Hillcox
5236744941 fix: yeet solar furnace? 2021-11-21 19:57:27 +00:00
Flanks255
b6406c7adc Under 100. 2021-11-21 13:49:33 -06:00
Michael Hillcox
4273fdd0f5 fix: yeet method handler methods for booklet until the booklet is added back 2021-11-21 18:33:57 +00:00
Flanks255
eccf77dd54 something something crusher screen is done i think... 2021-11-21 11:36:46 -06:00
Flanks255
01ee39973a So many errors.... 2021-11-21 10:57:50 -06:00
Flanks255
4b57b9fb45 So many errors... 2021-11-21 10:31:57 -06:00
56 changed files with 746 additions and 817 deletions

View file

@ -10,15 +10,10 @@
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;
@ -50,25 +45,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,8 +48,7 @@ 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(), GuiGrinder::new); ScreenManager.register(ActuallyContainers.GRINDER_CONTAINER.get(), CrusherScreen::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);
@ -82,7 +81,7 @@ public class ActuallyAdditionsClient {
} }
// TODO: [port] validate that this works // TODO: [port] validate that this works
public void sendBreakPacket(BlockPos pos) { public static 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,8 +21,6 @@ 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;
@ -39,7 +37,6 @@ 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 {
@ -107,14 +104,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,8 +29,7 @@ public class ActuallyContainers {
public static final RegistryObject<ContainerType<ContainerFireworkBox>> FIREWORK_BOX_CONTAINER = CONTAINERS.register("firework_box_container", () -> IForgeContainerType.create(ContainerFireworkBox::fromNetwork)); public static final RegistryObject<ContainerType<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<ContainerGrinder>> GRINDER_CONTAINER = CONTAINERS.register("grinder_container", () -> IForgeContainerType.create(ContainerGrinder::fromNetwork)); public static final RegistryObject<ContainerType<CrusherContainer>> GRINDER_CONTAINER = CONTAINERS.register("grinder_container", () -> IForgeContainerType.create(CrusherContainer::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 ContainerGrinder extends Container { public class CrusherContainer extends Container {
public final TileEntityCrusher tileGrinder; public final TileEntityCrusher tileGrinder;
public final boolean isDouble; public final boolean isDouble;
public ContainerGrinder(int windowId, PlayerInventory inventory, TileEntityCrusher tile) { public CrusherContainer(int windowId, PlayerInventory inventory, TileEntityCrusher tile) {
super(ActuallyContainers.GRINDER_CONTAINER.get(), windowId); 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 ContainerGrinder extends Container {
} }
} }
public static ContainerGrinder fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { public static CrusherContainer fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
return new ContainerGrinder(windowId, inv, (TileEntityCrusher) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); return new CrusherContainer(windowId, inv, (TileEntityCrusher) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos())));
} }
@Override @Override

View file

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

View file

@ -12,26 +12,22 @@ 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.CrusherContainer;
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 GuiGrinder extends GuiWtfMojang<ContainerGrinder> { public class CrusherScreen extends GuiWtfMojang<CrusherContainer> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_grinder"); private static final ResourceLocation RES_LOC = 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");
@ -41,7 +37,7 @@ public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
private Button buttonAutoSplit; private Button buttonAutoSplit;
public GuiGrinder(ContainerGrinder container, PlayerInventory inventory, ITextComponent title) { public CrusherScreen(CrusherContainer 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;
@ -57,15 +53,14 @@ public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
: 42), this.topPos + 5, this.tileGrinder.storage); : 42), this.topPos + 5, this.tileGrinder.storage);
if (this.isDouble) { if (this.isDouble) {
this.buttonAutoSplit = new GuiInputter.SmallerButton(0, this.leftPos - 10, this.topPos, "S"); this.buttonAutoSplit = new Buttons.SmallerButton( this.leftPos - 10, this.topPos, new StringTextComponent("S"), (button) -> actionPerformed(0));
this.addButton(this.buttonAutoSplit); this.addButton(this.buttonAutoSplit);
} }
} }
@Override protected void actionPerformed(int id) {
protected void actionPerformed(Button button) throws IOException { if (this.isDouble && id == 0) {
if (this.isDouble && button.id == 0) { PacketHandlerHelper.sendButtonPacket(this.tileGrinder, id);
PacketHandlerHelper.sendButtonPacket(this.tileGrinder, button.id);
} }
} }
@ -81,15 +76,13 @@ public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
} }
@Override @Override
public void render(MatrixStack matrices, int x, int y, float f) { public void render(MatrixStack matrixStack, int x, int y, float f) {
super.render(matrices, x, y, f); super.render(matrixStack, x, y, f);
this.energy.render(matrices, x, y); this.energy.render(matrixStack, x, y);
if (this.isDouble && this.buttonAutoSplit.isMouseOver()) { if (this.isDouble && this.buttonAutoSplit.isMouseOver(x,y)) {
this.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.tileGrinder.isAutoSplit drawString(matrixStack, font, new TranslationTextComponent("info.actuallyadditions.gui.autosplititems." + (tileGrinder.isAutoSplit?"on":"off")).withStyle(TextFormatting.BOLD), x , y, 0xffffff);
? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.on")
: StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.off"))), x, y);
} }
} }
@ -126,10 +119,10 @@ public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
this.energy.draw(matrices); this.energy.draw(matrices);
} }
public static class GuiGrinderDouble extends GuiGrinder { public static class CrusherDoubleScreen extends CrusherScreen {
public GuiGrinderDouble(ContainerGrinder containerGrinder, PlayerInventory inventory, ITextComponent tile) { public CrusherDoubleScreen(CrusherContainer crusherContainer, PlayerInventory inventory, ITextComponent tile) {
super(containerGrinder, inventory, tile); super(crusherContainer, inventory, tile);
} }
} }
} }

View file

@ -18,6 +18,7 @@ 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;
@ -38,19 +39,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(this.theSettings.whitelistButtonId, x, y, true); this.whitelistButton = new Buttons.SmallerButton( x, y, new TranslationTextComponent(""), true, Button::onPress); //TODO these need translation keys
buttonList.add(this.whitelistButton); buttonList.add(this.whitelistButton);
y += 14; y += 14;
this.metaButton = new Buttons.SmallerButton(this.theSettings.metaButtonId, x, y, true); this.metaButton = new Buttons.SmallerButton( x, y, new TranslationTextComponent(""), true, Button::onPress); //TODO also button actions
buttonList.add(this.metaButton); buttonList.add(this.metaButton);
y += 14; y += 14;
this.nbtButton = new Buttons.SmallerButton(this.theSettings.nbtButtonId, x, y, true); this.nbtButton = new Buttons.SmallerButton( x, y, new TranslationTextComponent(""), true, Button::onPress);
buttonList.add(this.nbtButton); buttonList.add(this.nbtButton);
y += 14; y += 14;
this.oredictButton = new Buttons.SmallerButton(this.theSettings.oredictButtonId, x, y, true); this.oredictButton = new Buttons.SmallerButton( x, y, new TranslationTextComponent(""), true, Button::onPress);
buttonList.add(this.oredictButton); buttonList.add(this.oredictButton);
y += 15; y += 15;
this.modButton = new Buttons.SmallerButton(this.theSettings.modButtonId, x, y, true); this.modButton = new Buttons.SmallerButton( x, y, new TranslationTextComponent(""), true, Button::onPress);
buttonList.add(this.modButton); buttonList.add(this.modButton);
this.tick(); this.tick();
@ -103,7 +104,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()) { } else if (this.oredictButton.isMouseOver(mouseX, mouseY)) {
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,9 +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.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;
@ -21,16 +18,11 @@ 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 FluidTank fluidReference; private FluidStack fluidReference;
private Fluid oldFluid; private Fluid oldFluid;
private int x; private int x;
@ -41,15 +33,15 @@ public class FluidDisplay extends AbstractGui {
private boolean drawTextNextTo; private boolean drawTextNextTo;
public FluidDisplay(int x, int y, FluidTank fluidReference, boolean outline, boolean drawTextNextTo) { public FluidDisplay(int x, int y, FluidStack fluidReference, boolean outline, boolean drawTextNextTo) {
this.setData(x, y, fluidReference, outline, drawTextNextTo); this.setData(x, y, fluidReference, outline, drawTextNextTo);
} }
public FluidDisplay(int x, int y, FluidTank fluidReference) { public FluidDisplay(int x, int y, FluidStack fluidReference) {
this(x, y, fluidReference, false, false); this(x, y, fluidReference, false, false);
} }
public void setData(int x, int y, FluidTank fluidReference, boolean outline, boolean drawTextNextTo) { public void setData(int x, int y, FluidStack fluidReference, boolean outline, boolean drawTextNextTo) {
this.x = x; this.x = x;
this.y = y; this.y = y;
this.fluidReference = fluidReference; this.fluidReference = fluidReference;
@ -58,7 +50,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;
@ -101,7 +93,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) {
@ -111,16 +103,17 @@ 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,23 +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.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");
@ -51,22 +40,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() {
@ -78,19 +67,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"
@ -98,7 +87,7 @@ public class GuiBag extends GuiWtfMojang<ContainerBag> {
text.addAll(this.font.listFormattedStringToWidth("Turn this on to make items that get picked up automatically go into the bag.", 200)); text.addAll(this.font.listFormattedStringToWidth("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,6 +11,7 @@
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;
@ -41,7 +42,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
@ -68,6 +69,6 @@ public class GuiBioReactor extends GuiWtfMojang<ContainerBioReactor> {
drawCenteredString(matrices, this.font, this.tile.producePerTick + " " + I18n.get("actuallyadditions.cft"), this.leftPos + 87, this.topPos + 86, 0xFFFFFF); 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,6 +11,7 @@
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;
@ -38,8 +39,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,6 +11,7 @@
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,19 +14,15 @@ 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> {
@ -47,11 +43,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
@ -60,7 +56,7 @@ public class GuiCoffeeMachine extends GuiWtfMojang<ContainerCoffeeMachine> {
String text2 = this.machine.coffeeCacheAmount + "/" + TileEntityCoffeeMachine.COFFEE_CACHE_MAX_AMOUNT + " " + StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.coffee"); 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);
@ -99,8 +95,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,6 +11,7 @@
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,6 +11,7 @@
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,6 +11,7 @@
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,6 +11,7 @@
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,6 +11,7 @@
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,6 +11,7 @@
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,6 +11,7 @@
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;
@ -22,8 +23,6 @@ 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> {
@ -46,7 +45,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,6 +11,7 @@
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;
@ -46,8 +47,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.canolaTank); this.input = new FluidDisplay(this.leftPos + 60, this.topPos + 5, this.press.tanks.canolaTank);
this.output = new FluidDisplay(this.leftPos + 98, this.topPos + 5, this.press.oilTank); this.output = new FluidDisplay(this.leftPos + 98, this.topPos + 5, this.press.tanks.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,12 +12,9 @@ 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;
@ -27,9 +24,6 @@ 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> {
@ -51,11 +45,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
@ -63,8 +57,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);
} }
@ -77,12 +71,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

@ -14,7 +14,6 @@ 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;
@ -22,13 +21,9 @@ 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> {
@ -60,30 +55,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,11 +13,9 @@ 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;
@ -42,13 +40,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
@ -72,8 +70,8 @@ public class GuiMiner extends GuiWtfMojang<ContainerMiner> {
this.font.draw(matrices, mining, this.leftPos + this.imageWidth / 2 - this.font.width(mining) / 2, this.topPos + 8, StringUtil.DECIMAL_COLOR_GRAY_TEXT); 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,24 +12,15 @@ 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> {
@ -47,44 +38,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,10 +13,8 @@ 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;
@ -43,14 +41,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
@ -76,8 +74,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,16 +13,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.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;
@ -43,35 +39,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
@ -92,10 +88,10 @@ public class GuiXPSolidifier extends GuiWtfMojang<ContainerXPSolidifier> {
drawCenteredString(matrices, this.font, Integer.toString(this.solidifier.amount), this.leftPos + 88, this.topPos + 30, StringUtil.DECIMAL_COLOR_WHITE); 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.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.items.base.ItemArmorAA;
import de.ellpeck.actuallyadditions.mod.items.base.*; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import de.ellpeck.actuallyadditions.mod.items.base.ItemHoeAA;
import de.ellpeck.actuallyadditions.mod.items.base.ItemSwordAA;
import de.ellpeck.actuallyadditions.mod.items.lens.ItemLens; import de.ellpeck.actuallyadditions.mod.items.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", ItemFoods::new); //just... food? public static final RegistryObject<Item> FOOD = ITEMS.register("food", ItemBase::new); //just... food? //TODO
public static final RegistryObject<Item> JAM = ITEMS.register("jam", ItemJams::new); public static final RegistryObject<Item> 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", () -> new ItemSeed("seedRice", ActuallyBlocks.RICE.get(), FOOD.get(), TheFoods.RICE.ordinal())); public static final RegistryObject<Item> RICE_SEED = ITEMS.register("rice_seed", ItemBase::new); //() -> new ItemSeed("seedRice", ActuallyBlocks.RICE.get(), FOOD.get(), TheFoods.RICE.ordinal()));
public static final RegistryObject<Item> CANOLA_SEED = ITEMS.register("canola_seed", () -> 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", ItemBase::new); //() -> new ItemFoodSeed("seedCanola", ActuallyBlocks.CANOLA, itemMisc, 0, 1, 0.01F, 10).setPotionEffect(new PotionEffect(MobEffects.NAUSEA, 1000, 0), 0.2F));
public static final RegistryObject<Item> FLAX_SEED = ITEMS.register("flax_seed", () -> new ItemSeed("seedFlax", ActuallyBlocks.FLAX, Items.STRING, 0)); public static final RegistryObject<Item> FLAX_SEED = ITEMS.register("flax_seed", ItemBase::new); //() -> new ItemSeed("seedFlax", ActuallyBlocks.FLAX, Items.STRING, 0));
public static final RegistryObject<Item> COFFEE_SEED = ITEMS.register("coffee_seed", () -> new ItemSeed("seedCoffeeBeans", ActuallyBlocks.COFFEE, COFFEE_BEANS, 0)); public static final RegistryObject<Item> COFFEE_SEED = ITEMS.register("coffee_seed", ItemBase::new); //() -> 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", () -> new ItemShovelAA(ToolMaterials.BLACK_QUARTZ)); public static final RegistryObject<Item> SHOVEL_QUARTZ = ITEMS.register("shovel_quartz", ItemBase::new); //() -> new ItemShovelAA(ToolMaterials.BLACK_QUARTZ));
public static final RegistryObject<Item> SWORD_QUARTZ = ITEMS.register("sword_quartz", () -> new ItemSwordAA(ToolMaterials.BLACK_QUARTZ)); public static final RegistryObject<Item> 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", () -> new ItemShovelAA(ToolMaterials.RESTONIA)); public static final RegistryObject<Item> SHOVEL_CRYSTAL_RESTONIA = ITEMS.register("shovel_crystal_restonia", ItemBase::new); // () -> new ItemShovelAA(ToolMaterials.RESTONIA));
public static final RegistryObject<Item> SWORD_CRYSTAL_RESTONIA = ITEMS.register("sword_crystal_restonia", () -> new ItemSwordAA(ToolMaterials.RESTONIA)); public static final RegistryObject<Item> 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", () -> new ItemShovelAA(ToolMaterials.PALIS)); public static final RegistryObject<Item> SHOVEL_CRYSTAL_PALIS = ITEMS.register("shovel_crystal_palis", ItemBase::new); //() -> new ItemShovelAA(ToolMaterials.PALIS));
public static final RegistryObject<Item> SWORD_CRYSTAL_PALIS = ITEMS.register("sword_crystal_palis", () -> new ItemSwordAA(ToolMaterials.PALIS)); public static final RegistryObject<Item> 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", () -> new ItemShovelAA(ToolMaterials.DIAMATINE)); public static final RegistryObject<Item> SHOVEL_CRYSTAL_DIAMATINE = ITEMS.register("shovel_crystal_diamatine", ItemBase::new); //() -> new ItemShovelAA(ToolMaterials.DIAMATINE));
public static final RegistryObject<Item> SWORD_CRYSTAL_DIAMATINE = ITEMS.register("sword_crystal_diamatine", () -> new ItemSwordAA(ToolMaterials.DIAMATINE)); public static final RegistryObject<Item> 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", () -> new ItemShovelAA(ToolMaterials.VOID)); public static final RegistryObject<Item> SHOVEL_CRYSTAL_VOID = ITEMS.register("shovel_crystal_void", ItemBase::new); // () -> new ItemShovelAA(ToolMaterials.VOID));
public static final RegistryObject<Item> SWORD_CRYSTAL_VOID = ITEMS.register("sword_crystal_void", () -> new ItemSwordAA(ToolMaterials.VOID)); public static final RegistryObject<Item> 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", () -> new ItemShovelAA(ToolMaterials.EMERADIC)); public static final RegistryObject<Item> SHOVEL_CRYSTAL_EMERADIC = ITEMS.register("shovel_crystal_emeradic", ItemBase::new); //() -> new ItemShovelAA(ToolMaterials.EMERADIC));
public static final RegistryObject<Item> SWORD_CRYSTAL_EMERADIC = ITEMS.register("sword_crystal_emeradic", () -> new ItemSwordAA(ToolMaterials.EMERADIC)); public static final RegistryObject<Item> 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", () -> new ItemShovelAA(ToolMaterials.ENORI)); public static final RegistryObject<Item> SHOVEL_CRYSTAL_ENORI = ITEMS.register("shovel_crystal_enori", ItemBase::new); //() -> new ItemShovelAA(ToolMaterials.ENORI));
public static final RegistryObject<Item> SWORD_CRYSTAL_ENORI = ITEMS.register("sword_crystal_enori", () -> new ItemSwordAA(ToolMaterials.ENORI)); public static final RegistryObject<Item> 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,20 +10,33 @@
package de.ellpeck.actuallyadditions.mod.items; package de.ellpeck.actuallyadditions.mod.items;
import com.google.common.collect.Sets; import com.google.common.collect.ImmutableSet;
import de.ellpeck.actuallyadditions.mod.items.base.ItemToolAA; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
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.ItemStack; import net.minecraft.item.ToolItem;
import net.minecraftforge.common.ToolType;
import java.util.Collections; public class ItemAxeAA extends ToolItem {
import java.util.Set; private IItemTier tier;
public ItemAxeAA(IItemTier tier) {
super(
4.0f,
-2f,
tier,
ImmutableSet.of(),
new Properties()
.addToolType(ToolType.AXE, tier.getLevel())
.addToolType(ToolType.HOE, tier.getLevel())
.addToolType(ToolType.SHOVEL, tier.getLevel())
.addToolType(ToolType.PICKAXE, tier.getLevel())
.durability(tier.getUses() * 4)
.tab(ActuallyAdditions.GROUP)
);
public class ItemAxeAA extends ItemToolAA { this.tier = tier;
}
/*
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.PLANKS, Blocks.BOOKSHELF, Blocks.LOG, Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK, Blocks.LADDER, Blocks.WOODEN_BUTTON, Blocks.WOODEN_PRESSURE_PLATE); 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) {
@ -42,5 +55,5 @@ public class ItemAxeAA extends ItemToolAA {
@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,20 +10,33 @@
package de.ellpeck.actuallyadditions.mod.items; package de.ellpeck.actuallyadditions.mod.items;
import com.google.common.collect.Sets; import com.google.common.collect.ImmutableSet;
import de.ellpeck.actuallyadditions.mod.items.base.ItemToolAA; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
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.ItemStack; import net.minecraft.item.ToolItem;
import net.minecraftforge.common.ToolType;
import java.util.Collections; public class ItemPickaxeAA extends ToolItem {
import java.util.Set; private final IItemTier tier;
public ItemPickaxeAA(IItemTier tier) {
super(
4.0f,
-2f,
tier,
ImmutableSet.of(),
new Properties()
.addToolType(ToolType.AXE, tier.getLevel())
.addToolType(ToolType.HOE, tier.getLevel())
.addToolType(ToolType.SHOVEL, tier.getLevel())
.addToolType(ToolType.PICKAXE, tier.getLevel())
.durability(tier.getUses() * 4)
.tab(ActuallyAdditions.GROUP)
);
public class ItemPickaxeAA extends ItemToolAA { this.tier = tier;
}
/*
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.DOUBLE_STONE_SLAB, Blocks.GOLDEN_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.ICE, Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.LIT_REDSTONE_ORE, Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, Blocks.SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.STONE_SLAB, Blocks.STONE_BUTTON, Blocks.STONE_PRESSURE_PLATE); 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) {
@ -76,5 +89,5 @@ public class ItemPickaxeAA extends ItemToolAA {
@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,39 +15,40 @@ 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.entity.player.PlayerEntity; import net.minecraft.item.*;
import net.minecraft.item.IItemTier; import net.minecraft.tags.ITag;
import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResultType;
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_LAYER, Blocks.SOUL_SAND, Blocks.GRASS_PATH); private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.CLAY, Blocks.DIRT, Blocks.FARMLAND, Blocks.GRASS, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_BLOCK, Blocks.SOUL_SAND, Blocks.GRASS_PATH);
public ItemShovelAA(IItemTier material) { public ItemShovelAA(float p_i48512_1_, float p_i48512_2_, IItemTier p_i48512_3_, Set<Block> p_i48512_4_, Properties p_i48512_5_, String name, ItemStack repairItem, ITag<Item> repairTag) {
super(1.5F, -3.0F, material, this.repairItem, unlocalizedName, this.rarity, EFFECTIVE_ON); super(p_i48512_1_, p_i48512_2_, p_i48512_3_, p_i48512_4_, p_i48512_5_, name, repairItem, repairTag);
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_LAYER || block == Blocks.SNOW; return block == Blocks.SNOW_BLOCK || block == Blocks.SNOW;
} }
@Nonnull
@Override @Override
public EnumActionResult onItemUse(PlayerEntity playerIn, World worldIn, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) { public ActionResultType useOn(ItemUseContext useContext) {
return Items.IRON_SHOVEL.onItemUse(playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ); return Items.IRON_SHOVEL.useOn(useContext);
} }
@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,17 +10,30 @@
package de.ellpeck.actuallyadditions.mod.items.base; package de.ellpeck.actuallyadditions.mod.items.base;
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
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.minecraft.item.ItemStack; import net.minecraftforge.common.ToolType;
public class ItemHoeAA extends HoeItem implements IDisableableItem { public class ItemHoeAA extends HoeItem {
private IItemTier tier;
public ItemHoeAA(IItemTier tier) {
super(tier,
4,
-2f,
new Properties()
.addToolType(ToolType.AXE, tier.getLevel())
.addToolType(ToolType.HOE, tier.getLevel())
.addToolType(ToolType.SHOVEL, tier.getLevel())
.addToolType(ToolType.PICKAXE, tier.getLevel())
.durability(tier.getUses() * 4)
.tab(ActuallyAdditions.GROUP)
);
private final ItemStack repairItem; this.tier = tier;
}
/* private final ItemStack repairItem;
private final boolean disabled; private final boolean disabled;
public ItemHoeAA(IItemTier toolMat) { public ItemHoeAA(IItemTier toolMat) {
@ -43,5 +56,5 @@ public class ItemHoeAA extends HoeItem implements IDisableableItem {
@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); //((BlockPlant) plant).doStuff(this, returnItem, returnMeta); //TODO
} }
} }

View file

@ -10,18 +10,28 @@
package de.ellpeck.actuallyadditions.mod.items.base; package de.ellpeck.actuallyadditions.mod.items.base;
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
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 implements IDisableableItem { public class ItemSwordAA extends SwordItem {
private IItemTier tier;
public ItemSwordAA(IItemTier tier) {
super(tier,
(int) tier.getAttackDamageBonus(),
tier.getSpeed(),
new Properties()
.addToolType(ToolType.AXE, tier.getLevel())
.addToolType(ToolType.HOE, tier.getLevel())
.addToolType(ToolType.SHOVEL, tier.getLevel())
.addToolType(ToolType.PICKAXE, tier.getLevel())
.durability(tier.getUses() * 4)
.tab(ActuallyAdditions.GROUP)
);
}
private final boolean disabled; /* private final boolean disabled;
public ItemSwordAA(IItemTier toolMat) { public ItemSwordAA(IItemTier toolMat) {
super(toolMat); super(toolMat);
@ -48,5 +58,5 @@ public class ItemSwordAA extends SwordItem implements IDisableableItem {
@Override @Override
public boolean isDisabled() { public boolean isDisabled() {
return this.disabled; return this.disabled;
} }*/
} }

View file

@ -22,11 +22,8 @@ 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;
@ -61,7 +58,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.getStateForPlacement(tile.getWorldObject(), hitBlock, Direction.UP, 0, 0, 0, returnStack.getMetadata(), FakePlayerFactory.getMinecraft((ServerWorld) tile.getWorldObject()), Hand.MAIN_HAND); BlockState state2Place = toPlace.defaultBlockState(); //getStateForPlacement(tile.getWorldObject(), hitBlock, Direction.UP, 0, 0, 0, FakePlayerFactory.getMinecraft((ServerWorld) tile.getWorldObject()), Hand.MAIN_HAND); //TODO
tile.getWorldObject().setBlock(hitBlock, state2Place, 2); tile.getWorldObject().setBlock(hitBlock, state2Place, 2);
tile.extractEnergy(ENERGY_USE); tile.extractEnergy(ENERGY_USE);
} }

View file

@ -15,21 +15,15 @@ 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.util.FakePlayerFactory; import net.minecraftforge.common.Tags;
import java.util.List; import java.util.List;
@ -125,7 +119,7 @@ public class LensMining extends Lens {
List<WeightedOre> ores = null; List<WeightedOre> ores = null;
Block hitBlock = hitState.getBlock(); Block hitBlock = hitState.getBlock();
if (hitBlock instanceof BlockStone) { if (hitBlock.is(Tags.Blocks.STONE)) { //TODO maybe?
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;
@ -139,7 +133,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) {
@ -154,19 +148,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,15 +14,15 @@ 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.Potion; import net.minecraft.potion.Effect;
import net.minecraft.potion.Effects;
@Deprecated @Deprecated
public enum ThePotionRings { public enum ThePotionRings {
SPEED( SPEED(
MobEffects.SPEED.getName(),
8171462, 8171462,
MobEffects.SPEED, Effects.MOVEMENT_SPEED,
0, 0,
1, 1,
10, 10,
@ -32,9 +32,8 @@ public enum ThePotionRings {
), ),
//Slowness //Slowness
HASTE( HASTE(
MobEffects.HASTE.getName(),
14270531, 14270531,
MobEffects.HASTE, Effects.DIG_SPEED, // todo: wrong
0, 0,
1, 1,
10, 10,
@ -44,9 +43,8 @@ public enum ThePotionRings {
), ),
//Mining Fatigue //Mining Fatigue
STRENGTH( STRENGTH(
MobEffects.STRENGTH.getName(),
9643043, 9643043,
MobEffects.STRENGTH, Effects.DAMAGE_BOOST, // TODO: wrong?
0, 0,
1, 1,
10, 10,
@ -57,9 +55,8 @@ public enum ThePotionRings {
//Health (Not Happening) //Health (Not Happening)
//Damage //Damage
JUMP_BOOST( JUMP_BOOST(
MobEffects.JUMP_BOOST.getName(),
7889559, 7889559,
MobEffects.JUMP_BOOST, Effects.JUMP,
0, 0,
1, 1,
10, 10,
@ -69,9 +66,8 @@ public enum ThePotionRings {
), ),
//Nausea //Nausea
REGEN( REGEN(
MobEffects.REGENERATION.getName(),
13458603, 13458603,
MobEffects.REGENERATION, Effects.REGENERATION,
0, 0,
1, 1,
50, 50,
@ -80,9 +76,8 @@ public enum ThePotionRings {
new ItemStack(Items.GHAST_TEAR) new ItemStack(Items.GHAST_TEAR)
), ),
RESISTANCE( RESISTANCE(
MobEffects.RESISTANCE.getName(),
10044730, 10044730,
MobEffects.RESISTANCE, Effects.DAMAGE_RESISTANCE,
0, 0,
1, 1,
10, 10,
@ -91,9 +86,8 @@ public enum ThePotionRings {
new ItemStack(Items.SLIME_BALL) new ItemStack(Items.SLIME_BALL)
), ),
FIRE_RESISTANCE( FIRE_RESISTANCE(
MobEffects.FIRE_RESISTANCE.getName(),
14981690, 14981690,
MobEffects.FIRE_RESISTANCE, Effects.FIRE_RESISTANCE,
0, 0,
0, 0,
10, 10,
@ -102,20 +96,18 @@ public enum ThePotionRings {
new ItemStack(Items.MAGMA_CREAM) new ItemStack(Items.MAGMA_CREAM)
), ),
WATER_BREATHING( WATER_BREATHING(
MobEffects.WATER_BREATHING.getName(),
3035801, 3035801,
MobEffects.WATER_BREATHING, Effects.WATER_BREATHING,
0, 0,
0, 0,
10, 10,
false, false,
Rarity.RARE, Rarity.RARE,
new ItemStack(Items.FISH, 1, 3) new ItemStack(Items.TROPICAL_FISH)
), ),
INVISIBILITY( INVISIBILITY(
MobEffects.INVISIBILITY.getName(),
8356754, 8356754,
MobEffects.INVISIBILITY, Effects.INVISIBILITY,
0, 0,
0, 0,
10, 10,
@ -125,9 +117,8 @@ public enum ThePotionRings {
), ),
//Blindness //Blindness
NIGHT_VISION( NIGHT_VISION(
MobEffects.NIGHT_VISION.getName(),
2039713, 2039713,
MobEffects.NIGHT_VISION, Effects.NIGHT_VISION,
0, 0,
0, 0,
300, 300,
@ -145,18 +136,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 int effectID; public final Effect effect;
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(String name, int color, Potion effect, int normalAmplifier, int advancedAmplifier, int activeTime, boolean needsWaitBeforeActivating, Rarity rarity, ItemStack craftingItem) { ThePotionRings(int color, Effect effect, int normalAmplifier, int advancedAmplifier, int activeTime, boolean needsWaitBeforeActivating, Rarity rarity, ItemStack craftingItem) {
this.name = name; this.name = effect.getDisplayName().getString();
this.color = color; this.color = color;
this.rarity = rarity; this.rarity = rarity;
this.effectID = Potion.getIdFromPotion(effect); this.effect = effect;
this.normalAmplifier = normalAmplifier; this.normalAmplifier = normalAmplifier;
this.advancedAmplifier = advancedAmplifier; this.advancedAmplifier = advancedAmplifier;
this.activeTime = activeTime; this.activeTime = activeTime;

View file

@ -10,38 +10,18 @@
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;
@ -137,7 +117,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;
@ -175,7 +155,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.getStateForPlacement(tile.getWorldObject(), pos, facing, 0, 0, 0, output.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), Hand.MAIN_HAND); BlockState state2Place = toPlace.defaultBlockState(); //.getStateForPlacement(tile.getWorldObject(), pos, facing, 0, 0, 0, output.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), Hand.MAIN_HAND); //TODO
tile.getWorldObject().setBlock(pos, state2Place, 2); 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());
@ -199,7 +179,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.getEntityData().getBoolean("aa_cnv")) { if (item.isAlive() && StackUtil.isValid(stack) && !item.getPersistentData().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());
@ -220,7 +200,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.getEntityData().putBoolean("aa_cnv", true); newItem.getPersistentData().putBoolean("aa_cnv", true);
tile.getWorldObject().addFreshEntity(newItem); tile.getWorldObject().addFreshEntity(newItem);
tile.extractEnergy(recipe.getEnergyUsed() * itemsPossible); tile.extractEnergy(recipe.getEnergyUsed() * itemsPossible);
@ -230,7 +210,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;
} }
@ -261,7 +241,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())) {
@ -285,14 +265,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();
@ -310,62 +290,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,7 +18,6 @@ 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 {
@ -86,46 +85,43 @@ public class FilterSettings {
return true; return true;
} }
if (oredict != 0) { // if (oredict != 0) {
int[] firstIds = OreDictionary.getOreIDs(first); // boolean firstEmpty = ArrayUtils.isEmpty(firstIds);
int[] secondIds = OreDictionary.getOreIDs(second); // boolean secondEmpty = ArrayUtils.isEmpty(secondIds);
boolean firstEmpty = ArrayUtils.isEmpty(firstIds); //
boolean secondEmpty = ArrayUtils.isEmpty(secondIds); // //Both empty, meaning none has OreDict entries, so they are equal
// if (firstEmpty && secondEmpty) {
//Both empty, meaning none has OreDict entries, so they are equal // return true;
if (firstEmpty && secondEmpty) { // }
return true; // //Only one empty, meaning they are not equal
} // else if (firstEmpty || secondEmpty) {
//Only one empty, meaning they are not equal // return false;
else if (firstEmpty || secondEmpty) { // } else {
return false; // for (int id : firstIds) {
} else { // if (ArrayUtils.contains(secondIds, id)) {
for (int id : firstIds) { // //Needs to match only one id, so return true on first match
if (ArrayUtils.contains(secondIds, id)) { // if (oredict == 1) {
//Needs to match only one id, so return true on first match // return true;
if (oredict == 1) { // }
return true; // }
} // //Needs to match every id, so just return false when no match
} // else if (oredict == 2) {
//Needs to match every id, so just return false when no match // return false;
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
//If oredict mode 1, this will fail because nothing matched // return oredict == 2;
//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 (metaFine && nbtFine) { if (nbtFine) {
return true; return true;
} }
return false; return false;
@ -139,11 +135,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.setTag(name, compound); tag.put(name, compound);
} }
public void readFromNBT(CompoundNBT tag, String name) { public void readFromNBT(CompoundNBT tag, String name) {
CompoundNBT compound = tag.getCompoundTag(name); CompoundNBT compound = tag.getCompound(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,10 +12,9 @@ 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.ContainerGrinder; import de.ellpeck.actuallyadditions.mod.inventory.CrusherContainer;
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;
@ -177,7 +176,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; return (slot, stack, automation) -> !automation || (slot == SLOT_INPUT_1 || slot == SLOT_INPUT_2); /*CrusherRecipeRegistry.getRecipeFromInput(stack) != null*/ //TODO
} }
@Override @Override
@ -288,6 +287,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 ContainerGrinder(windowId, playerInventory, this); return new CrusherContainer(windowId, playerInventory, this);
} }
} }

View file

@ -1,117 +1,118 @@
/* ///*
* 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 net.minecraft.block.BlockState; //import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import net.minecraft.nbt.CompoundNBT; //import net.minecraft.block.BlockState;
import net.minecraft.tileentity.TileEntity; //import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction; //import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos; //import net.minecraft.util.Direction;
import net.minecraftforge.common.util.LazyOptional; //import net.minecraft.util.math.BlockPos;
import net.minecraftforge.energy.IEnergyStorage; //import net.minecraftforge.common.util.LazyOptional;
//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 final CustomEnergyStorage storage = new CustomEnergyStorage(30000, 0, 100); // public static final int PRODUCE = 8;
public final LazyOptional<IEnergyStorage> lazyEnergy = LazyOptional.of(() -> this.storage); // public final CustomEnergyStorage storage = new CustomEnergyStorage(30000, 0, 100);
private int oldEnergy; // public final LazyOptional<IEnergyStorage> lazyEnergy = LazyOptional.of(() -> this.storage);
// private int oldEnergy;
public TileEntityFurnaceSolar() { //
super(ActuallyTiles.SOLAR_TILE.get()); // public TileEntityFurnaceSolar() {
} // super(ActuallyBlocks.SO.SOLAR_TILE.get());
// }
@Override //
public void writeSyncableNBT(CompoundNBT compound, NBTType type) { // @Override
super.writeSyncableNBT(compound, type); // public void writeSyncableNBT(CompoundNBT compound, NBTType type) {
this.storage.writeToNBT(compound); // super.writeSyncableNBT(compound, type);
} // this.storage.writeToNBT(compound);
// }
@Override //
public void readSyncableNBT(CompoundNBT compound, NBTType type) { // @Override
super.readSyncableNBT(compound, type); // public void readSyncableNBT(CompoundNBT compound, NBTType type) {
this.storage.readFromNBT(compound); // super.readSyncableNBT(compound, type);
} // this.storage.readFromNBT(compound);
// }
@Override //
public void updateEntity() { // @Override
super.updateEntity(); // public void updateEntity() {
if (!this.level.isClientSide) { // super.updateEntity();
int power = this.getPowerToGenerate(PRODUCE); // if (!this.level.isClientSide) {
if (this.level.isDay() && power > 0) { // int power = this.getPowerToGenerate(PRODUCE);
if (power <= this.storage.getMaxEnergyStored() - this.storage.getEnergyStored()) { // if (this.level.isDay() && power > 0) {
this.storage.receiveEnergyInternal(power, false); // if (power <= this.storage.getMaxEnergyStored() - this.storage.getEnergyStored()) {
this.setChanged(); // this.storage.receiveEnergyInternal(power, false);
} // this.setChanged();
} // }
// }
if (this.oldEnergy != this.storage.getEnergyStored() && this.sendUpdateWithInterval()) { //
this.oldEnergy = this.storage.getEnergyStored(); // if (this.oldEnergy != this.storage.getEnergyStored() && this.sendUpdateWithInterval()) {
} // this.oldEnergy = this.storage.getEnergyStored();
} // }
} // }
// }
public int getPowerToGenerate(int power) { //
for (int y = 1; y <= this.level.getMaxBuildHeight() - this.worldPosition.getY(); y++) { // public int getPowerToGenerate(int power) {
if (power > 0) { // for (int y = 1; y <= this.level.getMaxBuildHeight() - this.worldPosition.getY(); y++) {
BlockPos pos = this.worldPosition.above(y); // if (power > 0) {
BlockState state = this.level.getBlockState(pos); // BlockPos pos = this.worldPosition.above(y);
// BlockState state = this.level.getBlockState(pos);
if (state.getMaterial().isSolidBlocking()) { //
power = 0; // if (state.getMaterial().isSolidBlocking()) {
} else if (!state.getBlock().isAir(state, this.level, pos)) { // power = 0;
power--; // } else if (!state.getBlock().isAir(state, this.level, pos)) {
} // power--;
} else { // }
break; // } else {
} // break;
} // }
// }
return power; //
} // return power;
// }
@Override //
public CustomEnergyStorage getEnergyStorage() { // @Override
return this.storage; // public CustomEnergyStorage getEnergyStorage() {
} // return this.storage;
// }
@Override //
public boolean needsHoldShift() { // @Override
return false; // public boolean needsHoldShift() {
} // return false;
// }
@Override //
public int getEnergyToSplitShare() { // @Override
return this.storage.getEnergyStored(); // public int getEnergyToSplitShare() {
} // return this.storage.getEnergyStored();
// }
@Override //
public boolean doesShareEnergy() { // @Override
return true; // public boolean doesShareEnergy() {
} // return true;
// }
@Override //
public Direction[] getEnergyShareSides() { // @Override
return Direction.values(); // public Direction[] getEnergyShareSides() {
} // return Direction.values();
// }
@Override //
public boolean canShareTo(TileEntity tile) { // @Override
return true; // public boolean canShareTo(TileEntity tile) {
} // return true;
// }
@Override //
public LazyOptional<IEnergyStorage> getEnergyStorage(Direction facing) { // @Override
return this.lazyEnergy; // public LazyOptional<IEnergyStorage> getEnergyStorage(Direction facing) {
} // return this.lazyEnergy;
} // }
//}

View file

@ -1,20 +0,0 @@
/*
* This file ("TileEntityInputterAdvanced.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.tile;
public class TileEntityInputterAdvanced extends TileEntityInputter {
public TileEntityInputterAdvanced() {
super(ActuallyTiles.INPUTTERADVANCED_TILE.get(), 1);
this.isAdvanced = true;
}
}

View file

@ -30,8 +30,6 @@ 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;
@ -176,7 +174,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,19 +13,15 @@ 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.*; import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.IRenderTypeBuffer;
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;
@ -34,9 +30,6 @@ 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 {
@ -92,7 +85,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();
@ -112,12 +105,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();
@ -134,13 +127,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;
@ -164,7 +157,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)
@ -221,7 +214,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)); //PacketHandler.THE_NETWORK.sendToAllAround(new PacketServerToClient(data, PacketHandler.LASER_HANDLER), new NetworkRegistry.TargetPoint(world.provider.getDimension(), startX, startY, startZ, 96)); //TODO
} }
} }
@ -261,7 +254,7 @@ public final class AssetUtil {
GlStateManager._pushMatrix(); GlStateManager._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);
@ -270,7 +263,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);
@ -318,8 +311,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();
@ -344,11 +337,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,32 +18,33 @@ 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;
@ -75,7 +76,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;
@ -93,11 +94,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))) {
@ -108,7 +109,7 @@ public final class WorldUtil {
} }
} }
} }
} }*/
} }
return extracted; return extracted;
@ -119,30 +120,33 @@ public final class WorldUtil {
Direction opp = sideTo == null Direction opp = sideTo == null
? null ? null
: sideTo.getOpposite(); : sideTo.getOpposite();
IEnergyStorage handlerFrom = tileFrom.getCapability(CapabilityEnergy.ENERGY, sideTo); LazyOptional<IEnergyStorage> handlerFrom = tileFrom.getCapability(CapabilityEnergy.ENERGY, sideTo);
IEnergyStorage handlerTo = tileTo.getCapability(CapabilityEnergy.ENERGY, opp); LazyOptional<IEnergyStorage> handlerTo = tileTo.getCapability(CapabilityEnergy.ENERGY, opp);
if (handlerFrom != null && handlerTo != null) { handlerFrom.ifPresent((from) -> {
int drain = handlerFrom.extractEnergy(maxTransfer, true); handlerTo.ifPresent((to) -> {
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) {
if (tileFrom.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, sideTo) && tileTo.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, sideTo.getOpposite())) { LazyOptional<IFluidHandler> optionalFrom = tileFrom.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, sideTo);
IFluidHandler handlerFrom = tileFrom.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, sideTo); LazyOptional<IFluidHandler> optionalTo = tileTo.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, sideTo.getOpposite());
IFluidHandler handlerTo = tileTo.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, sideTo.getOpposite()); optionalFrom.ifPresent((from) -> {
FluidStack drain = handlerFrom.drain(maxTransfer, false); optionalTo.ifPresent((to) -> {
if (drain != null) { FluidStack drain = from.drain(maxTransfer, IFluidHandler.FluidAction.SIMULATE);
int filled = handlerTo.fill(drain.copy(), true); if (!drain.isEmpty()) {
handlerFrom.drain(filled, true); int filled = to.fill(drain.copy(), IFluidHandler.FluidAction.EXECUTE);
} from.drain(filled, IFluidHandler.FluidAction.EXECUTE);
} }
});
});
} }
} }
@ -165,11 +169,11 @@ public final class WorldUtil {
} }
public static ItemStack useItemAtSide(Direction side, World world, BlockPos pos, ItemStack stack) { public static ItemStack useItemAtSide(Direction side, World world, BlockPos pos, ItemStack stack) {
if (world instanceof WorldServer && StackUtil.isValid(stack) && pos != null) { if (world instanceof ServerWorld && StackUtil.isValid(stack) && pos != null) {
BlockPos offsetPos = pos.relative(side); 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 = block.canBeReplaced(world, offsetPos); boolean replaceable = false; //= block.canBeReplaced(world, offsetPos); //TODO
//Redstone //Redstone
if (replaceable && stack.getItem() == Items.REDSTONE) { if (replaceable && stack.getItem() == Items.REDSTONE) {
@ -178,28 +182,28 @@ public final class WorldUtil {
} }
//Plants //Plants
if (replaceable && stack.getItem() instanceof IPlantable) { /* if (replaceable && stack.getItem() instanceof IPlantable) { //TODO
if (((IPlantable) stack.getItem()).getPlant(world, offsetPos).getBlock().canPlaceBlockAt(world, offsetPos)) { if (((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((WorldServer) world); FakePlayer fake = FakePlayerFactory.getMinecraft((ServerWorld) 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.processRightClickBlock(fake, world, fake.getMainHandItem(), Hand.MAIN_HAND, offsetPos, side.getOpposite(), 0.5F, 0.5F, 0.5F); //fake.gameMode.useItemOn(fake, world, fake.getMainHandItem(), Hand.MAIN_HAND, offsetPos, side.getOpposite(), 0.5F, 0.5F, 0.5F); //TODO
ItemStack result = fake.getItemInHand(Hand.MAIN_HAND); 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.provider.getDimension() + " threw an Exception! Don't let that happen again!", e); ActuallyAdditions.LOGGER.error("Something that places Blocks at " + offsetPos.getX() + ", " + offsetPos.getY() + ", " + offsetPos.getZ() + " in World " + world.dimension() + " threw an Exception! Don't let that happen again!", e);
} }
} }
return stack; return stack;
@ -208,12 +212,10 @@ 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)) {
EntityItem item = new EntityItem(world, coords.getX() + 0.5, coords.getY() + 0.5, coords.getZ() + 0.5, stack); ItemEntity item = new ItemEntity(world, coords.getX() + 0.5, coords.getY() + 0.5, coords.getZ() + 0.5, stack);
item.motionX = 0; item.setDeltaMovement(0,0,0);
item.motionY = 0;
item.motionZ = 0;
return world.spawnEntity(item); return world.addFreshEntity(item);
} }
return false; return false;
} }
@ -236,7 +238,7 @@ public final class WorldUtil {
} }
public static Direction getDirectionByPistonRotation(BlockState state) { public static Direction getDirectionByPistonRotation(BlockState state) {
return state.getValue(BlockDirectional.FACING); return state.getValue(BlockStateProperties.FACING);
} }
public static ArrayList<Material> getMaterialsAround(World world, BlockPos pos) { public static ArrayList<Material> getMaterialsAround(World world, BlockPos pos) {
@ -255,9 +257,9 @@ public final class WorldUtil {
private static RayTraceResult getMovingObjectPosWithReachDistance(World world, PlayerEntity player, double distance, boolean p1, boolean p2, boolean p3) { 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.posX; double d0 = player.position().x;
double d1 = player.posY + player.getEyeHeight(); double d1 = player.position().y + player.getEyeHeight();
double d2 = player.posZ; double d2 = player.position().z;
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);
@ -266,7 +268,9 @@ 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); //return world.clipWithInteractionOverride(vec3, vec31, p1, p2, p3); //TODO
return new BlockRayTraceResult(Vector3d.ZERO, Direction.DOWN, BlockPos.ZERO, false);
} }
public static RayTraceResult getNearestBlockWithDefaultReachDistance(World world, PlayerEntity player) { public static RayTraceResult getNearestBlockWithDefaultReachDistance(World world, PlayerEntity player) {
@ -274,7 +278,8 @@ public final class WorldUtil {
} }
public static RayTraceResult getNearestBlockWithDefaultReachDistance(World world, PlayerEntity player, boolean stopOnLiquids, boolean ignoreBlockWithoutBoundingBox, boolean returnLastUncollidableBlock) { public static RayTraceResult getNearestBlockWithDefaultReachDistance(World world, PlayerEntity player, boolean stopOnLiquids, boolean ignoreBlockWithoutBoundingBox, boolean returnLastUncollidableBlock) {
return getMovingObjectPosWithReachDistance(world, player, player.getEntityAttribute(PlayerEntity.REACH_DISTANCE).getAttributeValue(), stopOnLiquids, ignoreBlockWithoutBoundingBox, returnLastUncollidableBlock); return new BlockRayTraceResult(Vector3d.ZERO, Direction.DOWN, BlockPos.ZERO, false); //TODO
//return getMovingObjectPosWithReachDistance(world, player, player.getAttribute(PlayerEntity.REACH_DISTANCE).getAttributeValue(), stopOnLiquids, ignoreBlockWithoutBoundingBox, returnLastUncollidableBlock);
} }
public static void setHandItemWithoutAnnoyingSound(PlayerEntity player, Hand hand, ItemStack stack) { public static void setHandItemWithoutAnnoyingSound(PlayerEntity player, Hand hand, ItemStack stack) {
@ -295,7 +300,7 @@ public final class WorldUtil {
BreakEvent event = new BreakEvent(world, pos, state, fake); 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); //return ForgeEventFactory.fireBlockHarvesting(drops, world, pos, state, 0, 1, false, fake); //TODO what?!
} }
} }
return 0F; return 0F;
@ -315,13 +320,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)) { if (block.removedByPlayer(state, world, pos, player, false, state.getFluidState())) {
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)); //((ServerPlayerEntity) player).connection.send(new SPacketBlockChange(world, pos)); //TODO dunno what this is
} }
return true; return true;
} }
@ -338,14 +343,14 @@ public final class WorldUtil {
} }
TileEntity tileEntity = world.getBlockEntity(pos); TileEntity tileEntity = world.getBlockEntity(pos);
if (block.removedByPlayer(state, world, pos, player, true)) { // boolean is if block can be harvested, checked above if (block.removedByPlayer(state, world, pos, player, true, state.getFluidState())) { // boolean is if block can be harvested, checked above
block.destroy(world, pos, state); block.destroy(world, pos, state);
block.playerDestroy(world, player, pos, state, tileEntity, stack); block.playerDestroy(world, player, pos, state, tileEntity, stack);
block.popExperience(world, pos, xp); block.popExperience(((ServerWorld) world), pos, xp);
} }
// always send block update to client // always send block update to client
((ServerPlayerEntity) player).connection.send(new SPacketBlockChange(world, pos)); //((ServerPlayerEntity) player).connection.send(new SPacketBlockChange(world, pos)); //TODO how
return true; return true;
} }
// client sided handling // client sided handling
@ -355,7 +360,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)) { if (block.removedByPlayer(state, world, pos, player, true, state.getFluidState())) {
block.destroy(world, pos, state); block.destroy(world, pos, state);
} }
// callback to the tool // callback to the tool