mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 03:25:18 +00:00
Most client patches done except the render pipeline.
Someone who has more in depth knowledge of that rendering system will need to do it.
This commit is contained in:
1 parent
b687180e12
commit
bf9158172f
109 files changed
+1597
-2275
No files matched your search
@@ -37,6 +37,7 @@ import net.minecraft.entity.boss.EntityDragon;
|
||||
import net.minecraft.entity.boss.EntityWither;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityWitherSkull;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.MobEffects;
|
||||
@@ -65,6 +66,7 @@ import net.minecraft.world.dimension.EndDimension;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
@@ -216,7 +218,7 @@ public interface IForgeBlock
|
||||
*/
|
||||
default public boolean canHarvestBlock(IBlockState state, IBlockReader world, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
return net.minecraftforge.common.ForgeHooks.canHarvestBlock(state, player, world, pos);
|
||||
return ForgeHooks.canHarvestBlock(state, player, world, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -236,12 +238,13 @@ public interface IForgeBlock
|
||||
* @param pos Block position in world
|
||||
* @param willHarvest True if Block.harvestBlock will be called after this, if the return in true.
|
||||
* Can be useful to delay the destruction of tile entities till after harvestBlock
|
||||
* @param fluid The current fluid state at current position
|
||||
* @return True if the block is actually destroyed.
|
||||
*/
|
||||
default boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
|
||||
default boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest, IFluidState fluid)
|
||||
{
|
||||
getBlock().onBlockHarvested(world, pos, state, player);
|
||||
return world.setBlockState(pos, net.minecraft.init.Blocks.AIR.getDefaultState(), world.isRemote ? 11 : 3);
|
||||
return world.setBlockState(pos, fluid.getBlockState(), world.isRemote ? 11 : 3);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -508,6 +511,24 @@ public interface IForgeBlock
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawn a digging particle effect in the world, this is a wrapper
|
||||
* around EffectRenderer.addBlockHitEffects to allow the block more
|
||||
* control over the particles. Useful when you have entirely different
|
||||
* texture sheets for different sides/locations in the world.
|
||||
*
|
||||
* @param state The current state
|
||||
* @param world The current world
|
||||
* @param target The target the player is looking at {x/y/z/side/sub}
|
||||
* @param manager A reference to the current particle manager.
|
||||
* @return True to prevent vanilla digging particles form spawning.
|
||||
*/
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
default boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, ParticleManager manager)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawn particles for when the block is destroyed. Due to the nature
|
||||
* of how this is invoked, the x/y/z locations are not always guaranteed
|
||||
|
||||
@@ -30,6 +30,7 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.EntitySpawnPlacementRegistry.SpawnPlacementType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -199,11 +200,12 @@ public interface IForgeBlockState
|
||||
* @param pos Block position in world
|
||||
* @param willHarvest True if Block.harvestBlock will be called after this, if the return in true.
|
||||
* Can be useful to delay the destruction of tile entities till after harvestBlock
|
||||
* @param fluid The current fluid and block state for the position in the world.
|
||||
* @return True if the block is actually destroyed.
|
||||
*/
|
||||
default boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
|
||||
default boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest, IFluidState fluid)
|
||||
{
|
||||
return getBlockState().getBlock().removedByPlayer(getBlockState(), world, pos, player, willHarvest);
|
||||
return getBlockState().getBlock().removedByPlayer(getBlockState(), world, pos, player, willHarvest, fluid);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -449,6 +451,23 @@ public interface IForgeBlockState
|
||||
return getBlockState().getBlock().addRunningEffects(getBlockState(), world, pos, entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawn a digging particle effect in the world, this is a wrapper
|
||||
* around EffectRenderer.addBlockHitEffects to allow the block more
|
||||
* control over the particles. Useful when you have entirely different
|
||||
* texture sheets for different sides/locations in the world.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param target The target the player is looking at {x/y/z/side/sub}
|
||||
* @param manager A reference to the current particle manager.
|
||||
* @return True to prevent vanilla digging particles form spawning.
|
||||
*/
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
default boolean addHitEffects(World world, RayTraceResult target, ParticleManager manager)
|
||||
{
|
||||
return getBlockState().getBlock().addHitEffects(getBlockState(), world, target, manager);
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawn particles for when the block is destroyed. Due to the nature
|
||||
* of how this is invoked, the x/y/z locations are not always guaranteed
|
||||
|
||||
@@ -21,6 +21,7 @@ package net.minecraftforge.common.extensions;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.audio.MusicTicker;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.dimension.Dimension;
|
||||
import net.minecraft.world.dimension.NetherDimension;
|
||||
@@ -44,7 +45,7 @@ public interface IForgeDimension
|
||||
* and VillageCollection are initialized. On client, called when world is
|
||||
* constructed, just before world load event is called. Note that this method is
|
||||
* always called before the world load event.
|
||||
*
|
||||
*
|
||||
* @return initial holder for capabilities on the world
|
||||
*/
|
||||
default net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities()
|
||||
@@ -58,7 +59,7 @@ public interface IForgeDimension
|
||||
* worldA.provider.getMovementFactor() / worldB.provider.getMovementFactor()
|
||||
* Example: Overworld factor is 1, nether factor is 8. Traveling from overworld
|
||||
* to nether multiplies coordinates by 1/8.
|
||||
*
|
||||
*
|
||||
* @return The movement factor
|
||||
*/
|
||||
default double getMovementFactor()
|
||||
@@ -103,7 +104,7 @@ public interface IForgeDimension
|
||||
void setWeatherRenderer(IRenderHandler renderer);
|
||||
|
||||
void resetRainAndThunder();
|
||||
|
||||
|
||||
default boolean canDoLightning(net.minecraft.world.chunk.Chunk chunk)
|
||||
{
|
||||
return true;
|
||||
@@ -113,4 +114,16 @@ public interface IForgeDimension
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on the client to get the music type to play when in this world type.
|
||||
* At the time of calling, the client player and world are guaranteed to be non-null
|
||||
* @return null to use vanilla logic, otherwise a MusicType to play in this world
|
||||
*/
|
||||
@Nullable
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
default MusicTicker.MusicType getMusicType()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -532,22 +532,6 @@ public interface IForgeItem
|
||||
stack.getOrCreateTag().setInt("Damage", Math.max(0, damage));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checked from
|
||||
* {@link net.minecraft.client.multiplayer.PlayerControllerMP#onPlayerDestroyBlock(BlockPos pos)
|
||||
* PlayerControllerMP.onPlayerDestroyBlock()} when a creative player left-clicks
|
||||
* a block with this item. Also checked from
|
||||
* {@link net.minecraftforge.common.ForgeHooks#onBlockBreakEvent(World, GameType, EntityPlayerMP, BlockPos)
|
||||
* ForgeHooks.onBlockBreakEvent()} to prevent sending an event.
|
||||
*
|
||||
* @return true if the given player can destroy specified block in creative mode
|
||||
* with this item
|
||||
*/
|
||||
default boolean canDestroyBlockInCreative(World world, BlockPos pos, ItemStack stack, EntityPlayer player)
|
||||
{
|
||||
return !(this instanceof ItemSword);
|
||||
}
|
||||
|
||||
/**
|
||||
* ItemStack sensitive version of {@link #canHarvestBlock(IBlockState)}
|
||||
*
|
||||
|
||||
@@ -123,5 +123,30 @@ public interface IForgeItemStack extends ICapabilitySerializable<NBTTagCompound>
|
||||
getStack().write(ret);
|
||||
return ret;
|
||||
}
|
||||
/**
|
||||
* Called before a block is broken. Return true to prevent default block
|
||||
* harvesting.
|
||||
*
|
||||
* Note: In SMP, this is called on both client and server sides!
|
||||
*
|
||||
* @param pos Block's position in world
|
||||
* @param player The Player that is wielding the item
|
||||
* @return True to prevent harvesting, false to continue as normal
|
||||
*/
|
||||
default boolean onBlockStartBreak(BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
return getStack().isEmpty() || getStack().getItem().onBlockStartBreak(getStack(), pos, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the player is mining a block and the item in his hand changes.
|
||||
* Allows to not reset blockbreaking if only NBT or similar changes.
|
||||
*
|
||||
* @param newStack The new stack
|
||||
* @return True to reset block break progress
|
||||
*/
|
||||
default boolean shouldCauseBlockBreakReset(ItemStack newStack)
|
||||
{
|
||||
return getStack().getItem().shouldCauseBlockBreakReset(getStack(), newStack);
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ import net.minecraftforge.common.capabilities.ICapabilitySerializable;
|
||||
public interface IForgeTileEntity extends ICapabilitySerializable<NBTTagCompound>
|
||||
{
|
||||
default TileEntity getTileEntity() { return (TileEntity) this; }
|
||||
|
||||
|
||||
@Override
|
||||
default void deserializeNBT(NBTTagCompound nbt)
|
||||
{
|
||||
@@ -40,4 +40,35 @@ public interface IForgeTileEntity extends ICapabilitySerializable<NBTTagCompound
|
||||
getTileEntity().write(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when you receive a TileEntityData packet for the location this
|
||||
* TileEntity is currently in. On the client, the NetworkManager will always
|
||||
* be the remote server. On the server, it will be whomever is responsible for
|
||||
* sending the packet.
|
||||
*
|
||||
* @param net The NetworkManager the packet originated from
|
||||
* @param pkt The data packet
|
||||
*/
|
||||
default void onDataPacket(net.minecraft.network.NetworkManager net, net.minecraft.network.play.server.SPacketUpdateTileEntity pkt){ }
|
||||
|
||||
/**
|
||||
* Called when the chunk's TE update tag, gotten from {@link #getUpdateTag()}, is received on the client.
|
||||
* <p>
|
||||
* Used to handle this tag in a special way. By default this simply calls {@link #readFromNBT(NBTTagCompound)}.
|
||||
*
|
||||
* @param tag The {@link NBTTagCompound} sent from {@link #getUpdateTag()}
|
||||
*/
|
||||
default void handleUpdateTag(NBTTagCompound tag)
|
||||
{
|
||||
getTileEntity().read(tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a {@link NBTTagCompound} that can be used to store custom data for this tile entity.
|
||||
* It will be written, and read from disc, so it persists over world saves.
|
||||
*
|
||||
* @return A compound tag for custom data
|
||||
*/
|
||||
NBTTagCompound getTileData();
|
||||
}
|
||||
Reference in new issue
Block a user