mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 19:39:22 +00:00
Implement fluid item capabilities without item swapping
This commit is contained in:
1 parent
6f1a44a405
commit
eb6b3ea228
15 files changed
+437
-227
No files matched your search
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fluids;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Holds the result of a fluid action from {@link FluidUtil}.
|
||||
*
|
||||
* Failed actions will always have {@link #isSuccess()} == false and an empty ItemStack result. See {@link #FAILURE}.
|
||||
*
|
||||
* Successful actions will always have {@link #isSuccess()} == true.
|
||||
* Successful actions may have an empty ItemStack result in some cases,
|
||||
* for example the action succeeded and the resulting item was consumed.
|
||||
*/
|
||||
public class FluidActionResult
|
||||
{
|
||||
public static final FluidActionResult FAILURE = new FluidActionResult(false, ItemStack.field_190927_a);
|
||||
|
||||
public final boolean success;
|
||||
@Nonnull
|
||||
public final ItemStack result;
|
||||
|
||||
public FluidActionResult(@Nonnull ItemStack result)
|
||||
{
|
||||
this(true, result);
|
||||
}
|
||||
|
||||
private FluidActionResult(boolean success, @Nonnull ItemStack result)
|
||||
{
|
||||
this.success = success;
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public boolean isSuccess()
|
||||
{
|
||||
return success;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ItemStack getResult()
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user