2018-07-01 21:17:28 +00:00
|
|
|
/*
|
|
|
|
* Minecraft Forge
|
2019-02-10 22:57:03 +00:00
|
|
|
* Copyright (c) 2016-2019.
|
2018-07-01 21:17:28 +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
|
2019-08-24 00:31:09 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2019-07-21 01:04:00 +00:00
|
|
|
|
2018-07-01 21:17:28 +00:00
|
|
|
|
2018-07-05 02:58:55 +00:00
|
|
|
package net.minecraftforge.debug.fluid;
|
2018-06-27 19:04:23 +00:00
|
|
|
|
|
|
|
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;
|
2019-01-15 03:32:43 +00:00
|
|
|
import net.minecraftforge.fml.event.FMLPreInitializationEvent;
|
2018-06-27 19:04:23 +00:00
|
|
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|
|
|
|
2019-07-21 01:04:00 +00:00
|
|
|
*/
|
2018-06-27 19:04:23 +00:00
|
|
|
/**
|
|
|
|
* 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.
|
2019-07-21 01:04:00 +00:00
|
|
|
*//*
|
|
|
|
|
2019-03-23 00:33:18 +00:00
|
|
|
//@Mod(modid = "fluidplaceblocktest", name = "FluidPlaceBlockTest", version = "0.0.0", acceptableRemoteVersions = "*")
|
2018-07-05 02:58:55 +00:00
|
|
|
public class FluidPlaceBlockEventTest
|
2018-06-27 19:04:23 +00:00
|
|
|
{
|
|
|
|
private static final boolean ENABLED = false;
|
|
|
|
|
|
|
|
@Mod.EventHandler
|
|
|
|
public void preinit(FMLPreInitializationEvent event)
|
|
|
|
{
|
|
|
|
if (!ENABLED) return;
|
2018-07-05 02:58:55 +00:00
|
|
|
MinecraftForge.EVENT_BUS.register(FluidPlaceBlockEventTest.class);
|
2018-06-27 19:04:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@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());
|
|
|
|
}
|
|
|
|
}
|
2019-07-21 01:04:00 +00:00
|
|
|
*/
|