mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 00:37:52 +00:00
More patch work, client patches.
This commit is contained in:
1 parent
f0e5baa8e5
commit
26ca27193c
28 files changed
+380
-403
No files matched your search
@@ -59,6 +59,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.network.NetHandlerPlayServer;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.SPacketBlockChange;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityNote;
|
||||
@@ -671,7 +672,7 @@ public class ForgeHooks
|
||||
// Tell client the block is gone immediately then process events
|
||||
if (world.getTileEntity(pos) == null)
|
||||
{
|
||||
S23PacketBlockChange packet = new S23PacketBlockChange(world, pos);
|
||||
SPacketBlockChange packet = new SPacketBlockChange(world, pos);
|
||||
packet.blockState = Blocks.air.getDefaultState();
|
||||
entityPlayer.playerNetServerHandler.sendPacket(packet);
|
||||
}
|
||||
@@ -937,4 +938,4 @@ public class ForgeHooks
|
||||
MovingObjectPosition movingObjectPosition = rayTraceEyes(entity, length);
|
||||
return movingObjectPosition == null ? null : movingObjectPosition.hitVec;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
@@ -335,18 +336,7 @@ public class ForgeEventFactory
|
||||
return event.canUpdate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use {@link #onPlaySoundAtEntity(Entity,String,float,float)}
|
||||
*/
|
||||
@Deprecated
|
||||
public static String onPlaySoundAt(Entity entity, String name, float volume, float pitch)
|
||||
{
|
||||
PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(entity, name, volume, pitch);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event.name;
|
||||
}
|
||||
|
||||
public static PlaySoundAtEntityEvent onPlaySoundAtEntity(Entity entity, String name, float volume, float pitch)
|
||||
public static PlaySoundAtEntityEvent onPlaySoundAtEntity(Entity entity, SoundEvent name, float volume, float pitch)
|
||||
{
|
||||
PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(entity, name, volume, pitch);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.minecraftforge.event.entity;
|
||||
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
|
||||
/**
|
||||
* PlaySoundAtEntityEvent is fired a sound is to be played at an Entity<br>
|
||||
@@ -25,14 +26,14 @@ import net.minecraft.entity.Entity;
|
||||
**/
|
||||
@Cancelable
|
||||
public class PlaySoundAtEntityEvent extends EntityEvent
|
||||
{
|
||||
public String name;
|
||||
public final float volume;
|
||||
public final float pitch;
|
||||
public float newVolume;
|
||||
public float newPitch;
|
||||
|
||||
public PlaySoundAtEntityEvent(Entity entity, String name, float volume, float pitch)
|
||||
{
|
||||
private SoundEvent name;
|
||||
private final float volume;
|
||||
private final float pitch;
|
||||
private float newVolume;
|
||||
private float newPitch;
|
||||
|
||||
public PlaySoundAtEntityEvent(Entity entity, SoundEvent name, float volume, float pitch)
|
||||
{
|
||||
super(entity);
|
||||
this.name = name;
|
||||
@@ -41,4 +42,13 @@ public class PlaySoundAtEntityEvent extends EntityEvent
|
||||
this.newVolume = volume;
|
||||
this.newPitch = pitch;
|
||||
}
|
||||
|
||||
public SoundEvent getSound(){ return this.name; }
|
||||
public float getDefaultVolume() { return this.volume; }
|
||||
public float getDefaultPitch() { return this.pitch; }
|
||||
public float getVolume() { return this.newVolume; }
|
||||
public float getPitch() { return this.newPitch; }
|
||||
public void setSound(SoundEvent value) { this.name = value; }
|
||||
public void setVolume(float value) { this.newVolume = value; }
|
||||
public void setPitch(float value) { this.newPitch = value; }
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -78,14 +79,14 @@ public class BlockEvent extends Event
|
||||
this.player = player;
|
||||
|
||||
if (state == null || !ForgeHooks.canHarvestBlock(state.getBlock(), player, world, pos) || // Handle empty block or player unable to break block scenario
|
||||
(state.getBlock().canSilkHarvest(world, pos, world.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player))) // If the block is being silk harvested, the exp dropped is 0
|
||||
(state.getBlock().canSilkHarvest(world, pos, world.getBlockState(pos), player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185306_r, player.func_184614_ca()) > 0)) // If the block is being silk harvested, the exp dropped is 0
|
||||
{
|
||||
this.exp = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int bonusLevel = EnchantmentHelper.getFortuneModifier(player);
|
||||
this.exp = state.getBlock().getExpDrop(world, pos, bonusLevel);
|
||||
int bonusLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185308_t, player.func_184614_ca());
|
||||
this.exp = state.getBlock().getExpDrop(state, world, pos, bonusLevel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,13 +134,13 @@ public class BlockEvent extends Event
|
||||
{
|
||||
super(blockSnapshot.world, blockSnapshot.pos, blockSnapshot.getCurrentBlock());
|
||||
this.player = player;
|
||||
this.itemInHand = player.getCurrentEquippedItem();
|
||||
this.itemInHand = player.func_184614_ca();
|
||||
this.blockSnapshot = blockSnapshot;
|
||||
this.placedBlock = blockSnapshot.getCurrentBlock();
|
||||
this.placedAgainst = placedAgainst;
|
||||
if (DEBUG)
|
||||
{
|
||||
System.out.printf("Created PlaceEvent - [PlacedBlock: %s ][PlacedAgainst: %s ][ItemStack: %s ][Player: %s ]\n", placedBlock, placedAgainst, player.getCurrentEquippedItem(), player);
|
||||
System.out.printf("Created PlaceEvent - [PlacedBlock: %s ][PlacedAgainst: %s ][ItemStack: %s ][Player: %s ]\n", placedBlock, placedAgainst, itemInHand, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user