mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-20 04:09:51 +00:00
Remove dead test classes.
This commit is contained in:
1 parent
f24991f3bb
commit
0c0603dc91
133 files changed
-15903
No files matched your search
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* 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.debug.fluid;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.fluids.BlockFluidBase;
|
||||
import net.minecraftforge.fluids.BlockFluidClassic;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;
|
||||
|
||||
//@Mod(modid = ColoredFluidTest.MODID, name = "Test Mod", version = "1.0.0", acceptedMinecraftVersions = "*", acceptableRemoteVersions = "*")
|
||||
//@EventBusSubscriber
|
||||
public class ColoredFluidTest
|
||||
{
|
||||
static final boolean ENABLED = false; // <-- enable mod
|
||||
static final int COLOR = 0xFFAFAF; // <-- change this to try other colors
|
||||
|
||||
static final String MODID = "fluidadditionalfields";
|
||||
static final ResourceLocation RES_LOC = new ResourceLocation(MODID, "slime");
|
||||
static
|
||||
{
|
||||
if (ENABLED)
|
||||
{
|
||||
FluidRegistry.enableUniversalBucket();
|
||||
}
|
||||
}
|
||||
public static final Fluid SLIME = new Fluid("slime", new ResourceLocation(MODID, "slime_still"), new ResourceLocation(MODID, "slime_flow"), new ResourceLocation(MODID, "slime_overlay")).setColor(COLOR);
|
||||
@ObjectHolder("slime")
|
||||
public static final BlockFluidBase SLIME_BLOCK = null;
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
if (ENABLED)
|
||||
{
|
||||
FluidRegistry.registerFluid(SLIME);
|
||||
FluidRegistry.addBucketForFluid(SLIME);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void eventBlockRegistry(final RegistryEvent.Register<Block> event)
|
||||
{
|
||||
if (ENABLED)
|
||||
{
|
||||
event.getRegistry().register((new BlockFluidClassic(SLIME, Material.WATER)).setRegistryName(RES_LOC).setUnlocalizedName(RES_LOC.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* 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.debug.fluid;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.BlockEvent.CreateFluidSourceEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.eventbus.api.Event.Result;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
//@Mod(modid = "createfluidsourcetest", name = "CreateFluidSourceTest", version = "1.0", acceptableRemoteVersions = "*")
|
||||
public class CreateFluidSourceEventTest
|
||||
{
|
||||
public static final boolean ENABLE = false;
|
||||
|
||||
@Mod.EventHandler
|
||||
public static void init(FMLInitializationEvent event)
|
||||
{
|
||||
if (ENABLE)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(CreateFluidSourceEventTest.class);
|
||||
}
|
||||
}
|
||||
|
||||
@net.minecraftforge.eventbus.api.SubscribeEvent
|
||||
public static void onCreateFluidSource(CreateFluidSourceEvent event)
|
||||
{
|
||||
// make it work exactly the opposite of how it works by default
|
||||
if (event.getState().getBlock() == Blocks.FLOWING_WATER)
|
||||
{
|
||||
event.setResult(Result.DENY);
|
||||
}
|
||||
else
|
||||
{
|
||||
event.setResult(Result.ALLOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,386 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* 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.debug.fluid;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.ForgeVersion;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.debug.client.model.ModelFluidTest;
|
||||
import net.minecraftforge.debug.client.model.ModelFluidTest.TestFluid;
|
||||
import net.minecraftforge.debug.client.model.ModelFluidTest.TestGas;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.event.entity.player.FillBucketEvent;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankOld;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
import net.minecraftforge.fluids.UniversalBucket;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandlerItem;
|
||||
import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.eventbus.api.Event.Result;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
//@Mod(modid = DynBucketTest.MODID, name = "DynBucketTest", version = "0.1", dependencies = "after:" + ModelFluidTest.MODID, acceptableRemoteVersions = "*")
|
||||
public class DynBucketTest
|
||||
{
|
||||
public static final String MODID = "dynbuckettest";
|
||||
private static final ResourceLocation simpleTankName = new ResourceLocation(MODID, "simpletank");
|
||||
private static final ResourceLocation testItemName = new ResourceLocation(MODID, "testitem");
|
||||
|
||||
private static final boolean ENABLE = false;
|
||||
private static Logger logger;
|
||||
|
||||
@ObjectHolder("testitem")
|
||||
public static final Item TEST_ITEM = null;
|
||||
@ObjectHolder("simpletank")
|
||||
public static final Block TANK_BLOCK = null;
|
||||
@ObjectHolder("simpletank")
|
||||
public static final Item TANK_ITEM = null;
|
||||
@ObjectHolder("dynbottle")
|
||||
public static final Item DYN_BOTTLE = null;
|
||||
|
||||
static
|
||||
{
|
||||
if (ENABLE && ModelFluidTest.ENABLE)
|
||||
{
|
||||
FluidRegistry.enableUniversalBucket();
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerBlocks(RegistryEvent.Register<Block> event)
|
||||
{
|
||||
event.getRegistry().register(new BlockSimpleTank().setRegistryName(simpleTankName));
|
||||
GameRegistry.registerTileEntity(TileSimpleTank.class, "simpletank");
|
||||
}
|
||||
|
||||
@net.minecraftforge.eventbus.api.SubscribeEvent
|
||||
public void registerItems(RegistryEvent.Register<Item> event)
|
||||
{
|
||||
FluidRegistry.addBucketForFluid(FluidRegistry.getFluid(TestFluid.name));
|
||||
FluidRegistry.addBucketForFluid(FluidRegistry.getFluid(TestGas.name));
|
||||
|
||||
event.getRegistry().registerAll(
|
||||
new TestItem().setRegistryName(testItemName),
|
||||
new ItemBlock(TANK_BLOCK).setRegistryName(simpleTankName),
|
||||
new DynBottle()
|
||||
);
|
||||
}
|
||||
|
||||
@net.minecraftforge.eventbus.api.SubscribeEvent
|
||||
public void registerRecipes(RegistryEvent.Register<IRecipe> event)
|
||||
{
|
||||
ItemStack filledBucket = FluidUtil.getFilledBucket(new FluidStack(ModelFluidTest.FLUID, FluidAttributes.BUCKET_VOLUME));
|
||||
GameRegistry.addShapelessRecipe(new ResourceLocation(MODID, "diamond_to_fluid"), null, filledBucket, Ingredient.fromItem(Items.DIAMOND));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
logger = event.getModLog();
|
||||
|
||||
if (ENABLE && ModelFluidTest.ENABLE)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
}
|
||||
|
||||
@net.minecraftforge.eventbus.api.SubscribeEvent
|
||||
public void onBucketFill(FillBucketEvent event)
|
||||
{
|
||||
RayTraceResult target = event.getTarget();
|
||||
if (target != null)
|
||||
{
|
||||
IBlockState state = event.getWorld().getBlockState(target.getBlockPos());
|
||||
if (state.getBlock() instanceof IFluidBlock)
|
||||
{
|
||||
Fluid fluid = ((IFluidBlock) state.getBlock()).getFluid();
|
||||
FluidStack fs = new FluidStack(fluid, FluidAttributes.BUCKET_VOLUME);
|
||||
|
||||
ItemStack bucket = event.getEmptyBucket();
|
||||
IFluidHandlerItem fluidHandler = FluidUtil.getFluidHandler(bucket);
|
||||
if (fluidHandler != null)
|
||||
{
|
||||
int fillAmount = fluidHandler.fill(fs, true);
|
||||
if (fillAmount > 0)
|
||||
{
|
||||
ItemStack filledBucket = fluidHandler.getContainer();
|
||||
event.setFilledBucket(filledBucket);
|
||||
event.setResult(Result.ALLOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//@Mod.EventBusSubscriber(value = Side.CLIENT, modid = MODID)
|
||||
public static class ClientEventHandler
|
||||
{
|
||||
@net.minecraftforge.eventbus.api.SubscribeEvent
|
||||
public static void setupModels(ModelRegistryEvent event)
|
||||
{
|
||||
if (!ENABLE || !ModelFluidTest.ENABLE) return;
|
||||
|
||||
ModelLoader.setBucketModelDefinition(DYN_BOTTLE);
|
||||
|
||||
final ModelResourceLocation bottle = new ModelResourceLocation(new ResourceLocation(ForgeVersion.MOD_ID, "dynbottle"), "inventory");
|
||||
ModelLoader.setCustomMeshDefinition(DYN_BOTTLE, new ItemMeshDefinition()
|
||||
{
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(@Nonnull ItemStack stack)
|
||||
{
|
||||
return bottle;
|
||||
}
|
||||
});
|
||||
ModelBakery.registerItemVariants(DYN_BOTTLE, bottle);
|
||||
ModelLoader.setCustomModelResourceLocation(Item.REGISTRY.getObject(simpleTankName), 0, new ModelResourceLocation(simpleTankName, "normal"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.REGISTRY.getObject(testItemName), 0, new ModelResourceLocation(new ResourceLocation("minecraft", "stick"), "inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
public static class TestItem extends Item
|
||||
{
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand)
|
||||
{
|
||||
ItemStack itemStackIn = playerIn.getHeldItem(hand);
|
||||
if (worldIn.isRemote)
|
||||
{
|
||||
return new ActionResult<ItemStack>(EnumActionResult.PASS, itemStackIn);
|
||||
}
|
||||
|
||||
ItemStackHandler handler = new ItemStackHandler(5);
|
||||
ItemStackHandler handler2 = new ItemStackHandler(5);
|
||||
IItemHandler joined = new CombinedInvWrapper(handler, handler2);
|
||||
|
||||
handler.setStackInSlot(0, new ItemStack(Blocks.STONE));
|
||||
handler.setStackInSlot(1, new ItemStack(Blocks.GRASS));
|
||||
handler.setStackInSlot(2, new ItemStack(Blocks.DIRT));
|
||||
handler.setStackInSlot(3, new ItemStack(Blocks.GLASS));
|
||||
handler.setStackInSlot(4, new ItemStack(Blocks.SAND));
|
||||
|
||||
handler2.setStackInSlot(0, new ItemStack(Blocks.SLIME_BLOCK));
|
||||
handler2.setStackInSlot(1, new ItemStack(Blocks.TNT));
|
||||
handler2.setStackInSlot(2, new ItemStack(Blocks.PLANKS));
|
||||
handler2.setStackInSlot(3, new ItemStack(Blocks.LOG));
|
||||
handler2.setStackInSlot(4, new ItemStack(Blocks.DIAMOND_BLOCK));
|
||||
|
||||
for (int i = 0; i < handler.getSlots(); i++)
|
||||
{
|
||||
logger.info("Expected 1: {}", handler.getStackInSlot(i));
|
||||
}
|
||||
|
||||
for (int i = 0; i < handler2.getSlots(); i++)
|
||||
{
|
||||
logger.info("Expected 2: {}", handler2.getStackInSlot(i));
|
||||
}
|
||||
|
||||
for (int i = 0; i < joined.getSlots(); i++)
|
||||
{
|
||||
logger.info("Joined: {}", joined.getStackInSlot(i));
|
||||
}
|
||||
|
||||
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemStackIn);
|
||||
}
|
||||
}
|
||||
|
||||
public static class DynBottle extends UniversalBucket
|
||||
{
|
||||
public DynBottle()
|
||||
{
|
||||
super(250, new ItemStack(Items.GLASS_BOTTLE), true);
|
||||
setUnlocalizedName("dynbottle");
|
||||
setRegistryName(new ResourceLocation(MODID, "dynbottle"));
|
||||
setMaxStackSize(16);
|
||||
setHasSubtypes(true);
|
||||
setCreativeTab(CreativeTabs.MISC);
|
||||
}
|
||||
}
|
||||
|
||||
// simple tank copied from tinkers construct
|
||||
public static class BlockSimpleTank extends BlockContainer
|
||||
{
|
||||
|
||||
protected BlockSimpleTank()
|
||||
{
|
||||
super(Material.ROCK);
|
||||
setCreativeTab(CreativeTabs.MISC);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileSimpleTank();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
ItemStack heldItem = playerIn.getHeldItem(hand);
|
||||
IFluidHandler tank = FluidUtil.getFluidHandler(worldIn, pos, side.getOpposite());
|
||||
if (tank == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (heldItem.isEmpty())
|
||||
{
|
||||
sendText(playerIn, tank);
|
||||
return false;
|
||||
}
|
||||
|
||||
// do the thing with the tank and the buckets
|
||||
if (FluidUtil.interactWithFluidHandler(playerIn, hand, worldIn, pos, side))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
sendText(playerIn, tank);
|
||||
}
|
||||
|
||||
// prevent interaction of the item if it's a fluidcontainer. Prevents placing liquids when interacting with the tank
|
||||
return FluidUtil.getFluidHandler(heldItem) != null;
|
||||
}
|
||||
|
||||
private void sendText(EntityPlayer player, IFluidHandler tank)
|
||||
{
|
||||
if (player.world.isRemote)
|
||||
{
|
||||
String text;
|
||||
IFluidTankProperties[] tankProperties = tank.getTankProperties();
|
||||
if (tankProperties.length > 0 && tankProperties[0] != null && tankProperties[0].getContents() != null)
|
||||
{
|
||||
text = tankProperties[0].getContents().amount + "x " + tankProperties[0].getContents().getLocalizedName();
|
||||
}
|
||||
else
|
||||
{
|
||||
text = "empty";
|
||||
}
|
||||
player.sendMessage(new TextComponentString(text));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class TileSimpleTank extends TileEntity
|
||||
{
|
||||
FluidTankOld tank = new FluidTankOld(4000);
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tags)
|
||||
{
|
||||
super.readFromNBT(tags);
|
||||
tank.readFromNBT(tags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tags)
|
||||
{
|
||||
tags = super.writeToNBT(tags);
|
||||
tank.writeToNBT(tags);
|
||||
return tags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SPacketUpdateTileEntity getUpdatePacket()
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag = writeToNBT(tag);
|
||||
return new SPacketUpdateTileEntity(this.getPos(), this.getBlockMetadata(), tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt)
|
||||
{
|
||||
super.onDataPacket(net, pkt);
|
||||
readFromNBT(pkt.getNbtCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing)
|
||||
{
|
||||
return capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing)
|
||||
{
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
|
||||
{
|
||||
return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(tank);
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* 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.debug.fluid;
|
||||
|
||||
import net.minecraft.block.BlockStone;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.BiomeHills;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
*/
|
||||
/**
|
||||
* This test will:
|
||||
* - Cause lava to turn into gold when touched by water.
|
||||
* - Replace the result of a cobblestone generator with granite.
|
||||
* - Replace the result of a stone generator with either diamond, or emerald when in a biome where emerald spawns naturally.
|
||||
* - Prevent lava from setting surrounding blocks on fire.
|
||||
*//*
|
||||
|
||||
//@Mod(modid = "fluidplaceblocktest", name = "FluidPlaceBlockTest", version = "0.0.0", acceptableRemoteVersions = "*")
|
||||
public class FluidPlaceBlockEventTest
|
||||
{
|
||||
private static final boolean ENABLED = false;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preinit(FMLPreInitializationEvent event)
|
||||
{
|
||||
if (!ENABLED) return;
|
||||
MinecraftForge.EVENT_BUS.register(FluidPlaceBlockEventTest.class);
|
||||
}
|
||||
|
||||
@SubscribeEvent @SuppressWarnings("unused")
|
||||
public static void onFluidPlaceBlockEvent(BlockEvent.FluidPlaceBlockEvent event)
|
||||
{
|
||||
if (event.getState().getBlock() == Blocks.OBSIDIAN) event.setNewState(Blocks.GOLD_BLOCK.getDefaultState());
|
||||
if (event.getState().getBlock() == Blocks.COBBLESTONE) event.setNewState(Blocks.STONE.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.GRANITE));
|
||||
if (event.getState() == Blocks.STONE.getDefaultState())
|
||||
{
|
||||
Biome biome = event.getWorld().getBiome(event.getPos());
|
||||
if (biome instanceof BiomeHills) event.setNewState(Blocks.EMERALD_BLOCK.getDefaultState());
|
||||
else event.setNewState(Blocks.DIAMOND_BLOCK.getDefaultState());
|
||||
}
|
||||
if (event.getState().getBlock() == Blocks.FIRE) event.setNewState(event.getOriginalState());
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,324 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* 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.debug.fluid;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemBucket;
|
||||
import net.minecraft.item.ItemBucketMilk;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.debug.client.model.ModelFluidTest;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.fluids.BlockFluidBase;
|
||||
import net.minecraftforge.fluids.BlockFluidFinite;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.UniversalBucket;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack;
|
||||
import net.minecraftforge.fluids.capability.wrappers.FluidBucketWrapper;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import static net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack.FLUID_NBT_KEY;
|
||||
|
||||
//@Mod(modid = FluidPlacementTest.MODID, name = "ForgeDebugFluidPlacement", version = FluidPlacementTest.VERSION, acceptableRemoteVersions = "*")
|
||||
public class FluidPlacementTest
|
||||
{
|
||||
public static final String MODID = "forgedebugfluidplacement";
|
||||
public static final String VERSION = "1.0";
|
||||
|
||||
public static final boolean ENABLE = true;
|
||||
|
||||
//@Mod.EventBusSubscriber(modid = MODID)
|
||||
public static class Registration
|
||||
{
|
||||
@SubscribeEvent
|
||||
public static void registerBlocks(RegistryEvent.Register<Block> event)
|
||||
{
|
||||
if (!ENABLE || !ModelFluidTest.ENABLE)
|
||||
return;
|
||||
event.getRegistry().registerAll(
|
||||
FiniteFluidBlock.instance
|
||||
);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerItems(RegistryEvent.Register<Item> event)
|
||||
{
|
||||
if (!ENABLE || !ModelFluidTest.ENABLE)
|
||||
return;
|
||||
FluidRegistry.registerFluid(FiniteFluid.instance);
|
||||
FluidRegistry.addBucketForFluid(FiniteFluid.instance);
|
||||
event.getRegistry().registerAll(
|
||||
EmptyFluidContainer.instance,
|
||||
FluidContainer.instance,
|
||||
new FluidItemBlock(FiniteFluidBlock.instance).setRegistryName(FiniteFluidBlock.instance.getRegistryName())
|
||||
);
|
||||
MinecraftForge.EVENT_BUS.register(FluidContainer.instance);
|
||||
}
|
||||
}
|
||||
|
||||
//@Mod.EventBusSubscriber(value = Side.CLIENT, modid = MODID)
|
||||
public static class ClientEventHandler
|
||||
{
|
||||
@SubscribeEvent
|
||||
public static void registerModels(ModelRegistryEvent event)
|
||||
{
|
||||
if (!ENABLE || !ModelFluidTest.ENABLE)
|
||||
return;
|
||||
ModelResourceLocation fluidLocation = new ModelResourceLocation(MODID.toLowerCase() + ":" + FiniteFluidBlock.name, "normal");
|
||||
|
||||
Item fluid = Item.getItemFromBlock(FiniteFluidBlock.instance);
|
||||
ModelLoader.setCustomModelResourceLocation(EmptyFluidContainer.instance, 0, new ModelResourceLocation("forge:bucket", "inventory"));
|
||||
ModelLoader.setBucketModelDefinition(FluidContainer.instance);
|
||||
// no need to pass the locations here, since they'll be loaded by the block model logic.
|
||||
ModelBakery.registerItemVariants(fluid);
|
||||
ModelLoader.setCustomMeshDefinition(fluid, stack -> fluidLocation);
|
||||
ModelLoader.setCustomStateMapper(FiniteFluidBlock.instance, new StateMapperBase()
|
||||
{
|
||||
@Override
|
||||
protected ModelResourceLocation getModelResourceLocation(IBlockState state)
|
||||
{
|
||||
return fluidLocation;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static final class FiniteFluid extends Fluid
|
||||
{
|
||||
public static final String name = "finitefluid";
|
||||
public static final FiniteFluid instance = new FiniteFluid();
|
||||
|
||||
private FiniteFluid()
|
||||
{
|
||||
super(name, new ResourceLocation("blocks/water_still"), new ResourceLocation("blocks/water_flow"), new ResourceLocation("blocks/water_overlay"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor()
|
||||
{
|
||||
return 0xFFFFFF00;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedName(FluidStack stack)
|
||||
{
|
||||
return "Finite Fluid";
|
||||
}
|
||||
}
|
||||
|
||||
public static final class FiniteFluidBlock extends BlockFluidFinite
|
||||
{
|
||||
public static final FiniteFluidBlock instance = new FiniteFluidBlock();
|
||||
public static final String name = "finite_fluid_block";
|
||||
|
||||
private FiniteFluidBlock()
|
||||
{
|
||||
super(FiniteFluid.instance, Material.WATER);
|
||||
setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
|
||||
setUnlocalizedName(MODID + ":" + name);
|
||||
setRegistryName(MODID, name);
|
||||
}
|
||||
}
|
||||
|
||||
public static final class FluidItemBlock extends ItemBlock
|
||||
{
|
||||
FluidItemBlock(BlockFluidBase block)
|
||||
{
|
||||
super(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFluidBase getBlock()
|
||||
{
|
||||
return (BlockFluidBase) super.getBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage)
|
||||
{
|
||||
return getBlock().getMaxRenderHeightMeta();
|
||||
}
|
||||
}
|
||||
|
||||
public static final class EmptyFluidContainer extends ItemBucket
|
||||
{
|
||||
public static final EmptyFluidContainer instance = new EmptyFluidContainer();
|
||||
public static final String name = "empty_fluid_container";
|
||||
|
||||
private EmptyFluidContainer()
|
||||
{
|
||||
super(Blocks.AIR);
|
||||
setRegistryName(MODID, name);
|
||||
setUnlocalizedName(MODID + ":" + name);
|
||||
setMaxStackSize(16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt)
|
||||
{
|
||||
return new EmptyContainerHandler(stack);
|
||||
}
|
||||
|
||||
private static final class EmptyContainerHandler extends FluidBucketWrapper
|
||||
{
|
||||
public EmptyContainerHandler(@Nonnull ItemStack container)
|
||||
{
|
||||
super(container);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(FluidStack resource, boolean doFill)
|
||||
{
|
||||
if (container.getCount() != 1 || resource == null || resource.amount > FluidAttributes.BUCKET_VOLUME || container
|
||||
.getItem() instanceof ItemBucketMilk || getFluid() != null || !canFillFluidType(resource))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (doFill)
|
||||
{
|
||||
container = new ItemStack(FluidContainer.instance);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
NBTTagCompound fluidTag = new NBTTagCompound();
|
||||
resource.writeToNBT(fluidTag);
|
||||
tag.setTag(FLUID_NBT_KEY, fluidTag);
|
||||
container.setTagCompound(tag);
|
||||
}
|
||||
|
||||
return resource.amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final class FluidContainer extends UniversalBucket
|
||||
{
|
||||
public static final FluidContainer instance = new FluidContainer();
|
||||
public static final String name = "fluid_container";
|
||||
|
||||
private FluidContainer()
|
||||
{
|
||||
super(1000, new ItemStack(EmptyFluidContainer.instance), false);
|
||||
setCreativeTab(CreativeTabs.MISC);
|
||||
setRegistryName(MODID, name);
|
||||
setUnlocalizedName(MODID + ":" + name);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getItemStackDisplayName(@Nonnull ItemStack stack)
|
||||
{
|
||||
FluidStack fluid = getFluid(stack);
|
||||
if (fluid == null || fluid.getFluid() == null)
|
||||
{
|
||||
return "Empty Variable Container";
|
||||
}
|
||||
return "Variable Container (" + getFluid(stack).getLocalizedName() + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public FluidStack getFluid(ItemStack container)
|
||||
{
|
||||
container = container.copy();
|
||||
if (container.getTagCompound() != null)
|
||||
{
|
||||
container.setTagCompound(container.getTagCompound().getCompoundTag(FLUID_NBT_KEY));
|
||||
}
|
||||
return super.getFluid(container);
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(ItemStack stack, @Nullable World playerIn, List<String> tooltip, ITooltipFlag advanced)
|
||||
{
|
||||
FluidStack fluid = getFluid(stack);
|
||||
if (fluid != null)
|
||||
{
|
||||
tooltip.add(fluid.amount + "/1000");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(@Nullable CreativeTabs tab, @Nonnull NonNullList<ItemStack> subItems)
|
||||
{
|
||||
if (!this.isInCreativeTab(tab))
|
||||
return;
|
||||
Fluid[] fluids = new Fluid[]{FluidRegistry.WATER, FluidRegistry.LAVA, FiniteFluid.instance, ModelFluidTest.FLUID};
|
||||
// add 16 variable fillings
|
||||
for (Fluid fluid : fluids)
|
||||
{
|
||||
for (int amount = 125; amount <= 1000; amount += 125)
|
||||
{
|
||||
for (int offset = 63; offset >= 0; offset -= 63)
|
||||
{
|
||||
FluidStack fs = new FluidStack(fluid, amount - offset);
|
||||
ItemStack stack = new ItemStack(this);
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if (tag == null)
|
||||
{
|
||||
tag = new NBTTagCompound();
|
||||
}
|
||||
NBTTagCompound fluidTag = new NBTTagCompound();
|
||||
fs.writeToNBT(fluidTag);
|
||||
tag.setTag(FLUID_NBT_KEY, fluidTag);
|
||||
stack.setTagCompound(tag);
|
||||
subItems.add(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt)
|
||||
{
|
||||
return new FluidHandlerItemStack.SwapEmpty(stack, new ItemStack(EmptyFluidContainer.instance), 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,165 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* 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.debug.fluid;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandlerItem;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.FMLLoadCompleteEvent;
|
||||
import net.minecraftforge.fml.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
//@Mod(modid = "fluidhandlertest", name = "FluidHandlerTest", version = "0.0.0", clientSideOnly = true)
|
||||
public class ItemFluidHandlerTest
|
||||
{
|
||||
public static final boolean ENABLE = false;
|
||||
private static Logger logger;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
if (ENABLE)
|
||||
{
|
||||
logger = event.getModLog();
|
||||
}
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void loadComplete(FMLLoadCompleteEvent event)
|
||||
{
|
||||
if (!ENABLE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (ItemStack stack : getAllItems())
|
||||
{
|
||||
testFluidContainer(stack);
|
||||
}
|
||||
}
|
||||
|
||||
private static void testFluidContainer(ItemStack stack)
|
||||
{
|
||||
ItemStack originalStack = stack.copy();
|
||||
|
||||
ItemStack preDrainStack = stack.copy();
|
||||
IFluidHandlerItem fluidHandler = FluidUtil.getFluidHandler(preDrainStack);
|
||||
if (fluidHandler != null)
|
||||
{
|
||||
FluidStack drain = fluidHandler.drain(Integer.MAX_VALUE, true);
|
||||
ItemStack drainedStack = fluidHandler.getContainer();
|
||||
logger.info("Draining {} gives {} and {}", stackString(stack), fluidString(drain), stackString(drainedStack));
|
||||
|
||||
if (drain == null && !ItemStack.areItemStacksEqual(originalStack, preDrainStack))
|
||||
{
|
||||
throw new RuntimeException("ItemStack was altered by its fluid handler when drain did nothing.");
|
||||
}
|
||||
|
||||
for (Fluid fluid : FluidRegistry.getRegisteredFluids().values())
|
||||
{
|
||||
ItemStack preFillStack = stack.copy();
|
||||
fluidHandler = FluidUtil.getFluidHandler(preFillStack);
|
||||
if (fluidHandler != null)
|
||||
{
|
||||
int filled = fluidHandler.fill(new FluidStack(fluid, Integer.MAX_VALUE), true);
|
||||
ItemStack filledStack = fluidHandler.getContainer();
|
||||
|
||||
if (filled > 0)
|
||||
{
|
||||
logger.info("Filling {} with {} gives {}", stackString(stack), fluidString(new FluidStack(fluid, filled)), stackString(filledStack));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ItemStack.areItemStacksEqual(originalStack, preFillStack))
|
||||
{
|
||||
throw new RuntimeException("ItemStack was altered by its fluid handler when fill did nothing.");
|
||||
}
|
||||
if (!ItemStack.areItemStacksEqual(preFillStack, filledStack))
|
||||
{
|
||||
throw new RuntimeException("ItemStack was altered by its fluid handler when fill did nothing.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String fluidString(@Nullable FluidStack stack)
|
||||
{
|
||||
if (stack == null)
|
||||
{
|
||||
return "no fluid";
|
||||
}
|
||||
else
|
||||
{
|
||||
return stack.amount + "mB " + stack.getLocalizedName();
|
||||
}
|
||||
}
|
||||
|
||||
private static String stackString(@Nonnull ItemStack stack)
|
||||
{
|
||||
if (stack.isEmpty())
|
||||
{
|
||||
return "no item";
|
||||
}
|
||||
else
|
||||
{
|
||||
String resourceDomain;
|
||||
if (stack.getItem().getRegistryName() == null)
|
||||
{
|
||||
resourceDomain = "unknown";
|
||||
}
|
||||
else
|
||||
{
|
||||
resourceDomain = stack.getItem().getRegistryName().getResourceDomain();
|
||||
}
|
||||
return stack.getCount() + " " + stack.getDisplayName() + " (" + resourceDomain + ")";
|
||||
}
|
||||
}
|
||||
|
||||
private static List<ItemStack> getAllItems()
|
||||
{
|
||||
NonNullList<ItemStack> list = NonNullList.create();
|
||||
for (Item item : ForgeRegistries.ITEMS.getValuesCollection())
|
||||
{
|
||||
for (CreativeTabs tab : item.getCreativeTabs())
|
||||
{
|
||||
item.getSubItems(tab, list);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
*/
|
||||
Reference in new issue
Block a user