Spring cleaning
This commit is contained in:
parent
3e8fda0f26
commit
6fc4422b66
8 changed files with 16 additions and 92 deletions
|
@ -17,17 +17,17 @@ import biomesoplenty.configuration.BOPVanillaCompat;
|
||||||
import biomesoplenty.configuration.configfile.BOPConfiguration;
|
import biomesoplenty.configuration.configfile.BOPConfiguration;
|
||||||
import biomesoplenty.configuration.configfile.BOPConfigurationIDs;
|
import biomesoplenty.configuration.configfile.BOPConfigurationIDs;
|
||||||
import biomesoplenty.configuration.configfile.BOPConfigurationMisc;
|
import biomesoplenty.configuration.configfile.BOPConfigurationMisc;
|
||||||
|
import biomesoplenty.eventhandlers.BonemealEventHandler;
|
||||||
|
import biomesoplenty.eventhandlers.BreakSpeedEventHandler;
|
||||||
|
import biomesoplenty.eventhandlers.EntityEventHandler;
|
||||||
|
import biomesoplenty.eventhandlers.FlipperMovementEventHandler;
|
||||||
|
import biomesoplenty.eventhandlers.FluidEventHandler;
|
||||||
|
import biomesoplenty.eventhandlers.VillageMaterialEventHandler;
|
||||||
import biomesoplenty.handlers.BOPCraftHandler;
|
import biomesoplenty.handlers.BOPCraftHandler;
|
||||||
import biomesoplenty.handlers.BonemealHandler;
|
|
||||||
import biomesoplenty.handlers.BreakSpeedHandler;
|
|
||||||
import biomesoplenty.handlers.EntityEventHandler;
|
|
||||||
import biomesoplenty.handlers.FlipperMovementEventHandler;
|
|
||||||
import biomesoplenty.handlers.FluidEventHandler;
|
|
||||||
import biomesoplenty.handlers.MovementHandler;
|
import biomesoplenty.handlers.MovementHandler;
|
||||||
import biomesoplenty.handlers.SoundHandler;
|
import biomesoplenty.handlers.SoundHandler;
|
||||||
import biomesoplenty.handlers.TickHandlerClient;
|
import biomesoplenty.handlers.TickHandlerClient;
|
||||||
import biomesoplenty.handlers.TickHandlerServer;
|
import biomesoplenty.handlers.TickHandlerServer;
|
||||||
import biomesoplenty.handlers.VillageMaterialEventHandler;
|
|
||||||
import biomesoplenty.helpers.AchievementHelper;
|
import biomesoplenty.helpers.AchievementHelper;
|
||||||
import biomesoplenty.helpers.CreativeTabsBOP;
|
import biomesoplenty.helpers.CreativeTabsBOP;
|
||||||
import biomesoplenty.helpers.Version;
|
import biomesoplenty.helpers.Version;
|
||||||
|
@ -104,13 +104,12 @@ public class BiomesOPlenty
|
||||||
if (ForgeVersion.buildVersion >= 891 || proxy instanceof ClientProxy)
|
if (ForgeVersion.buildVersion >= 891 || proxy instanceof ClientProxy)
|
||||||
MinecraftForge.TERRAIN_GEN_BUS.register(new VillageMaterialEventHandler());
|
MinecraftForge.TERRAIN_GEN_BUS.register(new VillageMaterialEventHandler());
|
||||||
MinecraftForge.EVENT_BUS.register(new AchievementHelper());
|
MinecraftForge.EVENT_BUS.register(new AchievementHelper());
|
||||||
MinecraftForge.EVENT_BUS.register(new BonemealHandler());
|
MinecraftForge.EVENT_BUS.register(new BonemealEventHandler());
|
||||||
MinecraftForge.EVENT_BUS.register(new EntityEventHandler());
|
MinecraftForge.EVENT_BUS.register(new EntityEventHandler());
|
||||||
MinecraftForge.EVENT_BUS.register(new FluidEventHandler());
|
MinecraftForge.EVENT_BUS.register(new FluidEventHandler());
|
||||||
MinecraftForge.EVENT_BUS.register(new BreakSpeedHandler());
|
MinecraftForge.EVENT_BUS.register(new BreakSpeedEventHandler());
|
||||||
MinecraftForge.EVENT_BUS.register(new MovementHandler());
|
MinecraftForge.EVENT_BUS.register(new MovementHandler());
|
||||||
MinecraftForge.EVENT_BUS.register(new FlipperMovementEventHandler());
|
MinecraftForge.EVENT_BUS.register(new FlipperMovementEventHandler());
|
||||||
//MinecraftForge.EVENT_BUS.register(new AxeChopHandler());
|
|
||||||
|
|
||||||
proxy.registerRenderers();
|
proxy.registerRenderers();
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package biomesoplenty.handlers;
|
package biomesoplenty.eventhandlers;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraftforge.event.Event.Result;
|
import net.minecraftforge.event.Event.Result;
|
||||||
|
@ -13,7 +13,7 @@ import biomesoplenty.worldgen.WorldGenGiantFlowerYellow;
|
||||||
import biomesoplenty.worldgen.WorldGenCattailBonemeal;
|
import biomesoplenty.worldgen.WorldGenCattailBonemeal;
|
||||||
import biomesoplenty.worldgen.WorldGenKelp;
|
import biomesoplenty.worldgen.WorldGenKelp;
|
||||||
|
|
||||||
public class BonemealHandler
|
public class BonemealEventHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
|
@ -1,4 +1,4 @@
|
||||||
package biomesoplenty.handlers;
|
package biomesoplenty.eventhandlers;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -14,7 +14,7 @@ import net.minecraftforge.event.ForgeSubscribe;
|
||||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||||
import biomesoplenty.api.Blocks;
|
import biomesoplenty.api.Blocks;
|
||||||
|
|
||||||
public class BreakSpeedHandler
|
public class BreakSpeedEventHandler
|
||||||
{
|
{
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
public void breakSpeed(PlayerEvent.BreakSpeed event)
|
public void breakSpeed(PlayerEvent.BreakSpeed event)
|
|
@ -1,4 +1,4 @@
|
||||||
package biomesoplenty.handlers;
|
package biomesoplenty.eventhandlers;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockColored;
|
import net.minecraft.block.BlockColored;
|
|
@ -1,4 +1,4 @@
|
||||||
package biomesoplenty.handlers;
|
package biomesoplenty.eventhandlers;
|
||||||
|
|
||||||
import net.minecraft.entity.EntityLiving;
|
import net.minecraft.entity.EntityLiving;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
|
@ -1,4 +1,4 @@
|
||||||
package biomesoplenty.handlers;
|
package biomesoplenty.eventhandlers;
|
||||||
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
|
@ -1,4 +1,4 @@
|
||||||
package biomesoplenty.handlers;
|
package biomesoplenty.eventhandlers;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraftforge.event.Event.Result;
|
import net.minecraftforge.event.Event.Result;
|
|
@ -1,75 +0,0 @@
|
||||||
package biomesoplenty.handlers;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumToolMaterial;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemAxe;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.event.ForgeSubscribe;
|
|
||||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
|
||||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
|
||||||
import biomesoplenty.configuration.BOPItems;
|
|
||||||
|
|
||||||
public class AxeChopHandler
|
|
||||||
{
|
|
||||||
@ForgeSubscribe
|
|
||||||
public void chopTree(PlayerInteractEvent event)
|
|
||||||
{
|
|
||||||
ItemStack itemstack = event.entityPlayer.getCurrentEquippedItem();
|
|
||||||
EntityPlayer player = event.entityPlayer;
|
|
||||||
World world = player.worldObj;
|
|
||||||
|
|
||||||
if (event.action == Action.RIGHT_CLICK_BLOCK)
|
|
||||||
{
|
|
||||||
if (itemstack != null)
|
|
||||||
{
|
|
||||||
Item item = Item.itemsList[itemstack.itemID];
|
|
||||||
|
|
||||||
if (item instanceof ItemAxe)
|
|
||||||
{
|
|
||||||
if (Block.blocksList[world.getBlockId(event.x, event.y, event.z)].isWood(world, event.x, event.y, event.z))
|
|
||||||
{
|
|
||||||
EnumToolMaterial toolMaterial = EnumToolMaterial.valueOf(((ItemAxe)item).getToolMaterialName());
|
|
||||||
|
|
||||||
player.swingItem();
|
|
||||||
player.playSound("dig.wood", 1.0F, 0.25F);
|
|
||||||
|
|
||||||
if (toolMaterial != EnumToolMaterial.WOOD && toolMaterial != EnumToolMaterial.STONE && toolMaterial != BOPItems.EnumToolMaterialMud)
|
|
||||||
{
|
|
||||||
int firstBlockId = world.getBlockId(event.x, event.y, event.z);
|
|
||||||
int logNo = 0;
|
|
||||||
|
|
||||||
itemstack.damageItem(4, player);
|
|
||||||
|
|
||||||
for (int l = 0; world.getBlockId(event.x, event.y + l, event.z) == firstBlockId; l++)
|
|
||||||
{
|
|
||||||
if (!world.isRemote)
|
|
||||||
{
|
|
||||||
logNo += l * 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (world.rand.nextInt(15 + logNo) == 0)
|
|
||||||
{
|
|
||||||
for (int i = 0; world.getBlockId(event.x, event.y + i, event.z) == firstBlockId; i++)
|
|
||||||
{
|
|
||||||
if (!world.isRemote)
|
|
||||||
{
|
|
||||||
itemstack.damageItem(2, player);
|
|
||||||
world.destroyBlock(event.x, event.y + i, event.z, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
itemstack.damageItem(7, player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue