2018-03-28 05:09:10 +00:00
|
|
|
/*
|
|
|
|
* Minecraft Forge
|
2018-07-01 21:17:28 +00:00
|
|
|
* Copyright (c) 2016-2018.
|
2018-03-28 05:09:10 +00:00
|
|
|
*
|
|
|
|
* 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;
|
2016-07-23 03:08:38 +00:00
|
|
|
|
|
|
|
import net.minecraft.init.Blocks;
|
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
|
|
|
import net.minecraftforge.event.world.BlockEvent.CreateFluidSourceEvent;
|
|
|
|
import net.minecraftforge.fml.common.Mod;
|
2019-01-15 03:32:43 +00:00
|
|
|
import net.minecraftforge.fml.event.FMLInitializationEvent;
|
2018-06-11 01:12:46 +00:00
|
|
|
import net.minecraftforge.eventbus.api.Event.Result;
|
|
|
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
2016-07-23 03:08:38 +00:00
|
|
|
|
2016-11-22 20:12:13 +00:00
|
|
|
@Mod(modid = "createfluidsourcetest", name = "CreateFluidSourceTest", version = "1.0", acceptableRemoteVersions = "*")
|
2018-03-28 05:09:10 +00:00
|
|
|
public class CreateFluidSourceEventTest
|
2016-07-23 03:08:38 +00:00
|
|
|
{
|
|
|
|
public static final boolean ENABLE = false;
|
|
|
|
|
|
|
|
@Mod.EventHandler
|
|
|
|
public static void init(FMLInitializationEvent event)
|
|
|
|
{
|
|
|
|
if (ENABLE)
|
2017-05-29 09:10:40 +00:00
|
|
|
{
|
2018-03-28 05:09:10 +00:00
|
|
|
MinecraftForge.EVENT_BUS.register(CreateFluidSourceEventTest.class);
|
2017-05-29 09:10:40 +00:00
|
|
|
}
|
2016-07-23 03:08:38 +00:00
|
|
|
}
|
|
|
|
|
2018-06-11 01:12:46 +00:00
|
|
|
@net.minecraftforge.eventbus.api.SubscribeEvent
|
2016-07-23 03:08:38 +00:00
|
|
|
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)
|
2017-05-29 09:10:40 +00:00
|
|
|
{
|
2016-07-23 03:08:38 +00:00
|
|
|
event.setResult(Result.DENY);
|
2017-05-29 09:10:40 +00:00
|
|
|
}
|
2016-07-23 03:08:38 +00:00
|
|
|
else
|
2017-05-29 09:10:40 +00:00
|
|
|
{
|
2016-07-23 03:08:38 +00:00
|
|
|
event.setResult(Result.ALLOW);
|
2017-05-29 09:10:40 +00:00
|
|
|
}
|
2016-07-23 03:08:38 +00:00
|
|
|
}
|
|
|
|
}
|