Patch work, most of block classes, and fix eclipse run configs.

This commit is contained in:
LexManos committed 2018-11-16 23:15:39 -08:00
1 parent 763b3e806e
commit 7c0d94ce9c
51 files changed
+1865 -276

No files matched your search

@@ -254,7 +254,7 @@ public class ForgeEventFactory
return event.getDisplayname();
}
public static float fireBlockHarvesting(List<ItemStack> drops, World world, BlockPos pos, IBlockState state, int fortune, float dropChance, boolean silkTouch, EntityPlayer player)
public static float fireBlockHarvesting(NonNullList<ItemStack> drops, World world, BlockPos pos, IBlockState state, int fortune, float dropChance, boolean silkTouch, EntityPlayer player)
{
BlockEvent.HarvestDropsEvent event = new BlockEvent.HarvestDropsEvent(world, pos, state, fortune, dropChance, drops, player, silkTouch);
MinecraftForge.EVENT_BUS.post(event);
@@ -22,17 +22,15 @@ package net.minecraftforge.event.world;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockPortal;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Enchantments;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
@@ -90,12 +88,12 @@ public class BlockEvent extends Event
public static class HarvestDropsEvent extends BlockEvent
{
private final int fortuneLevel;
private final List<ItemStack> drops;
private final NonNullList<ItemStack> drops;
private final boolean isSilkTouching;
private float dropChance; // Change to e.g. 1.0f, if you manipulate the list and want to guarantee it always drops
private final EntityPlayer harvester; // May be null for non-player harvesting such as explosions or machines
public HarvestDropsEvent(World world, BlockPos pos, IBlockState state, int fortuneLevel, float dropChance, List<ItemStack> drops, EntityPlayer harvester, boolean isSilkTouching)
public HarvestDropsEvent(World world, BlockPos pos, IBlockState state, int fortuneLevel, float dropChance, NonNullList<ItemStack> drops, EntityPlayer harvester, boolean isSilkTouching)
{
super(world, pos, state);
this.fortuneLevel = fortuneLevel;
@@ -20,6 +20,7 @@
package net.minecraftforge.event.world;
import net.minecraft.block.state.IBlockState;
import net.minecraft.state.properties.NoteBlockInstrument;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.eventbus.api.Cancelable;
@@ -86,20 +87,20 @@ public class NoteBlockEvent extends BlockEvent
@Cancelable
public static class Play extends NoteBlockEvent
{
private Instrument instrument;
private NoteBlockInstrument instrument;
public Play(World world, BlockPos pos, IBlockState state, int note, int instrument)
public Play(World world, BlockPos pos, IBlockState state, int note, NoteBlockInstrument instrument)
{
super(world, pos, state, note);
this.setInstrument(Instrument.fromId(instrument));
this.instrument = instrument;
}
public Instrument getInstrument()
public NoteBlockInstrument getInstrument()
{
return instrument;
}
public void setInstrument(Instrument instrument)
public void setInstrument(NoteBlockInstrument instrument)
{
this.instrument = instrument;
}
@@ -133,32 +134,6 @@ public class NoteBlockEvent extends BlockEvent
}
}
/**
* Describes the types of musical Instruments that can be played by a Noteblock.
* The Instrument being played can be overridden with {@link NoteBlockEvent.Play#setInstrument(Instrument)}
*/
public static enum Instrument
{
PIANO,
BASSDRUM,
SNARE,
CLICKS,
BASSGUITAR,
FLUTE,
BELL,
GUITAR,
CHIME,
XYLOPHONE;
// cache to avoid creating a new array every time
private static final Instrument[] values = values();
static Instrument fromId(int id)
{
return id < 0 || id >= values.length ? PIANO : values[id];
}
}
/**
* Information about the pitch of a Noteblock note.
* For altered notes such as G-Sharp / A-Flat the Sharp variant is used here.