mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 11:05:40 +00:00
1.18.x Omnibus (#8239)
This commit is contained in:
1 parent
4011c3fb07
commit
34291c1fb2
89 files changed
+1014
-1192
No files matched your search
@@ -16,13 +16,13 @@ public abstract class EffectRenderer
|
||||
public static final EffectRenderer DUMMY = new EffectRenderer()
|
||||
{
|
||||
@Override
|
||||
public void renderInventoryEffect(MobEffectInstance effect, EffectRenderingInventoryScreen<?> gui, PoseStack mStack, int x, int y, float z)
|
||||
public void renderInventoryEffect(MobEffectInstance effectInstance, EffectRenderingInventoryScreen<?> gui, PoseStack poseStack, int x, int y, float z)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderHUDEffect(MobEffectInstance effect, GuiComponent gui, PoseStack mStack, int x, int y, float z, float alpha)
|
||||
public void renderHUDEffect(MobEffectInstance effectInstance, GuiComponent gui, PoseStack poseStack, int x, int y, float z, float alpha)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -65,26 +65,26 @@ public abstract class EffectRenderer
|
||||
* Called to draw the this Potion onto the player's inventory when it's active.
|
||||
* This can be used to e.g. render Potion icons from your own texture.
|
||||
*
|
||||
* @param effect the active PotionEffect
|
||||
* @param gui the gui instance
|
||||
* @param mStack The PoseStack
|
||||
* @param x the x coordinate
|
||||
* @param y the y coordinate
|
||||
* @param z the z level
|
||||
* @param effectInstance the effect instance
|
||||
* @param gui the gui instance
|
||||
* @param poseStack the pose stack
|
||||
* @param x the x coordinate
|
||||
* @param y the y coordinate
|
||||
* @param z the z level
|
||||
*/
|
||||
public abstract void renderInventoryEffect(MobEffectInstance effect, EffectRenderingInventoryScreen<?> gui, PoseStack mStack, int x, int y, float z);
|
||||
public abstract void renderInventoryEffect(MobEffectInstance effectInstance, EffectRenderingInventoryScreen<?> gui, PoseStack poseStack, int x, int y, float z);
|
||||
|
||||
/**
|
||||
* Called to draw the this Potion onto the player's ingame HUD when it's active.
|
||||
* This can be used to e.g. render Potion icons from your own texture.
|
||||
*
|
||||
* @param effect the active PotionEffect
|
||||
* @param gui the gui instance
|
||||
* @param mStack The PoseStack
|
||||
* @param x the x coordinate
|
||||
* @param y the y coordinate
|
||||
* @param z the z level
|
||||
* @param alpha the alpha value, blinks when the potion is about to run out
|
||||
* @param effectInstance the active PotionEffect
|
||||
* @param gui the gui instance
|
||||
* @param poseStack the pose stack
|
||||
* @param x the x coordinate
|
||||
* @param y the y coordinate
|
||||
* @param z the z level
|
||||
* @param alpha the alpha value, blinks when the potion is about to run out
|
||||
*/
|
||||
public abstract void renderHUDEffect(MobEffectInstance effect, GuiComponent gui, PoseStack mStack, int x, int y, float z, float alpha);
|
||||
public abstract void renderHUDEffect(MobEffectInstance effectInstance, GuiComponent gui, PoseStack poseStack, int x, int y, float z, float alpha);
|
||||
}
|
||||
@@ -205,28 +205,28 @@ public class ForgeHooksClient
|
||||
return result != null ? result : _default;
|
||||
}
|
||||
|
||||
public static boolean onDrawHighlight(LevelRenderer context, Camera info, HitResult target, float partialTicks, PoseStack matrix, MultiBufferSource buffers)
|
||||
public static boolean onDrawHighlight(LevelRenderer context, Camera camera, HitResult target, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource)
|
||||
{
|
||||
switch (target.getType()) {
|
||||
case BLOCK:
|
||||
if (!(target instanceof BlockHitResult)) return false;
|
||||
return MinecraftForge.EVENT_BUS.post(new DrawSelectionEvent.HighlightBlock(context, info, target, partialTicks, matrix, buffers));
|
||||
return MinecraftForge.EVENT_BUS.post(new DrawSelectionEvent.HighlightBlock(context, camera, target, partialTick, poseStack, bufferSource));
|
||||
case ENTITY:
|
||||
if (!(target instanceof EntityHitResult)) return false;
|
||||
return MinecraftForge.EVENT_BUS.post(new DrawSelectionEvent.HighlightEntity(context, info, target, partialTicks, matrix, buffers));
|
||||
return MinecraftForge.EVENT_BUS.post(new DrawSelectionEvent.HighlightEntity(context, camera, target, partialTick, poseStack, bufferSource));
|
||||
default:
|
||||
return MinecraftForge.EVENT_BUS.post(new DrawSelectionEvent(context, info, target, partialTicks, matrix, buffers));
|
||||
return MinecraftForge.EVENT_BUS.post(new DrawSelectionEvent(context, camera, target, partialTick, poseStack, bufferSource));
|
||||
}
|
||||
}
|
||||
|
||||
public static void dispatchRenderLast(LevelRenderer context, PoseStack mat, float partialTicks, Matrix4f projectionMatrix, long finishTimeNano)
|
||||
public static void dispatchRenderLast(LevelRenderer context, PoseStack poseStack, float partialTick, Matrix4f projectionMatrix, long finishTimeNano)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new RenderLevelLastEvent(context, mat, partialTicks, projectionMatrix, finishTimeNano));
|
||||
MinecraftForge.EVENT_BUS.post(new RenderLevelLastEvent(context, poseStack, partialTick, projectionMatrix, finishTimeNano));
|
||||
}
|
||||
|
||||
public static boolean renderSpecificFirstPersonHand(InteractionHand hand, PoseStack mat, MultiBufferSource buffers, int light, float partialTicks, float interpPitch, float swingProgress, float equipProgress, ItemStack stack)
|
||||
public static boolean renderSpecificFirstPersonHand(InteractionHand hand, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, float partialTick, float interpPitch, float swingProgress, float equipProgress, ItemStack stack)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new RenderHandEvent(hand, mat, buffers, light, partialTicks, interpPitch, swingProgress, equipProgress, stack));
|
||||
return MinecraftForge.EVENT_BUS.post(new RenderHandEvent(hand, poseStack, bufferSource, packedLight, partialTick, interpPitch, swingProgress, equipProgress, stack));
|
||||
}
|
||||
|
||||
public static boolean renderSpecificFirstPersonArm(PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight, AbstractClientPlayer player, HumanoidArm arm)
|
||||
@@ -314,8 +314,8 @@ public class ForgeHooksClient
|
||||
return fovModifierEvent.getNewfov();
|
||||
}
|
||||
|
||||
public static double getFieldOfView(GameRenderer renderer, Camera info, double renderPartialTicks, double fov) {
|
||||
EntityViewRenderEvent.FieldOfView event = new EntityViewRenderEvent.FieldOfView(renderer, info, renderPartialTicks, fov);
|
||||
public static double getFieldOfView(GameRenderer renderer, Camera camera, double partialTick, double fov) {
|
||||
EntityViewRenderEvent.FieldOfView event = new EntityViewRenderEvent.FieldOfView(renderer, camera, partialTick, fov);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event.getFOV();
|
||||
}
|
||||
@@ -329,16 +329,16 @@ public class ForgeHooksClient
|
||||
//RenderingRegistry.registerBlockHandler(RenderBlockFluid.instance);
|
||||
}
|
||||
|
||||
public static void renderMainMenu(TitleScreen gui, PoseStack mStack, Font font, int width, int height, int alpha)
|
||||
public static void renderMainMenu(TitleScreen gui, PoseStack poseStack, Font font, int width, int height, int alpha)
|
||||
{
|
||||
VersionChecker.Status status = ForgeVersion.getStatus();
|
||||
if (status == BETA || status == BETA_OUTDATED)
|
||||
{
|
||||
// render a warning at the top of the screen,
|
||||
Component line = new TranslatableComponent("forge.update.beta.1", ChatFormatting.RED, ChatFormatting.RESET).withStyle(ChatFormatting.RED);
|
||||
GuiComponent.drawCenteredString(mStack, font, line, width / 2, 4 + (0 * (font.lineHeight + 1)), 0xFFFFFF | alpha);
|
||||
GuiComponent.drawCenteredString(poseStack, font, line, width / 2, 4 + (0 * (font.lineHeight + 1)), 0xFFFFFF | alpha);
|
||||
line = new TranslatableComponent("forge.update.beta.2");
|
||||
GuiComponent.drawCenteredString(mStack, font, line, width / 2, 4 + (1 * (font.lineHeight + 1)), 0xFFFFFF | alpha);
|
||||
GuiComponent.drawCenteredString(poseStack, font, line, width / 2, 4 + (1 * (font.lineHeight + 1)), 0xFFFFFF | alpha);
|
||||
}
|
||||
|
||||
String line = null;
|
||||
@@ -363,40 +363,40 @@ public class ForgeHooksClient
|
||||
return e.getSound();
|
||||
}
|
||||
|
||||
public static void drawScreen(Screen screen, PoseStack mStack, int mouseX, int mouseY, float partialTicks)
|
||||
public static void drawScreen(Screen screen, PoseStack poseStack, int mouseX, int mouseY, float partialTick)
|
||||
{
|
||||
mStack.pushPose();
|
||||
poseStack.pushPose();
|
||||
guiLayers.forEach(layer -> {
|
||||
// Prevent the background layers from thinking the mouse is over their controls and showing them as highlighted.
|
||||
drawScreenInternal(layer, mStack, Integer.MAX_VALUE, Integer.MAX_VALUE, partialTicks);
|
||||
mStack.translate(0,0,2000);
|
||||
drawScreenInternal(layer, poseStack, Integer.MAX_VALUE, Integer.MAX_VALUE, partialTick);
|
||||
poseStack.translate(0,0,2000);
|
||||
});
|
||||
drawScreenInternal(screen, mStack, mouseX, mouseY, partialTicks);
|
||||
mStack.popPose();
|
||||
drawScreenInternal(screen, poseStack, mouseX, mouseY, partialTick);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
private static void drawScreenInternal(Screen screen, PoseStack mStack, int mouseX, int mouseY, float partialTicks)
|
||||
private static void drawScreenInternal(Screen screen, PoseStack poseStack, int mouseX, int mouseY, float partialTick)
|
||||
{
|
||||
if (!MinecraftForge.EVENT_BUS.post(new ScreenEvent.DrawScreenEvent.Pre(screen, mStack, mouseX, mouseY, partialTicks)))
|
||||
screen.render(mStack, mouseX, mouseY, partialTicks);
|
||||
MinecraftForge.EVENT_BUS.post(new ScreenEvent.DrawScreenEvent.Post(screen, mStack, mouseX, mouseY, partialTicks));
|
||||
if (!MinecraftForge.EVENT_BUS.post(new ScreenEvent.DrawScreenEvent.Pre(screen, poseStack, mouseX, mouseY, partialTick)))
|
||||
screen.render(poseStack, mouseX, mouseY, partialTick);
|
||||
MinecraftForge.EVENT_BUS.post(new ScreenEvent.DrawScreenEvent.Post(screen, poseStack, mouseX, mouseY, partialTick));
|
||||
}
|
||||
|
||||
public static float getFogDensity(FogMode type, Camera info, float partial, float density)
|
||||
public static float getFogDensity(FogMode type, Camera camera, float partialTick, float density)
|
||||
{
|
||||
EntityViewRenderEvent.FogDensity event = new EntityViewRenderEvent.FogDensity(type, info, partial, density);
|
||||
EntityViewRenderEvent.FogDensity event = new EntityViewRenderEvent.FogDensity(type, camera, partialTick, density);
|
||||
if (MinecraftForge.EVENT_BUS.post(event)) return event.getDensity();
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static void onFogRender(FogMode type, Camera info, float partial, float distance)
|
||||
public static void onFogRender(FogMode type, Camera camera, float partialTick, float distance)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new EntityViewRenderEvent.RenderFogEvent(type, info, partial, distance));
|
||||
MinecraftForge.EVENT_BUS.post(new EntityViewRenderEvent.RenderFogEvent(type, camera, partialTick, distance));
|
||||
}
|
||||
|
||||
public static EntityViewRenderEvent.CameraSetup onCameraSetup(GameRenderer renderer, Camera info, float partial)
|
||||
public static EntityViewRenderEvent.CameraSetup onCameraSetup(GameRenderer renderer, Camera camera, float partial)
|
||||
{
|
||||
EntityViewRenderEvent.CameraSetup event = new EntityViewRenderEvent.CameraSetup(renderer, info, partial, info.getYRot(), info.getXRot(), 0);
|
||||
EntityViewRenderEvent.CameraSetup event = new EntityViewRenderEvent.CameraSetup(renderer, camera, partial, camera.getYRot(), camera.getXRot(), 0);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event;
|
||||
}
|
||||
@@ -414,7 +414,7 @@ public class ForgeHooksClient
|
||||
flipXNormal = new Matrix3f(flipX);
|
||||
}
|
||||
|
||||
public static BakedModel handleCameraTransforms(PoseStack matrixStack, BakedModel model, ItemTransforms.TransformType cameraTransformType, boolean leftHandHackery)
|
||||
public static BakedModel handleCameraTransforms(PoseStack poseStack, BakedModel model, ItemTransforms.TransformType cameraTransformType, boolean leftHandHackery)
|
||||
{
|
||||
PoseStack stack = new PoseStack();
|
||||
model = model.handlePerspective(cameraTransformType, stack);
|
||||
@@ -432,19 +432,19 @@ public class ForgeHooksClient
|
||||
nMat.multiplyBackward(flipXNormal);
|
||||
nMat.mul(flipXNormal);
|
||||
}
|
||||
matrixStack.last().pose().multiply(tMat);
|
||||
matrixStack.last().normal().mul(nMat);
|
||||
poseStack.last().pose().multiply(tMat);
|
||||
poseStack.last().normal().mul(nMat);
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static TextureAtlasSprite[] getFluidSprites(BlockAndTintGetter world, BlockPos pos, FluidState fluidStateIn)
|
||||
public static TextureAtlasSprite[] getFluidSprites(BlockAndTintGetter level, BlockPos pos, FluidState fluidStateIn)
|
||||
{
|
||||
ResourceLocation overlayTexture = fluidStateIn.getType().getAttributes().getOverlayTexture();
|
||||
return new TextureAtlasSprite[] {
|
||||
Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(fluidStateIn.getType().getAttributes().getStillTexture(world, pos)),
|
||||
Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(fluidStateIn.getType().getAttributes().getFlowingTexture(world, pos)),
|
||||
Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(fluidStateIn.getType().getAttributes().getStillTexture(level, pos)),
|
||||
Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(fluidStateIn.getType().getAttributes().getFlowingTexture(level, pos)),
|
||||
overlayTexture == null ? null : Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(overlayTexture),
|
||||
};
|
||||
}
|
||||
@@ -538,17 +538,17 @@ public class ForgeHooksClient
|
||||
return from.getItem().shouldCauseReequipAnimation(from, to, changed);
|
||||
}
|
||||
|
||||
public static RenderGameOverlayEvent.BossInfo renderBossEventPre(PoseStack mStack, Window res, LerpingBossEvent bossInfo, int x, int y, int increment)
|
||||
public static RenderGameOverlayEvent.BossInfo renderBossEventPre(PoseStack poseStack, Window res, LerpingBossEvent bossInfo, int x, int y, int increment)
|
||||
{
|
||||
RenderGameOverlayEvent.BossInfo evt = new RenderGameOverlayEvent.BossInfo(mStack, new RenderGameOverlayEvent(mStack, MinecraftForgeClient.getPartialTick(), res),
|
||||
RenderGameOverlayEvent.BossInfo evt = new RenderGameOverlayEvent.BossInfo(poseStack, new RenderGameOverlayEvent(poseStack, MinecraftForgeClient.getPartialTick(), res),
|
||||
BOSSINFO, bossInfo, x, y, increment);
|
||||
MinecraftForge.EVENT_BUS.post(evt);
|
||||
return evt;
|
||||
}
|
||||
|
||||
public static void renderBossEventPost(PoseStack mStack, Window res)
|
||||
public static void renderBossEventPost(PoseStack poseStack, Window res)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(mStack, new RenderGameOverlayEvent(mStack, MinecraftForgeClient.getPartialTick(), res), BOSSINFO));
|
||||
MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(poseStack, new RenderGameOverlayEvent(poseStack, MinecraftForgeClient.getPartialTick(), res), BOSSINFO));
|
||||
}
|
||||
|
||||
public static ScreenshotEvent onScreenshot(NativeImage image, File screenshotFile)
|
||||
@@ -708,8 +708,8 @@ public class ForgeHooksClient
|
||||
return event;
|
||||
}
|
||||
|
||||
public static void drawItemLayered(ItemRenderer renderer, BakedModel modelIn, ItemStack itemStackIn, PoseStack matrixStackIn,
|
||||
MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn, boolean fabulous)
|
||||
public static void drawItemLayered(ItemRenderer renderer, BakedModel modelIn, ItemStack itemStackIn, PoseStack poseStack,
|
||||
MultiBufferSource bufferSource, int packedLight, int packedOverlay, boolean fabulous)
|
||||
{
|
||||
for(com.mojang.datafixers.util.Pair<BakedModel,RenderType> layerModel : modelIn.getLayerModels(itemStackIn, fabulous))
|
||||
{
|
||||
@@ -719,11 +719,11 @@ public class ForgeHooksClient
|
||||
VertexConsumer ivertexbuilder;
|
||||
if (fabulous)
|
||||
{
|
||||
ivertexbuilder = ItemRenderer.getFoilBufferDirect(bufferIn, rendertype, true, itemStackIn.hasFoil());
|
||||
ivertexbuilder = ItemRenderer.getFoilBufferDirect(bufferSource, rendertype, true, itemStackIn.hasFoil());
|
||||
} else {
|
||||
ivertexbuilder = ItemRenderer.getFoilBuffer(bufferIn, rendertype, true, itemStackIn.hasFoil());
|
||||
ivertexbuilder = ItemRenderer.getFoilBuffer(bufferSource, rendertype, true, itemStackIn.hasFoil());
|
||||
}
|
||||
renderer.renderModelLists(layer, itemStackIn, combinedLightIn, combinedOverlayIn, matrixStackIn, ivertexbuilder);
|
||||
renderer.renderModelLists(layer, itemStackIn, packedLight, packedOverlay, poseStack, ivertexbuilder);
|
||||
}
|
||||
net.minecraftforge.client.ForgeHooksClient.setRenderType(null);
|
||||
}
|
||||
@@ -738,14 +738,14 @@ public class ForgeHooksClient
|
||||
return !(squareDistance > 4096.0f);
|
||||
}
|
||||
|
||||
public static void renderPistonMovedBlocks(BlockPos pos, BlockState state, PoseStack stack, MultiBufferSource buffer, Level world, boolean checkSides, int combinedOverlay, BlockRenderDispatcher blockRenderer) {
|
||||
public static void renderPistonMovedBlocks(BlockPos pos, BlockState state, PoseStack stack, MultiBufferSource bufferSource, Level level, boolean checkSides, int packedOverlay, BlockRenderDispatcher blockRenderer) {
|
||||
RenderType.chunkBufferLayers().stream()
|
||||
.filter(t -> ItemBlockRenderTypes.canRenderInLayer(state, t))
|
||||
.forEach(rendertype ->
|
||||
{
|
||||
setRenderType(rendertype);
|
||||
VertexConsumer ivertexbuilder = buffer.getBuffer(rendertype == RenderType.translucent() ? RenderType.translucentMovingBlock() : rendertype);
|
||||
blockRenderer.getModelRenderer().tesselateBlock(world, blockRenderer.getBlockModel(state), state, pos, stack, ivertexbuilder, checkSides, new Random(), state.getSeed(pos), combinedOverlay);
|
||||
VertexConsumer ivertexbuilder = bufferSource.getBuffer(rendertype == RenderType.translucent() ? RenderType.translucentMovingBlock() : rendertype);
|
||||
blockRenderer.getModelRenderer().tesselateBlock(level, blockRenderer.getBlockModel(state), state, pos, stack, ivertexbuilder, checkSides, new Random(), state.getSeed(pos), packedOverlay);
|
||||
});
|
||||
setRenderType(null);
|
||||
}
|
||||
@@ -865,7 +865,7 @@ public class ForgeHooksClient
|
||||
}
|
||||
|
||||
private static final ResourceLocation ICON_SHEET = new ResourceLocation(ForgeVersion.MOD_ID, "textures/gui/icons.png");
|
||||
public static void drawForgePingInfo(JoinMultiplayerScreen gui, ServerData target, PoseStack mStack, int x, int y, int width, int relativeMouseX, int relativeMouseY) {
|
||||
public static void drawForgePingInfo(JoinMultiplayerScreen gui, ServerData target, PoseStack poseStack, int x, int y, int width, int relativeMouseX, int relativeMouseY) {
|
||||
int idx;
|
||||
String tooltip;
|
||||
if (target.forgeData == null)
|
||||
@@ -904,7 +904,7 @@ public class ForgeHooksClient
|
||||
}
|
||||
|
||||
RenderSystem.setShaderTexture(0, ICON_SHEET);
|
||||
GuiComponent.blit(mStack, x + width - 18, y + 10, 16, 16, 0, idx, 16, 16, 256, 256);
|
||||
GuiComponent.blit(poseStack, x + width - 18, y + 10, 16, 16, 0, idx, 16, 16, 256, 256);
|
||||
|
||||
if(relativeMouseX > width - 15 && relativeMouseX < width && relativeMouseY > 10 && relativeMouseY < 26) {
|
||||
//this is not the most proper way to do it,
|
||||
@@ -918,7 +918,7 @@ public class ForgeHooksClient
|
||||
return Minecraft.getInstance().getConnection()!=null ? Minecraft.getInstance().getConnection().getConnection() : null;
|
||||
}
|
||||
|
||||
public static void handleClientLevelClosing(ClientLevel world)
|
||||
public static void handleClientLevelClosing(ClientLevel level)
|
||||
{
|
||||
Connection client = getClientConnection();
|
||||
// ONLY revert a non-local connection
|
||||
|
||||
@@ -25,18 +25,18 @@ public interface IBlockRenderProperties
|
||||
};
|
||||
|
||||
/**
|
||||
* Spawn a digging particle effect in the Level, this is a wrapper
|
||||
* Spawn a digging particle effect in the level, 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 Level.
|
||||
* texture sheets for different sides/locations in the level.
|
||||
*
|
||||
* @param state The current state
|
||||
* @param Level The current Level
|
||||
* @param level The current level
|
||||
* @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.
|
||||
*/
|
||||
default boolean addHitEffects(BlockState state, Level Level, HitResult target, ParticleEngine manager)
|
||||
default boolean addHitEffects(BlockState state, Level level, HitResult target, ParticleEngine manager)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -63,14 +63,14 @@ public interface IBlockRenderProperties
|
||||
* Use this to change the fog color used when the entity is "inside" a material.
|
||||
* Vec3d is used here as "r/g/b" 0 - 1 values.
|
||||
*
|
||||
* @param Level The Level.
|
||||
* @param level The level.
|
||||
* @param pos The position at the entity viewport.
|
||||
* @param state The state at the entity viewport.
|
||||
* @param entity the entity
|
||||
* @param originalColor The current fog color, You are not expected to use this, Return as the default if applicable.
|
||||
* @return The new fog color.
|
||||
*/
|
||||
default Vector3d getFogColor(BlockState state, LevelReader Level, BlockPos pos, Entity entity, Vector3d originalColor, float partialTicks)
|
||||
default Vector3d getFogColor(BlockState state, LevelReader level, BlockPos pos, Entity entity, Vector3d originalColor, float partialTick)
|
||||
{
|
||||
if (state.getMaterial() == Material.WATER)
|
||||
{
|
||||
|
||||
@@ -16,5 +16,5 @@ import net.minecraft.client.multiplayer.ClientLevel;
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ICloudRenderHandler {
|
||||
void render(int ticks, float partialTicks, PoseStack matrixStack, ClientLevel world, Minecraft mc, double viewEntityX, double viewEntityY, double viewEntityZ);
|
||||
void render(int ticks, float partialTick, PoseStack poseStack, ClientLevel level, Minecraft minecraft, double camX, double camY, double camZ);
|
||||
}
|
||||
@@ -85,9 +85,9 @@ public interface IItemRenderProperties
|
||||
* @param player Reference to the current client entity
|
||||
* @param width Viewport width
|
||||
* @param height Viewport height
|
||||
* @param partialTicks Partial ticks for the renderer, useful for interpolation
|
||||
* @param partialTick Partial tick for the renderer, useful for interpolation
|
||||
*/
|
||||
default void renderHelmetOverlay(ItemStack stack, Player player, int width, int height, float partialTicks)
|
||||
default void renderHelmetOverlay(ItemStack stack, Player player, int width, int height, float partialTick)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -16,5 +16,5 @@ import net.minecraft.client.multiplayer.ClientLevel;
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ISkyRenderHandler {
|
||||
void render(int ticks, float partialTicks, PoseStack matrixStack, ClientLevel world, Minecraft mc);
|
||||
void render(int ticks, float partialTick, PoseStack poseStack, ClientLevel level, Minecraft minecraft);
|
||||
}
|
||||
@@ -17,5 +17,5 @@ import net.minecraft.client.multiplayer.ClientLevel;
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface IWeatherParticleRenderHandler {
|
||||
void render(int ticks, ClientLevel world, Minecraft mc, Camera activeRenderInfoIn);
|
||||
void render(int ticks, ClientLevel level, Minecraft minecraft, Camera camera);
|
||||
}
|
||||
@@ -16,5 +16,5 @@ import net.minecraft.client.multiplayer.ClientLevel;
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface IWeatherRenderHandler {
|
||||
void render(int ticks, float partialTicks, ClientLevel world, Minecraft mc, LightTexture lightmapIn, double xIn, double yIn, double zIn);
|
||||
void render(int ticks, float partialTick, ClientLevel level, Minecraft minecraft, LightTexture lightTexture, double camX, double camY, double camZ);
|
||||
}
|
||||
@@ -43,14 +43,14 @@ public class ContainerScreenEvent extends Event
|
||||
* Called directly after the GuiContainer has drawn any foreground elements.
|
||||
*
|
||||
* @param guiContainer The container.
|
||||
* @param mStack The MatrixStack.
|
||||
* @param poseStack The pose stack.
|
||||
* @param mouseX The current X position of the players mouse.
|
||||
* @param mouseY The current Y position of the players mouse.
|
||||
*/
|
||||
public DrawForeground(AbstractContainerScreen<?> guiContainer, PoseStack mStack, int mouseX, int mouseY)
|
||||
public DrawForeground(AbstractContainerScreen<?> guiContainer, PoseStack poseStack, int mouseX, int mouseY)
|
||||
{
|
||||
super(guiContainer);
|
||||
this.poseStack = mStack;
|
||||
this.poseStack = poseStack;
|
||||
this.mouseX = mouseX;
|
||||
this.mouseY = mouseY;
|
||||
}
|
||||
@@ -85,14 +85,14 @@ public class ContainerScreenEvent extends Event
|
||||
* Called directly after the GuiContainer has drawn any background elements.
|
||||
*
|
||||
* @param guiContainer The container.
|
||||
* @param mStack The MatrixStack.
|
||||
* @param poseStack The PoseStack.
|
||||
* @param mouseX The current X position of the players mouse.
|
||||
* @param mouseY The current Y position of the players mouse.
|
||||
*/
|
||||
public DrawBackground(AbstractContainerScreen<?> guiContainer, PoseStack mStack, int mouseX, int mouseY)
|
||||
public DrawBackground(AbstractContainerScreen<?> guiContainer, PoseStack poseStack, int mouseX, int mouseY)
|
||||
{
|
||||
super(guiContainer);
|
||||
this.poseStack = mStack;
|
||||
this.poseStack = poseStack;
|
||||
this.mouseX = mouseX;
|
||||
this.mouseY = mouseY;
|
||||
}
|
||||
|
||||
@@ -52,9 +52,9 @@ public class DrawSelectionEvent extends Event
|
||||
@Cancelable
|
||||
public static class HighlightBlock extends DrawSelectionEvent
|
||||
{
|
||||
public HighlightBlock(LevelRenderer context, Camera info, HitResult target, float partialTicks, PoseStack matrix, MultiBufferSource buffers)
|
||||
public HighlightBlock(LevelRenderer levelRenderer, Camera camera, HitResult target, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource)
|
||||
{
|
||||
super(context, info, target, partialTicks, matrix, buffers);
|
||||
super(levelRenderer, camera, target, partialTick, poseStack, bufferSource);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -71,9 +71,9 @@ public class DrawSelectionEvent extends Event
|
||||
@Cancelable
|
||||
public static class HighlightEntity extends DrawSelectionEvent
|
||||
{
|
||||
public HighlightEntity(LevelRenderer context, Camera info, HitResult target, float partialTicks, PoseStack matrix, MultiBufferSource buffers)
|
||||
public HighlightEntity(LevelRenderer levelRenderer, Camera camera, HitResult target, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource)
|
||||
{
|
||||
super(context, info, target, partialTicks, matrix, buffers);
|
||||
super(levelRenderer, camera, target, partialTick, poseStack, bufferSource);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,9 +47,9 @@ public abstract class EntityViewRenderEvent extends net.minecraftforge.eventbus.
|
||||
{
|
||||
private final FogMode mode;
|
||||
@SuppressWarnings("resource")
|
||||
protected FogEvent(FogMode mode, Camera info, double renderPartialTicks)
|
||||
protected FogEvent(FogMode mode, Camera camera, double partialTick)
|
||||
{
|
||||
super(Minecraft.getInstance().gameRenderer, info, renderPartialTicks);
|
||||
super(Minecraft.getInstance().gameRenderer, camera, partialTick);
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
@@ -65,9 +65,9 @@ public abstract class EntityViewRenderEvent extends net.minecraftforge.eventbus.
|
||||
{
|
||||
private float density;
|
||||
|
||||
public FogDensity(FogMode type, Camera info, float partialTicks, float density)
|
||||
public FogDensity(FogMode type, Camera camera, float partialTick, float density)
|
||||
{
|
||||
super(type, info, partialTicks);
|
||||
super(type, camera, partialTick);
|
||||
this.setDensity(density);
|
||||
}
|
||||
|
||||
@@ -90,9 +90,9 @@ public abstract class EntityViewRenderEvent extends net.minecraftforge.eventbus.
|
||||
{
|
||||
private final float farPlaneDistance;
|
||||
|
||||
public RenderFogEvent(FogMode type, Camera info, float partialTicks, float distance)
|
||||
public RenderFogEvent(FogMode type, Camera camera, float partialTicks, float distance)
|
||||
{
|
||||
super(type, info, partialTicks);
|
||||
super(type, camera, partialTicks);
|
||||
this.farPlaneDistance = distance;
|
||||
}
|
||||
|
||||
@@ -113,9 +113,9 @@ public abstract class EntityViewRenderEvent extends net.minecraftforge.eventbus.
|
||||
private float blue;
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
public FogColors(Camera info, float partialTicks, float red, float green, float blue)
|
||||
public FogColors(Camera camera, float partialTicks, float red, float green, float blue)
|
||||
{
|
||||
super(Minecraft.getInstance().gameRenderer, info, partialTicks);
|
||||
super(Minecraft.getInstance().gameRenderer, camera, partialTicks);
|
||||
this.setRed(red);
|
||||
this.setGreen(green);
|
||||
this.setBlue(blue);
|
||||
@@ -138,9 +138,9 @@ public abstract class EntityViewRenderEvent extends net.minecraftforge.eventbus.
|
||||
private float pitch;
|
||||
private float roll;
|
||||
|
||||
public CameraSetup(GameRenderer renderer, Camera info, double renderPartialTicks, float yaw, float pitch, float roll)
|
||||
public CameraSetup(GameRenderer renderer, Camera camera, double renderPartialTicks, float yaw, float pitch, float roll)
|
||||
{
|
||||
super(renderer, info, renderPartialTicks);
|
||||
super(renderer, camera, renderPartialTicks);
|
||||
this.setYaw(yaw);
|
||||
this.setPitch(pitch);
|
||||
this.setRoll(roll);
|
||||
@@ -162,8 +162,8 @@ public abstract class EntityViewRenderEvent extends net.minecraftforge.eventbus.
|
||||
{
|
||||
private double fov;
|
||||
|
||||
public FieldOfView(GameRenderer renderer, Camera info, double renderPartialTicks, double fov) {
|
||||
super(renderer, info, renderPartialTicks);
|
||||
public FieldOfView(GameRenderer renderer, Camera camera, double renderPartialTicks, double fov) {
|
||||
super(renderer, camera, renderPartialTicks);
|
||||
this.setFOV(fov);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,15 +44,15 @@ public abstract class RenderLivingEvent<T extends LivingEntity, M extends Entity
|
||||
@Cancelable
|
||||
public static class Pre<T extends LivingEntity, M extends EntityModel<T>> extends RenderLivingEvent<T, M>
|
||||
{
|
||||
public Pre(LivingEntity entity, LivingEntityRenderer<T, M> renderer, float partialRenderTick, PoseStack matrixStack, MultiBufferSource buffers, int light) {
|
||||
super(entity, renderer, partialRenderTick, matrixStack, buffers, light);
|
||||
public Pre(LivingEntity entity, LivingEntityRenderer<T, M> renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
super(entity, renderer, partialTick, poseStack, multiBufferSource, packedLight);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Post<T extends LivingEntity, M extends EntityModel<T>> extends RenderLivingEvent<T, M>
|
||||
{
|
||||
public Post(LivingEntity entity, LivingEntityRenderer<T, M> renderer, float partialRenderTick, PoseStack matrixStack, MultiBufferSource buffers, int light) {
|
||||
super(entity, renderer, partialRenderTick, matrixStack, buffers, light);
|
||||
public Post(LivingEntity entity, LivingEntityRenderer<T, M> renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
super(entity, renderer, partialTick, poseStack, multiBufferSource, packedLight);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,15 +39,15 @@ public abstract class RenderPlayerEvent extends PlayerEvent
|
||||
@Cancelable
|
||||
public static class Pre extends RenderPlayerEvent
|
||||
{
|
||||
public Pre(Player player, PlayerRenderer renderer, float tick, PoseStack stack, MultiBufferSource buffers, int light) {
|
||||
super(player, renderer, tick, stack, buffers, light);
|
||||
public Pre(Player player, PlayerRenderer renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
super(player, renderer, partialTick, poseStack, multiBufferSource, packedLight);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Post extends RenderPlayerEvent
|
||||
{
|
||||
public Post(Player player, PlayerRenderer renderer, float tick, PoseStack stack, MultiBufferSource buffers, int light) {
|
||||
super(player, renderer, tick, stack, buffers, light);
|
||||
public Post(Player player, PlayerRenderer renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
super(player, renderer, partialTick, poseStack, multiBufferSource, packedLight);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ public class ScreenEvent extends Event
|
||||
}
|
||||
|
||||
/**
|
||||
* The MatrixStack to render with.
|
||||
* The PoseStack to render with.
|
||||
*/
|
||||
public PoseStack getPoseStack()
|
||||
{
|
||||
@@ -164,9 +164,9 @@ public class ScreenEvent extends Event
|
||||
@Cancelable
|
||||
public static class Pre extends DrawScreenEvent
|
||||
{
|
||||
public Pre(Screen screen, PoseStack mStack, int mouseX, int mouseY, float renderPartialTicks)
|
||||
public Pre(Screen screen, PoseStack poseStack, int mouseX, int mouseY, float partialTick)
|
||||
{
|
||||
super(screen, mStack, mouseX, mouseY, renderPartialTicks);
|
||||
super(screen, poseStack, mouseX, mouseY, partialTick);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,9 +175,9 @@ public class ScreenEvent extends Event
|
||||
*/
|
||||
public static class Post extends DrawScreenEvent
|
||||
{
|
||||
public Post(Screen screen, PoseStack mStack, int mouseX, int mouseY, float renderPartialTicks)
|
||||
public Post(Screen screen, PoseStack poseStack, int mouseX, int mouseY, float partialTick)
|
||||
{
|
||||
super(screen, mStack, mouseX, mouseY, renderPartialTicks);
|
||||
super(screen, poseStack, mouseX, mouseY, partialTick);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -197,7 +197,7 @@ public class ScreenEvent extends Event
|
||||
}
|
||||
|
||||
/**
|
||||
* The MatrixStack to render with.
|
||||
* The PoseStack to render with.
|
||||
*/
|
||||
public PoseStack getPoseStack()
|
||||
{
|
||||
|
||||
@@ -57,9 +57,9 @@ public interface IForgeBakedModel
|
||||
return net.minecraftforge.client.ForgeHooksClient.handlePerspective(self(), cameraTransformType, poseStack);
|
||||
}
|
||||
|
||||
default @Nonnull IModelData getModelData(@Nonnull BlockAndTintGetter world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData)
|
||||
default @Nonnull IModelData getModelData(@Nonnull BlockAndTintGetter level, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData modelData)
|
||||
{
|
||||
return tileData;
|
||||
return modelData;
|
||||
}
|
||||
|
||||
default TextureAtlasSprite getParticleIcon(@Nonnull IModelData data)
|
||||
|
||||
@@ -27,27 +27,27 @@ import net.minecraft.core.Vec3i;
|
||||
public interface IForgeVertexConsumer
|
||||
{
|
||||
// Copy of putBulkData, but enables tinting and per-vertex alpha
|
||||
default void putBulkData(PoseStack.Pose matrixStack, BakedQuad bakedQuad, float red, float green, float blue, int lightmapCoord, int overlayColor, boolean readExistingColor) {
|
||||
putBulkData(matrixStack, bakedQuad, red, green, blue, 1.0f, lightmapCoord, overlayColor, readExistingColor);
|
||||
default void putBulkData(PoseStack.Pose poseStack, BakedQuad bakedQuad, float red, float green, float blue, int packedLight, int packedOverlay, boolean readExistingColor) {
|
||||
putBulkData(poseStack, bakedQuad, red, green, blue, 1.0f, packedLight, packedOverlay, readExistingColor);
|
||||
}
|
||||
|
||||
// Copy of putBulkData with alpha support
|
||||
default void putBulkData(PoseStack.Pose matrixEntry, BakedQuad bakedQuad, float red, float green, float blue, float alpha, int lightmapCoord, int overlayColor) {
|
||||
putBulkData(matrixEntry, bakedQuad, new float[]{1.0F, 1.0F, 1.0F, 1.0F}, red, green, blue, alpha, new int[]{lightmapCoord, lightmapCoord, lightmapCoord, lightmapCoord}, overlayColor, false);
|
||||
default void putBulkData(PoseStack.Pose pose, BakedQuad bakedQuad, float red, float green, float blue, float alpha, int packedLight, int packedOverlay) {
|
||||
putBulkData(pose, bakedQuad, new float[]{1.0F, 1.0F, 1.0F, 1.0F}, red, green, blue, alpha, new int[]{packedLight, packedLight, packedLight, packedLight}, packedOverlay, false);
|
||||
}
|
||||
|
||||
// Copy of putBulkData with alpha support
|
||||
default void putBulkData(PoseStack.Pose matrixEntry, BakedQuad bakedQuad, float red, float green, float blue, float alpha, int lightmapCoord, int overlayColor, boolean readExistingColor) {
|
||||
putBulkData(matrixEntry, bakedQuad, new float[]{1.0F, 1.0F, 1.0F, 1.0F}, red, green, blue, alpha, new int[]{lightmapCoord, lightmapCoord, lightmapCoord, lightmapCoord}, overlayColor, readExistingColor);
|
||||
default void putBulkData(PoseStack.Pose pose, BakedQuad bakedQuad, float red, float green, float blue, float alpha, int packedLight, int packedOverlay, boolean readExistingColor) {
|
||||
putBulkData(pose, bakedQuad, new float[]{1.0F, 1.0F, 1.0F, 1.0F}, red, green, blue, alpha, new int[]{packedLight, packedLight, packedLight, packedLight}, packedOverlay, readExistingColor);
|
||||
}
|
||||
|
||||
// Copy of putBulkData with alpha support
|
||||
default void putBulkData(PoseStack.Pose matrixEntry, BakedQuad bakedQuad, float[] baseBrightness, float red, float green, float blue, float alpha, int[] lightmapCoords, int overlayCoords, boolean readExistingColor) {
|
||||
default void putBulkData(PoseStack.Pose pose, BakedQuad bakedQuad, float[] baseBrightness, float red, float green, float blue, float alpha, int[] lightmap, int packedOverlay, boolean readExistingColor) {
|
||||
int[] aint = bakedQuad.getVertices();
|
||||
Vec3i faceNormal = bakedQuad.getDirection().getNormal();
|
||||
Vector3f normal = new Vector3f((float)faceNormal.getX(), (float)faceNormal.getY(), (float)faceNormal.getZ());
|
||||
Matrix4f matrix4f = matrixEntry.pose();
|
||||
normal.transform(matrixEntry.normal());
|
||||
Matrix4f matrix4f = pose.pose();
|
||||
normal.transform(pose.normal());
|
||||
int intSize = DefaultVertexFormat.BLOCK.getIntegerSize();
|
||||
int vertexCount = aint.length / intSize;
|
||||
|
||||
@@ -81,20 +81,20 @@ public interface IForgeVertexConsumer
|
||||
ca = alpha;
|
||||
}
|
||||
|
||||
int lightmapCoord = applyBakedLighting(lightmapCoords[v], bytebuffer);
|
||||
int lightmapCoord = applyBakedLighting(lightmap[v], bytebuffer);
|
||||
float f9 = bytebuffer.getFloat(16);
|
||||
float f10 = bytebuffer.getFloat(20);
|
||||
Vector4f pos = new Vector4f(f, f1, f2, 1.0F);
|
||||
pos.transform(matrix4f);
|
||||
applyBakedNormals(normal, bytebuffer, matrixEntry.normal());
|
||||
((VertexConsumer)this).vertex(pos.x(), pos.y(), pos.z(), cr, cg, cb, ca, f9, f10, overlayCoords, lightmapCoord, normal.x(), normal.y(), normal.z());
|
||||
applyBakedNormals(normal, bytebuffer, pose.normal());
|
||||
((VertexConsumer)this).vertex(pos.x(), pos.y(), pos.z(), cr, cg, cb, ca, f9, f10, packedOverlay, lightmapCoord, normal.x(), normal.y(), normal.z());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
default int applyBakedLighting(int lightmapCoord, ByteBuffer data) {
|
||||
int bl = lightmapCoord&0xFFFF;
|
||||
int sl = (lightmapCoord>>16)&0xFFFF;
|
||||
default int applyBakedLighting(int packedLight, ByteBuffer data) {
|
||||
int bl = packedLight&0xFFFF;
|
||||
int sl = (packedLight>>16)&0xFFFF;
|
||||
int offset = LightUtil.getLightOffset(0) * 4; // int offset for vertex 0 * 4 bytes per int
|
||||
int blBaked = Short.toUnsignedInt(data.getShort(offset));
|
||||
int slBaked = Short.toUnsignedInt(data.getShort(offset + 2));
|
||||
|
||||
@@ -51,7 +51,6 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class ForgeIngameGui extends Gui
|
||||
{
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -111,7 +110,7 @@ public class ForgeIngameGui extends Gui
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
}
|
||||
|
||||
public static final IIngameOverlay VIGNETTE_ELEMENT = OverlayRegistry.registerOverlayTop("Vignette", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
public static final IIngameOverlay VIGNETTE_ELEMENT = OverlayRegistry.registerOverlayTop("Vignette", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
if (Minecraft.useFancyGraphics())
|
||||
{
|
||||
gui.setupOverlayRenderState(true, false);
|
||||
@@ -119,173 +118,173 @@ public class ForgeIngameGui extends Gui
|
||||
}
|
||||
});
|
||||
|
||||
public static final IIngameOverlay SPYGLASS_ELEMENT = OverlayRegistry.registerOverlayTop("Spyglass", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
public static final IIngameOverlay SPYGLASS_ELEMENT = OverlayRegistry.registerOverlayTop("Spyglass", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
gui.setupOverlayRenderState(true, false);
|
||||
gui.renderSpyglassOverlay();
|
||||
});
|
||||
|
||||
public static final IIngameOverlay HELMET_ELEMENT = OverlayRegistry.registerOverlayTop("Helmet", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
public static final IIngameOverlay HELMET_ELEMENT = OverlayRegistry.registerOverlayTop("Helmet", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
gui.setupOverlayRenderState(true, false);
|
||||
gui.renderHelmet(partialTicks, mStack);
|
||||
gui.renderHelmet(partialTick, poseStack);
|
||||
});
|
||||
|
||||
public static final IIngameOverlay FROSTBITE_ELEMENT = OverlayRegistry.registerOverlayTop("Frostbite", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
public static final IIngameOverlay FROSTBITE_ELEMENT = OverlayRegistry.registerOverlayTop("Frostbite", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
gui.setupOverlayRenderState(true, false);
|
||||
gui.renderFrostbite(mStack);
|
||||
gui.renderFrostbite(poseStack);
|
||||
});
|
||||
|
||||
public static final IIngameOverlay PORTAL_ELEMENT = OverlayRegistry.registerOverlayTop("Portal", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
public static final IIngameOverlay PORTAL_ELEMENT = OverlayRegistry.registerOverlayTop("Portal", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
|
||||
if (!gui.minecraft.player.hasEffect(MobEffects.CONFUSION))
|
||||
{
|
||||
gui.setupOverlayRenderState(true, false);
|
||||
gui.renderPortalOverlay(partialTicks);
|
||||
gui.renderPortalOverlay(partialTick);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
public static final IIngameOverlay HOTBAR_ELEMENT = OverlayRegistry.registerOverlayTop("Hotbar", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
public static final IIngameOverlay HOTBAR_ELEMENT = OverlayRegistry.registerOverlayTop("Hotbar", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
if (!gui.minecraft.options.hideGui)
|
||||
{
|
||||
gui.setupOverlayRenderState(true, false);
|
||||
if (gui.minecraft.gameMode.getPlayerMode() == GameType.SPECTATOR)
|
||||
{
|
||||
gui.spectatorGui.renderHotbar(mStack);
|
||||
gui.spectatorGui.renderHotbar(poseStack);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui.renderHotbar(partialTicks, mStack);
|
||||
gui.renderHotbar(partialTick, poseStack);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
public static final IIngameOverlay CROSSHAIR_ELEMENT = OverlayRegistry.registerOverlayTop("Crosshair", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
public static final IIngameOverlay CROSSHAIR_ELEMENT = OverlayRegistry.registerOverlayTop("Crosshair", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
if (!gui.minecraft.options.hideGui)
|
||||
{
|
||||
gui.setupOverlayRenderState(true, false);
|
||||
gui.setBlitOffset(-90);
|
||||
|
||||
gui.renderCrosshair(mStack);
|
||||
gui.renderCrosshair(poseStack);
|
||||
}
|
||||
});
|
||||
|
||||
public static final IIngameOverlay BOSS_HEALTH_ELEMENT = OverlayRegistry.registerOverlayTop("Boss Health", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
public static final IIngameOverlay BOSS_HEALTH_ELEMENT = OverlayRegistry.registerOverlayTop("Boss Health", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
if (!gui.minecraft.options.hideGui)
|
||||
{
|
||||
gui.setupOverlayRenderState(true, false);
|
||||
gui.setBlitOffset(-90);
|
||||
|
||||
gui.renderBossHealth(mStack);
|
||||
gui.renderBossHealth(poseStack);
|
||||
}
|
||||
});
|
||||
|
||||
public static final IIngameOverlay PLAYER_HEALTH_ELEMENT = OverlayRegistry.registerOverlayTop("Player Health", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
public static final IIngameOverlay PLAYER_HEALTH_ELEMENT = OverlayRegistry.registerOverlayTop("Player Health", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
if (!gui.minecraft.options.hideGui && gui.shouldDrawSurvivalElements())
|
||||
{
|
||||
gui.setupOverlayRenderState(true, false);
|
||||
gui.renderHealth(screenWidth, screenHeight, mStack);
|
||||
gui.renderHealth(screenWidth, screenHeight, poseStack);
|
||||
}
|
||||
});
|
||||
|
||||
public static final IIngameOverlay ARMOR_LEVEL_ELEMENT = OverlayRegistry.registerOverlayTop("Armor Level",(gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
public static final IIngameOverlay ARMOR_LEVEL_ELEMENT = OverlayRegistry.registerOverlayTop("Armor Level",(gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
if (!gui.minecraft.options.hideGui && gui.shouldDrawSurvivalElements())
|
||||
{
|
||||
gui.setupOverlayRenderState(true, false);
|
||||
gui.renderArmor(mStack, screenWidth, screenHeight);
|
||||
gui.renderArmor(poseStack, screenWidth, screenHeight);
|
||||
}
|
||||
});
|
||||
|
||||
public static final IIngameOverlay FOOD_LEVEL_ELEMENT = OverlayRegistry.registerOverlayTop("Food Level", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
public static final IIngameOverlay FOOD_LEVEL_ELEMENT = OverlayRegistry.registerOverlayTop("Food Level", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
boolean isMounted = gui.minecraft.player.getVehicle() instanceof LivingEntity;
|
||||
if (!isMounted && !gui.minecraft.options.hideGui && gui.shouldDrawSurvivalElements())
|
||||
{
|
||||
gui.setupOverlayRenderState(true, false);
|
||||
gui.renderFood(screenWidth, screenHeight, mStack);
|
||||
gui.renderFood(screenWidth, screenHeight, poseStack);
|
||||
}
|
||||
});
|
||||
|
||||
public static final IIngameOverlay MOUNT_HEALTH_ELEMENT = OverlayRegistry.registerOverlayTop("Mount Health", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
public static final IIngameOverlay MOUNT_HEALTH_ELEMENT = OverlayRegistry.registerOverlayTop("Mount Health", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
if (!gui.minecraft.options.hideGui && gui.shouldDrawSurvivalElements())
|
||||
{
|
||||
gui.setupOverlayRenderState(true, false);
|
||||
gui.renderHealthMount(screenWidth, screenHeight, mStack);
|
||||
gui.renderHealthMount(screenWidth, screenHeight, poseStack);
|
||||
}
|
||||
});
|
||||
|
||||
public static final IIngameOverlay AIR_LEVEL_ELEMENT = OverlayRegistry.registerOverlayTop("Air Level", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
public static final IIngameOverlay AIR_LEVEL_ELEMENT = OverlayRegistry.registerOverlayTop("Air Level", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
if (!gui.minecraft.options.hideGui && gui.shouldDrawSurvivalElements())
|
||||
{
|
||||
gui.setupOverlayRenderState(true, false);
|
||||
gui.renderAir(screenWidth, screenHeight, mStack);
|
||||
gui.renderAir(screenWidth, screenHeight, poseStack);
|
||||
}
|
||||
});
|
||||
|
||||
public static final IIngameOverlay JUMP_BAR_ELEMENT = OverlayRegistry.registerOverlayTop("Jump Bar", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
public static final IIngameOverlay JUMP_BAR_ELEMENT = OverlayRegistry.registerOverlayTop("Jump Bar", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
if (gui.minecraft.player.isRidingJumpable() && !gui.minecraft.options.hideGui)
|
||||
{
|
||||
gui.setupOverlayRenderState(true, false);
|
||||
gui.renderJumpMeter(mStack, screenWidth / 2 - 91);
|
||||
gui.renderJumpMeter(poseStack, screenWidth / 2 - 91);
|
||||
}
|
||||
});
|
||||
|
||||
public static final IIngameOverlay EXPERIENCE_BAR_ELEMENT = OverlayRegistry.registerOverlayTop("Experience Bar", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
public static final IIngameOverlay EXPERIENCE_BAR_ELEMENT = OverlayRegistry.registerOverlayTop("Experience Bar", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
if (!gui.minecraft.player.isRidingJumpable() && !gui.minecraft.options.hideGui)
|
||||
{
|
||||
gui.setupOverlayRenderState(true, false);
|
||||
gui.renderExperience(screenWidth / 2 - 91, mStack);
|
||||
gui.renderExperience(screenWidth / 2 - 91, poseStack);
|
||||
}
|
||||
});
|
||||
|
||||
public static final IIngameOverlay ITEM_NAME_ELEMENT = OverlayRegistry.registerOverlayTop("Item Name", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
public static final IIngameOverlay ITEM_NAME_ELEMENT = OverlayRegistry.registerOverlayTop("Item Name", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
if (!gui.minecraft.options.hideGui)
|
||||
{
|
||||
gui.setupOverlayRenderState(true, false);
|
||||
if (gui.minecraft.options.heldItemTooltips && gui.minecraft.gameMode.getPlayerMode() != GameType.SPECTATOR) {
|
||||
gui.renderSelectedItemName(mStack);
|
||||
gui.renderSelectedItemName(poseStack);
|
||||
} else if (gui.minecraft.player.isSpectator()) {
|
||||
gui.spectatorGui.renderTooltip(mStack);
|
||||
gui.spectatorGui.renderTooltip(poseStack);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
public static final IIngameOverlay SLEEP_FADE_ELEMENT = OverlayRegistry.registerOverlayTop("Sleep Fade", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
gui.renderSleepFade(screenWidth, screenHeight, mStack);
|
||||
public static final IIngameOverlay SLEEP_FADE_ELEMENT = OverlayRegistry.registerOverlayTop("Sleep Fade", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
gui.renderSleepFade(screenWidth, screenHeight, poseStack);
|
||||
});
|
||||
|
||||
public static final IIngameOverlay HUD_TEXT_ELEMENT = OverlayRegistry.registerOverlayTop("Text Columns", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
gui.renderHUDText(screenWidth, screenHeight, mStack);
|
||||
public static final IIngameOverlay HUD_TEXT_ELEMENT = OverlayRegistry.registerOverlayTop("Text Columns", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
gui.renderHUDText(screenWidth, screenHeight, poseStack);
|
||||
});
|
||||
|
||||
public static final IIngameOverlay FPS_GRAPH_ELEMENT = OverlayRegistry.registerOverlayTop("FPS Graph", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
gui.renderFPSGraph(mStack);
|
||||
public static final IIngameOverlay FPS_GRAPH_ELEMENT = OverlayRegistry.registerOverlayTop("FPS Graph", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
gui.renderFPSGraph(poseStack);
|
||||
});
|
||||
|
||||
public static final IIngameOverlay POTION_ICONS_ELEMENT = OverlayRegistry.registerOverlayTop("Potion Icons", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
gui.renderEffects(mStack);
|
||||
public static final IIngameOverlay POTION_ICONS_ELEMENT = OverlayRegistry.registerOverlayTop("Potion Icons", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
gui.renderEffects(poseStack);
|
||||
});
|
||||
|
||||
public static final IIngameOverlay RECORD_OVERLAY_ELEMENT = OverlayRegistry.registerOverlayTop("Record", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
public static final IIngameOverlay RECORD_OVERLAY_ELEMENT = OverlayRegistry.registerOverlayTop("Record", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
if (!gui.minecraft.options.hideGui)
|
||||
{
|
||||
gui.renderRecordOverlay(screenWidth, screenHeight, partialTicks, mStack);
|
||||
gui.renderRecordOverlay(screenWidth, screenHeight, partialTick, poseStack);
|
||||
}
|
||||
});
|
||||
|
||||
public static final IIngameOverlay SUBTITLES_ELEMENT = OverlayRegistry.registerOverlayTop("Subtitles", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
public static final IIngameOverlay SUBTITLES_ELEMENT = OverlayRegistry.registerOverlayTop("Subtitles", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
if (!gui.minecraft.options.hideGui)
|
||||
{
|
||||
gui.renderSubtitles(mStack);
|
||||
gui.renderSubtitles(poseStack);
|
||||
}
|
||||
});
|
||||
|
||||
public static final IIngameOverlay TITLE_TEXT_ELEMENT = OverlayRegistry.registerOverlayTop("Title Text", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
public static final IIngameOverlay TITLE_TEXT_ELEMENT = OverlayRegistry.registerOverlayTop("Title Text", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
if (!gui.minecraft.options.hideGui)
|
||||
{
|
||||
gui.renderTitle(screenWidth, screenHeight, partialTicks, mStack);
|
||||
gui.renderTitle(screenWidth, screenHeight, partialTick, poseStack);
|
||||
}
|
||||
});
|
||||
|
||||
public static final IIngameOverlay SCOREBOARD_ELEMENT = OverlayRegistry.registerOverlayTop("Scoreboard", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
public static final IIngameOverlay SCOREBOARD_ELEMENT = OverlayRegistry.registerOverlayTop("Scoreboard", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
|
||||
Scoreboard scoreboard = gui.minecraft.level.getScoreboard();
|
||||
Objective objective = null;
|
||||
@@ -298,24 +297,24 @@ public class ForgeIngameGui extends Gui
|
||||
Objective scoreobjective1 = objective != null ? objective : scoreboard.getDisplayObjective(1);
|
||||
if (scoreobjective1 != null)
|
||||
{
|
||||
gui.displayScoreboardSidebar(mStack, scoreobjective1);
|
||||
gui.displayScoreboardSidebar(poseStack, scoreobjective1);
|
||||
}
|
||||
});
|
||||
|
||||
public static final IIngameOverlay CHAT_PANEL_ELEMENT = OverlayRegistry.registerOverlayTop("Chat History", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
public static final IIngameOverlay CHAT_PANEL_ELEMENT = OverlayRegistry.registerOverlayTop("Chat History", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
|
||||
gui.renderChat(screenWidth, screenHeight, mStack);
|
||||
gui.renderChat(screenWidth, screenHeight, poseStack);
|
||||
});
|
||||
|
||||
public static final IIngameOverlay PLAYER_LIST_ELEMENT = OverlayRegistry.registerOverlayTop("Player List", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {
|
||||
public static final IIngameOverlay PLAYER_LIST_ELEMENT = OverlayRegistry.registerOverlayTop("Player List", (gui, poseStack, partialTick, screenWidth, screenHeight) -> {
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
|
||||
gui.renderPlayerList(screenWidth, screenHeight, mStack);
|
||||
gui.renderPlayerList(screenWidth, screenHeight, poseStack);
|
||||
});
|
||||
|
||||
public ForgeIngameGui(Minecraft mc)
|
||||
@@ -325,16 +324,16 @@ public class ForgeIngameGui extends Gui
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack pStack, float partialTicks)
|
||||
public void render(PoseStack poseStack, float partialTick)
|
||||
{
|
||||
this.screenWidth = this.minecraft.getWindow().getGuiScaledWidth();
|
||||
this.screenHeight = this.minecraft.getWindow().getGuiScaledHeight();
|
||||
eventParent = new RenderGameOverlayEvent(pStack, partialTicks, this.minecraft.getWindow());
|
||||
eventParent = new RenderGameOverlayEvent(poseStack, partialTick, this.minecraft.getWindow());
|
||||
|
||||
right_height = 39;
|
||||
left_height = 39;
|
||||
|
||||
if (pre(ALL, pStack)) return;
|
||||
if (pre(ALL, poseStack)) return;
|
||||
|
||||
font = minecraft.font;
|
||||
|
||||
@@ -345,9 +344,9 @@ public class ForgeIngameGui extends Gui
|
||||
{
|
||||
if (!entry.isEnabled()) return;
|
||||
IIngameOverlay overlay = entry.getOverlay();
|
||||
if (pre(overlay, pStack)) return;
|
||||
overlay.render(this, pStack, partialTicks, screenWidth, screenHeight);
|
||||
post(overlay, pStack);
|
||||
if (pre(overlay, poseStack)) return;
|
||||
overlay.render(this, poseStack, partialTick, screenWidth, screenHeight);
|
||||
post(overlay, poseStack);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
@@ -357,7 +356,7 @@ public class ForgeIngameGui extends Gui
|
||||
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
post(ALL, pStack);
|
||||
post(ALL, poseStack);
|
||||
}
|
||||
|
||||
public boolean shouldDrawSurvivalElements()
|
||||
@@ -365,17 +364,17 @@ public class ForgeIngameGui extends Gui
|
||||
return minecraft.gameMode.canHurtPlayer() && minecraft.getCameraEntity() instanceof Player;
|
||||
}
|
||||
|
||||
protected void renderSubtitles(PoseStack mStack)
|
||||
protected void renderSubtitles(PoseStack poseStack)
|
||||
{
|
||||
this.subtitleOverlay.render(mStack);
|
||||
this.subtitleOverlay.render(poseStack);
|
||||
}
|
||||
|
||||
protected void renderBossHealth(PoseStack mStack)
|
||||
protected void renderBossHealth(PoseStack poseStack)
|
||||
{
|
||||
bind(GuiComponent.GUI_ICONS_LOCATION);
|
||||
RenderSystem.defaultBlendFunc();
|
||||
minecraft.getProfiler().push("bossHealth");
|
||||
this.bossOverlay.render(mStack);
|
||||
this.bossOverlay.render(poseStack);
|
||||
minecraft.getProfiler().pop();
|
||||
}
|
||||
|
||||
@@ -395,7 +394,7 @@ public class ForgeIngameGui extends Gui
|
||||
}
|
||||
}
|
||||
|
||||
private void renderHelmet(float partialTicks, PoseStack mStack)
|
||||
private void renderHelmet(float partialTick, PoseStack poseStack)
|
||||
{
|
||||
ItemStack itemstack = this.minecraft.player.getInventory().getArmor(3);
|
||||
|
||||
@@ -408,7 +407,7 @@ public class ForgeIngameGui extends Gui
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderProperties.get(item).renderHelmetOverlay(itemstack, minecraft.player, this.screenWidth, this.screenHeight, partialTicks);
|
||||
RenderProperties.get(item).renderHelmetOverlay(itemstack, minecraft.player, this.screenWidth, this.screenHeight, partialTick);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -420,7 +419,7 @@ public class ForgeIngameGui extends Gui
|
||||
}
|
||||
}
|
||||
|
||||
protected void renderArmor(PoseStack mStack, int width, int height)
|
||||
protected void renderArmor(PoseStack poseStack, int width, int height)
|
||||
{
|
||||
minecraft.getProfiler().push("armor");
|
||||
|
||||
@@ -433,15 +432,15 @@ public class ForgeIngameGui extends Gui
|
||||
{
|
||||
if (i < level)
|
||||
{
|
||||
blit(mStack, left, top, 34, 9, 9, 9);
|
||||
blit(poseStack, left, top, 34, 9, 9, 9);
|
||||
}
|
||||
else if (i == level)
|
||||
{
|
||||
blit(mStack, left, top, 25, 9, 9, 9);
|
||||
blit(poseStack, left, top, 25, 9, 9, 9);
|
||||
}
|
||||
else if (i > level)
|
||||
{
|
||||
blit(mStack, left, top, 16, 9, 9, 9);
|
||||
blit(poseStack, left, top, 16, 9, 9, 9);
|
||||
}
|
||||
left += 8;
|
||||
}
|
||||
@@ -452,9 +451,9 @@ public class ForgeIngameGui extends Gui
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderPortalOverlay(float partialTicks)
|
||||
protected void renderPortalOverlay(float partialTick)
|
||||
{
|
||||
float f1 = Mth.lerp(partialTicks, this.minecraft.player.oPortalTime, this.minecraft.player.portalTime);
|
||||
float f1 = Mth.lerp(partialTick, this.minecraft.player.oPortalTime, this.minecraft.player.portalTime);
|
||||
|
||||
if (f1 > 0.0F)
|
||||
{
|
||||
@@ -462,7 +461,7 @@ public class ForgeIngameGui extends Gui
|
||||
}
|
||||
}
|
||||
|
||||
protected void renderAir(int width, int height, PoseStack mStack)
|
||||
protected void renderAir(int width, int height, PoseStack poseStack)
|
||||
{
|
||||
minecraft.getProfiler().push("air");
|
||||
Player player = (Player)this.minecraft.getCameraEntity();
|
||||
@@ -478,7 +477,7 @@ public class ForgeIngameGui extends Gui
|
||||
|
||||
for (int i = 0; i < full + partial; ++i)
|
||||
{
|
||||
blit(mStack, left - i * 8 - 9, top, (i < full ? 16 : 25), 18, 9, 9);
|
||||
blit(poseStack, left - i * 8 - 9, top, (i < full ? 16 : 25), 18, 9, 9);
|
||||
}
|
||||
right_height += 10;
|
||||
}
|
||||
@@ -544,7 +543,7 @@ public class ForgeIngameGui extends Gui
|
||||
minecraft.getProfiler().pop();
|
||||
}
|
||||
|
||||
public void renderFood(int width, int height, PoseStack mStack)
|
||||
public void renderFood(int width, int height, PoseStack poseStack)
|
||||
{
|
||||
minecraft.getProfiler().push("food");
|
||||
|
||||
@@ -578,18 +577,18 @@ public class ForgeIngameGui extends Gui
|
||||
y = top + (random.nextInt(3) - 1);
|
||||
}
|
||||
|
||||
blit(mStack, x, y, 16 + background * 9, 27, 9, 9);
|
||||
blit(poseStack, x, y, 16 + background * 9, 27, 9, 9);
|
||||
|
||||
if (idx < level)
|
||||
blit(mStack, x, y, icon + 36, 27, 9, 9);
|
||||
blit(poseStack, x, y, icon + 36, 27, 9, 9);
|
||||
else if (idx == level)
|
||||
blit(mStack, x, y, icon + 45, 27, 9, 9);
|
||||
blit(poseStack, x, y, icon + 45, 27, 9, 9);
|
||||
}
|
||||
RenderSystem.disableBlend();
|
||||
minecraft.getProfiler().pop();
|
||||
}
|
||||
|
||||
protected void renderSleepFade(int width, int height, PoseStack mStack)
|
||||
protected void renderSleepFade(int width, int height, PoseStack poseStack)
|
||||
{
|
||||
if (minecraft.player.getSleepTimer() > 0)
|
||||
{
|
||||
@@ -605,14 +604,14 @@ public class ForgeIngameGui extends Gui
|
||||
}
|
||||
|
||||
int color = (int)(220.0F * opacity) << 24 | 1052704;
|
||||
fill(mStack, 0, 0, width, height, color);
|
||||
fill(poseStack, 0, 0, width, height, color);
|
||||
// RenderSystem.enableAlphaTest();
|
||||
RenderSystem.enableDepthTest();
|
||||
minecraft.getProfiler().pop();
|
||||
}
|
||||
}
|
||||
|
||||
protected void renderExperience(int x, PoseStack mStack)
|
||||
protected void renderExperience(int x, PoseStack poseStack)
|
||||
{
|
||||
bind(GUI_ICONS_LOCATION);
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
@@ -620,27 +619,27 @@ public class ForgeIngameGui extends Gui
|
||||
|
||||
if (minecraft.gameMode.hasExperience())
|
||||
{
|
||||
super.renderExperienceBar(mStack, x);
|
||||
super.renderExperienceBar(poseStack, x);
|
||||
}
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderJumpMeter(PoseStack mStack, int x)
|
||||
public void renderJumpMeter(PoseStack poseStack, int x)
|
||||
{
|
||||
bind(GUI_ICONS_LOCATION);
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.disableBlend();
|
||||
|
||||
super.renderJumpMeter(mStack, x);
|
||||
super.renderJumpMeter(poseStack, x);
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
minecraft.getProfiler().pop();
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
protected void renderHUDText(int width, int height, PoseStack mStack)
|
||||
protected void renderHUDText(int width, int height, PoseStack poseStack)
|
||||
{
|
||||
minecraft.getProfiler().push("forgeHudText");
|
||||
RenderSystem.defaultBlendFunc();
|
||||
@@ -660,23 +659,23 @@ public class ForgeIngameGui extends Gui
|
||||
}
|
||||
}
|
||||
|
||||
if (this.minecraft.options.renderDebug && !pre(DEBUG, mStack))
|
||||
if (this.minecraft.options.renderDebug && !pre(DEBUG, poseStack))
|
||||
{
|
||||
debugOverlay.update();
|
||||
listL.addAll(debugOverlay.getLeft());
|
||||
listR.addAll(debugOverlay.getRight());
|
||||
post(DEBUG, mStack);
|
||||
post(DEBUG, poseStack);
|
||||
}
|
||||
|
||||
RenderGameOverlayEvent.Text event = new RenderGameOverlayEvent.Text(mStack, eventParent, listL, listR);
|
||||
RenderGameOverlayEvent.Text event = new RenderGameOverlayEvent.Text(poseStack, eventParent, listL, listR);
|
||||
if (!MinecraftForge.EVENT_BUS.post(event))
|
||||
{
|
||||
int top = 2;
|
||||
for (String msg : listL)
|
||||
{
|
||||
if (msg == null) continue;
|
||||
fill(mStack, 1, top - 1, 2 + font.width(msg) + 1, top + font.lineHeight - 1, -1873784752);
|
||||
font.draw(mStack, msg, 2, top, 14737632);
|
||||
fill(poseStack, 1, top - 1, 2 + font.width(msg) + 1, top + font.lineHeight - 1, -1873784752);
|
||||
font.draw(poseStack, msg, 2, top, 14737632);
|
||||
top += font.lineHeight;
|
||||
}
|
||||
|
||||
@@ -686,30 +685,30 @@ public class ForgeIngameGui extends Gui
|
||||
if (msg == null) continue;
|
||||
int w = font.width(msg);
|
||||
int left = width - 2 - w;
|
||||
fill(mStack, left - 1, top - 1, left + w + 1, top + font.lineHeight - 1, -1873784752);
|
||||
font.draw(mStack, msg, left, top, 14737632);
|
||||
fill(poseStack, left - 1, top - 1, left + w + 1, top + font.lineHeight - 1, -1873784752);
|
||||
font.draw(poseStack, msg, left, top, 14737632);
|
||||
top += font.lineHeight;
|
||||
}
|
||||
}
|
||||
|
||||
minecraft.getProfiler().pop();
|
||||
post(TEXT, mStack);
|
||||
post(TEXT, poseStack);
|
||||
}
|
||||
|
||||
protected void renderFPSGraph(PoseStack mStack)
|
||||
protected void renderFPSGraph(PoseStack poseStack)
|
||||
{
|
||||
if (this.minecraft.options.renderDebug && this.minecraft.options.renderFpsChart)
|
||||
{
|
||||
this.debugOverlay.render(mStack);
|
||||
this.debugOverlay.render(poseStack);
|
||||
}
|
||||
}
|
||||
|
||||
protected void renderRecordOverlay(int width, int height, float partialTicks, PoseStack pStack)
|
||||
protected void renderRecordOverlay(int width, int height, float partialTick, PoseStack pStack)
|
||||
{
|
||||
if (overlayMessageTime > 0)
|
||||
{
|
||||
minecraft.getProfiler().push("overlayMessage");
|
||||
float hue = (float)overlayMessageTime - partialTicks;
|
||||
float hue = (float)overlayMessageTime - partialTick;
|
||||
int opacity = (int)(hue * 255.0F / 20.0F);
|
||||
if (opacity > 255) opacity = 255;
|
||||
|
||||
@@ -730,12 +729,12 @@ public class ForgeIngameGui extends Gui
|
||||
}
|
||||
}
|
||||
|
||||
protected void renderTitle(int width, int height, float partialTicks, PoseStack pStack)
|
||||
protected void renderTitle(int width, int height, float partialTick, PoseStack pStack)
|
||||
{
|
||||
if (title != null && titleTime > 0)
|
||||
{
|
||||
minecraft.getProfiler().push("titleAndSubtitle");
|
||||
float age = (float)this.titleTime - partialTicks;
|
||||
float age = (float)this.titleTime - partialTick;
|
||||
int opacity = 255;
|
||||
|
||||
if (titleTime > titleFadeOutTime + titleStayTime)
|
||||
@@ -790,7 +789,7 @@ public class ForgeIngameGui extends Gui
|
||||
minecraft.getProfiler().pop();
|
||||
}
|
||||
|
||||
protected void renderPlayerList(int width, int height, PoseStack mStack)
|
||||
protected void renderPlayerList(int width, int height, PoseStack poseStack)
|
||||
{
|
||||
Objective scoreobjective = this.minecraft.level.getScoreboard().getDisplayObjective(0);
|
||||
ClientPacketListener handler = minecraft.player.connection;
|
||||
@@ -798,9 +797,9 @@ public class ForgeIngameGui extends Gui
|
||||
if (minecraft.options.keyPlayerList.isDown() && (!minecraft.isLocalServer() || handler.getOnlinePlayers().size() > 1 || scoreobjective != null))
|
||||
{
|
||||
this.tabList.setVisible(true);
|
||||
if (pre(PLAYER_LIST, mStack)) return;
|
||||
this.tabList.render(mStack, width, this.minecraft.level.getScoreboard(), scoreobjective);
|
||||
post(PLAYER_LIST, mStack);
|
||||
if (pre(PLAYER_LIST, poseStack)) return;
|
||||
this.tabList.render(poseStack, width, this.minecraft.level.getScoreboard(), scoreobjective);
|
||||
post(PLAYER_LIST, poseStack);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -808,7 +807,7 @@ public class ForgeIngameGui extends Gui
|
||||
}
|
||||
}
|
||||
|
||||
protected void renderHealthMount(int width, int height, PoseStack mStack)
|
||||
protected void renderHealthMount(int width, int height, PoseStack poseStack)
|
||||
{
|
||||
Player player = (Player)minecraft.getCameraEntity();
|
||||
Entity tmp = player.getVehicle();
|
||||
@@ -843,12 +842,12 @@ public class ForgeIngameGui extends Gui
|
||||
for (int i = 0; i < rowCount; ++i)
|
||||
{
|
||||
int x = left_align - i * 8 - 9;
|
||||
blit(mStack, x, top, BACKGROUND, 9, 9, 9);
|
||||
blit(poseStack, x, top, BACKGROUND, 9, 9, 9);
|
||||
|
||||
if (i * 2 + 1 + heart < health)
|
||||
blit(mStack, x, top, FULL, 9, 9, 9);
|
||||
blit(poseStack, x, top, FULL, 9, 9, 9);
|
||||
else if (i * 2 + 1 + heart == health)
|
||||
blit(mStack, x, top, HALF, 9, 9, 9);
|
||||
blit(poseStack, x, top, HALF, 9, 9, 9);
|
||||
}
|
||||
|
||||
right_height += 10;
|
||||
@@ -857,21 +856,21 @@ public class ForgeIngameGui extends Gui
|
||||
}
|
||||
|
||||
//Helper macros
|
||||
private boolean pre(ElementType type, PoseStack mStack)
|
||||
private boolean pre(ElementType type, PoseStack poseStack)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Pre(mStack, eventParent, type));
|
||||
return MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Pre(poseStack, eventParent, type));
|
||||
}
|
||||
private void post(ElementType type, PoseStack mStack)
|
||||
private void post(ElementType type, PoseStack poseStack)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(mStack, eventParent, type));
|
||||
MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(poseStack, eventParent, type));
|
||||
}
|
||||
private boolean pre(IIngameOverlay overlay, PoseStack mStack)
|
||||
private boolean pre(IIngameOverlay overlay, PoseStack poseStack)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.PreLayer(mStack, eventParent, overlay));
|
||||
return MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.PreLayer(poseStack, eventParent, overlay));
|
||||
}
|
||||
private void post(IIngameOverlay overlay, PoseStack mStack)
|
||||
private void post(IIngameOverlay overlay, PoseStack poseStack)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.PostLayer(mStack, eventParent, overlay));
|
||||
MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.PostLayer(poseStack, eventParent, overlay));
|
||||
}
|
||||
private void bind(ResourceLocation res)
|
||||
{
|
||||
@@ -892,8 +891,8 @@ public class ForgeIngameGui extends Gui
|
||||
this.block = entity.pick(rayTraceDistance, 0.0F, false);
|
||||
this.liquid = entity.pick(rayTraceDistance, 0.0F, true);
|
||||
}
|
||||
@Override protected void drawGameInformation(PoseStack mStack){}
|
||||
@Override protected void drawSystemInformation(PoseStack mStack){}
|
||||
@Override protected void drawGameInformation(PoseStack poseStack){}
|
||||
@Override protected void drawSystemInformation(PoseStack poseStack){}
|
||||
private List<String> getLeft()
|
||||
{
|
||||
List<String> ret = this.getGameInformation();
|
||||
|
||||
@@ -57,7 +57,7 @@ public class GuiUtils
|
||||
* and filler. It is assumed that the desired texture ResourceLocation object has been bound using
|
||||
* Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
|
||||
*
|
||||
* @param matrixStack the gui matrix stack
|
||||
* @param poseStack the gui pose stack
|
||||
* @param x x axis offset
|
||||
* @param y y axis offset
|
||||
* @param u bound resource location image x offset
|
||||
@@ -69,10 +69,10 @@ public class GuiUtils
|
||||
* @param borderSize the size of the box's borders
|
||||
* @param zLevel the zLevel to draw at
|
||||
*/
|
||||
public static void drawContinuousTexturedBox(PoseStack matrixStack, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
|
||||
public static void drawContinuousTexturedBox(PoseStack poseStack, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
|
||||
int borderSize, float zLevel)
|
||||
{
|
||||
drawContinuousTexturedBox(matrixStack, x, y, u, v, width, height, textureWidth, textureHeight, borderSize, borderSize, borderSize, borderSize, zLevel);
|
||||
drawContinuousTexturedBox(poseStack, x, y, u, v, width, height, textureWidth, textureHeight, borderSize, borderSize, borderSize, borderSize, zLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,7 +80,7 @@ public class GuiUtils
|
||||
* and filler. The provided ResourceLocation object will be bound using
|
||||
* Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
|
||||
*
|
||||
* @param matrixStack the gui matrix stack
|
||||
* @param poseStack the gui pose stack
|
||||
* @param res the ResourceLocation object that contains the desired image
|
||||
* @param x x axis offset
|
||||
* @param y y axis offset
|
||||
@@ -93,10 +93,10 @@ public class GuiUtils
|
||||
* @param borderSize the size of the box's borders
|
||||
* @param zLevel the zLevel to draw at
|
||||
*/
|
||||
public static void drawContinuousTexturedBox(PoseStack matrixStack, ResourceLocation res, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
|
||||
public static void drawContinuousTexturedBox(PoseStack poseStack, ResourceLocation res, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
|
||||
int borderSize, float zLevel)
|
||||
{
|
||||
drawContinuousTexturedBox(matrixStack, res, x, y, u, v, width, height, textureWidth, textureHeight, borderSize, borderSize, borderSize, borderSize, zLevel);
|
||||
drawContinuousTexturedBox(poseStack, res, x, y, u, v, width, height, textureWidth, textureHeight, borderSize, borderSize, borderSize, borderSize, zLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,7 +104,7 @@ public class GuiUtils
|
||||
* and filler. The provided ResourceLocation object will be bound using
|
||||
* Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
|
||||
*
|
||||
* @param matrixStack the gui matrix stack
|
||||
* @param poseStack the gui pose stack
|
||||
* @param res the ResourceLocation object that contains the desired image
|
||||
* @param x x axis offset
|
||||
* @param y y axis offset
|
||||
@@ -120,12 +120,12 @@ public class GuiUtils
|
||||
* @param rightBorder the size of the box's right border
|
||||
* @param zLevel the zLevel to draw at
|
||||
*/
|
||||
public static void drawContinuousTexturedBox(PoseStack matrixStack, ResourceLocation res, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
|
||||
public static void drawContinuousTexturedBox(PoseStack poseStack, ResourceLocation res, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
|
||||
int topBorder, int bottomBorder, int leftBorder, int rightBorder, float zLevel)
|
||||
{
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShaderTexture(0, res);
|
||||
drawContinuousTexturedBox(matrixStack, x, y, u, v, width, height, textureWidth, textureHeight, topBorder, bottomBorder, leftBorder, rightBorder, zLevel);
|
||||
drawContinuousTexturedBox(poseStack, x, y, u, v, width, height, textureWidth, textureHeight, topBorder, bottomBorder, leftBorder, rightBorder, zLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,7 +133,7 @@ public class GuiUtils
|
||||
* and filler. It is assumed that the desired texture ResourceLocation object has been bound using
|
||||
* Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
|
||||
*
|
||||
* @param matrixStack the gui matrix stack
|
||||
* @param poseStack the gui pose stack
|
||||
* @param x x axis offset
|
||||
* @param y y axis offset
|
||||
* @param u bound resource location image x offset
|
||||
@@ -148,7 +148,7 @@ public class GuiUtils
|
||||
* @param rightBorder the size of the box's right border
|
||||
* @param zLevel the zLevel to draw at
|
||||
*/
|
||||
public static void drawContinuousTexturedBox(PoseStack matrixStack, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
|
||||
public static void drawContinuousTexturedBox(PoseStack poseStack, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
|
||||
int topBorder, int bottomBorder, int leftBorder, int rightBorder, float zLevel)
|
||||
{
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
@@ -166,37 +166,37 @@ public class GuiUtils
|
||||
|
||||
// Draw Border
|
||||
// Top Left
|
||||
drawTexturedModalRect(matrixStack, x, y, u, v, leftBorder, topBorder, zLevel);
|
||||
drawTexturedModalRect(poseStack, x, y, u, v, leftBorder, topBorder, zLevel);
|
||||
// Top Right
|
||||
drawTexturedModalRect(matrixStack, x + leftBorder + canvasWidth, y, u + leftBorder + fillerWidth, v, rightBorder, topBorder, zLevel);
|
||||
drawTexturedModalRect(poseStack, x + leftBorder + canvasWidth, y, u + leftBorder + fillerWidth, v, rightBorder, topBorder, zLevel);
|
||||
// Bottom Left
|
||||
drawTexturedModalRect(matrixStack, x, y + topBorder + canvasHeight, u, v + topBorder + fillerHeight, leftBorder, bottomBorder, zLevel);
|
||||
drawTexturedModalRect(poseStack, x, y + topBorder + canvasHeight, u, v + topBorder + fillerHeight, leftBorder, bottomBorder, zLevel);
|
||||
// Bottom Right
|
||||
drawTexturedModalRect(matrixStack, x + leftBorder + canvasWidth, y + topBorder + canvasHeight, u + leftBorder + fillerWidth, v + topBorder + fillerHeight, rightBorder, bottomBorder, zLevel);
|
||||
drawTexturedModalRect(poseStack, x + leftBorder + canvasWidth, y + topBorder + canvasHeight, u + leftBorder + fillerWidth, v + topBorder + fillerHeight, rightBorder, bottomBorder, zLevel);
|
||||
|
||||
for (int i = 0; i < xPasses + (remainderWidth > 0 ? 1 : 0); i++)
|
||||
{
|
||||
// Top Border
|
||||
drawTexturedModalRect(matrixStack, x + leftBorder + (i * fillerWidth), y, u + leftBorder, v, (i == xPasses ? remainderWidth : fillerWidth), topBorder, zLevel);
|
||||
drawTexturedModalRect(poseStack, x + leftBorder + (i * fillerWidth), y, u + leftBorder, v, (i == xPasses ? remainderWidth : fillerWidth), topBorder, zLevel);
|
||||
// Bottom Border
|
||||
drawTexturedModalRect(matrixStack, x + leftBorder + (i * fillerWidth), y + topBorder + canvasHeight, u + leftBorder, v + topBorder + fillerHeight, (i == xPasses ? remainderWidth : fillerWidth), bottomBorder, zLevel);
|
||||
drawTexturedModalRect(poseStack, x + leftBorder + (i * fillerWidth), y + topBorder + canvasHeight, u + leftBorder, v + topBorder + fillerHeight, (i == xPasses ? remainderWidth : fillerWidth), bottomBorder, zLevel);
|
||||
|
||||
// Throw in some filler for good measure
|
||||
for (int j = 0; j < yPasses + (remainderHeight > 0 ? 1 : 0); j++)
|
||||
drawTexturedModalRect(matrixStack, x + leftBorder + (i * fillerWidth), y + topBorder + (j * fillerHeight), u + leftBorder, v + topBorder, (i == xPasses ? remainderWidth : fillerWidth), (j == yPasses ? remainderHeight : fillerHeight), zLevel);
|
||||
drawTexturedModalRect(poseStack, x + leftBorder + (i * fillerWidth), y + topBorder + (j * fillerHeight), u + leftBorder, v + topBorder, (i == xPasses ? remainderWidth : fillerWidth), (j == yPasses ? remainderHeight : fillerHeight), zLevel);
|
||||
}
|
||||
|
||||
// Side Borders
|
||||
for (int j = 0; j < yPasses + (remainderHeight > 0 ? 1 : 0); j++)
|
||||
{
|
||||
// Left Border
|
||||
drawTexturedModalRect(matrixStack, x, y + topBorder + (j * fillerHeight), u, v + topBorder, leftBorder, (j == yPasses ? remainderHeight : fillerHeight), zLevel);
|
||||
drawTexturedModalRect(poseStack, x, y + topBorder + (j * fillerHeight), u, v + topBorder, leftBorder, (j == yPasses ? remainderHeight : fillerHeight), zLevel);
|
||||
// Right Border
|
||||
drawTexturedModalRect(matrixStack, x + leftBorder + canvasWidth, y + topBorder + (j * fillerHeight), u + leftBorder + fillerWidth, v + topBorder, rightBorder, (j == yPasses ? remainderHeight : fillerHeight), zLevel);
|
||||
drawTexturedModalRect(poseStack, x + leftBorder + canvasWidth, y + topBorder + (j * fillerHeight), u + leftBorder + fillerWidth, v + topBorder, rightBorder, (j == yPasses ? remainderHeight : fillerHeight), zLevel);
|
||||
}
|
||||
}
|
||||
|
||||
public static void drawTexturedModalRect(PoseStack matrixStack, int x, int y, int u, int v, int width, int height, float zLevel)
|
||||
public static void drawTexturedModalRect(PoseStack poseStack, int x, int y, int u, int v, int width, int height, float zLevel)
|
||||
{
|
||||
final float uScale = 1f / 0x100;
|
||||
final float vScale = 1f / 0x100;
|
||||
@@ -204,7 +204,7 @@ public class GuiUtils
|
||||
Tesselator tessellator = Tesselator.getInstance();
|
||||
BufferBuilder wr = tessellator.getBuilder();
|
||||
wr.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX);
|
||||
Matrix4f matrix = matrixStack.last().pose();
|
||||
Matrix4f matrix = poseStack.last().pose();
|
||||
wr.vertex(matrix, x , y + height, zLevel).uv( u * uScale, ((v + height) * vScale)).endVertex();
|
||||
wr.vertex(matrix, x + width, y + height, zLevel).uv((u + width) * uScale, ((v + height) * vScale)).endVertex();
|
||||
wr.vertex(matrix, x + width, y , zLevel).uv((u + width) * uScale, ( v * vScale)).endVertex();
|
||||
@@ -242,12 +242,12 @@ public class GuiUtils
|
||||
RenderSystem.enableTexture();
|
||||
}
|
||||
|
||||
public static void drawInscribedRect(PoseStack mStack, int x, int y, int boundsWidth, int boundsHeight, int rectWidth, int rectHeight)
|
||||
public static void drawInscribedRect(PoseStack poseStack, int x, int y, int boundsWidth, int boundsHeight, int rectWidth, int rectHeight)
|
||||
{
|
||||
drawInscribedRect(mStack, x, y, boundsWidth, boundsHeight, rectWidth, rectHeight, true, true);
|
||||
drawInscribedRect(poseStack, x, y, boundsWidth, boundsHeight, rectWidth, rectHeight, true, true);
|
||||
}
|
||||
|
||||
public static void drawInscribedRect(PoseStack mStack, int x, int y, int boundsWidth, int boundsHeight, int rectWidth, int rectHeight, boolean centerX, boolean centerY)
|
||||
public static void drawInscribedRect(PoseStack poseStack, int x, int y, int boundsWidth, int boundsHeight, int rectWidth, int rectHeight, boolean centerX, boolean centerY)
|
||||
{
|
||||
if (rectWidth * boundsHeight > rectHeight * boundsWidth) {
|
||||
int h = boundsHeight;
|
||||
@@ -259,6 +259,6 @@ public class GuiUtils
|
||||
if (centerX) x += (w - boundsWidth) / 2;
|
||||
}
|
||||
|
||||
GuiComponent.blit(mStack, x, y, boundsWidth, boundsHeight, 0.0f,0.0f, rectWidth, rectHeight, rectWidth, rectHeight);
|
||||
GuiComponent.blit(poseStack, x, y, boundsWidth, boundsHeight, 0.0f,0.0f, rectWidth, rectHeight, rectWidth, rectHeight);
|
||||
}
|
||||
}
|
||||
@@ -9,5 +9,5 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
public interface IIngameOverlay
|
||||
{
|
||||
void render(ForgeIngameGui gui, PoseStack mStack, float partialTicks, int width, int height);
|
||||
void render(ForgeIngameGui gui, PoseStack poseStack, float partialTick, int width, int height);
|
||||
}
|
||||
@@ -80,17 +80,17 @@ public class LoadingErrorScreen extends ErrorScreen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack mStack, int mouseX, int mouseY, float partialTicks)
|
||||
public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTick)
|
||||
{
|
||||
this.renderBackground(mStack);
|
||||
this.entryList.render(mStack, mouseX, mouseY, partialTicks);
|
||||
drawMultiLineCenteredString(mStack, font, this.modLoadErrors.isEmpty() ? warningHeader : errorHeader, this.width / 2, 10);
|
||||
this.renderables.forEach(button -> button.render(mStack, mouseX, mouseY, partialTicks));
|
||||
this.renderBackground(poseStack);
|
||||
this.entryList.render(poseStack, mouseX, mouseY, partialTick);
|
||||
drawMultiLineCenteredString(poseStack, font, this.modLoadErrors.isEmpty() ? warningHeader : errorHeader, this.width / 2, 10);
|
||||
this.renderables.forEach(button -> button.render(poseStack, mouseX, mouseY, partialTick));
|
||||
}
|
||||
|
||||
private void drawMultiLineCenteredString(PoseStack mStack, Font fr, Component str, int x, int y) {
|
||||
private void drawMultiLineCenteredString(PoseStack poseStack, Font fr, Component str, int x, int y) {
|
||||
for (FormattedCharSequence s : fr.split(str, this.width)) {
|
||||
fr.drawShadow(mStack, s, (float) (x - fr.width(s) / 2.0), y, 0xFFFFFF);
|
||||
fr.drawShadow(poseStack, s, (float) (x - fr.width(s) / 2.0), y, 0xFFFFFF);
|
||||
y+=fr.lineHeight;
|
||||
}
|
||||
}
|
||||
@@ -140,15 +140,15 @@ public class LoadingErrorScreen extends ErrorScreen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack pStack, int entryIdx, int top, int left, final int entryWidth, final int entryHeight, final int mouseX, final int mouseY, final boolean p_194999_5_, final float partialTicks) {
|
||||
public void render(PoseStack poseStack, int entryIdx, int top, int left, final int entryWidth, final int entryHeight, final int mouseX, final int mouseY, final boolean p_194999_5_, final float partialTick) {
|
||||
Font font = Minecraft.getInstance().font;
|
||||
final List<FormattedCharSequence> strings = font.split(message, LoadingEntryList.this.width);
|
||||
int y = top + 2;
|
||||
for (int i = 0; i < Math.min(strings.size(), 2); i++) {
|
||||
if (center)
|
||||
font.draw(pStack, strings.get(i), left + (width) - font.width(strings.get(i)) / 2F, y, 0xFFFFFF);
|
||||
font.draw(poseStack, strings.get(i), left + (width) - font.width(strings.get(i)) / 2F, y, 0xFFFFFF);
|
||||
else
|
||||
font.draw(pStack, strings.get(i), left + 5, y, 0xFFFFFF);
|
||||
font.draw(poseStack, strings.get(i), left + 5, y, 0xFFFFFF);
|
||||
y += font.lineHeight;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,9 +104,6 @@ public class ModListScreen extends Screen
|
||||
private boolean sorted = false;
|
||||
private SortType sortType = SortType.NORMAL;
|
||||
|
||||
/**
|
||||
* @param parentScreen
|
||||
*/
|
||||
public ModListScreen(Screen parentScreen)
|
||||
{
|
||||
super(new TranslatableComponent("fml.menu.mods.title"));
|
||||
@@ -177,7 +174,7 @@ public class ModListScreen extends Screen
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawPanel(PoseStack mStack, int entryRight, int relativeY, Tesselator tess, int mouseX, int mouseY)
|
||||
protected void drawPanel(PoseStack poseStack, int entryRight, int relativeY, Tesselator tess, int mouseX, int mouseY)
|
||||
{
|
||||
if (logoPath != null) {
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
@@ -186,7 +183,7 @@ public class ModListScreen extends Screen
|
||||
RenderSystem.setShaderTexture(0, logoPath);
|
||||
// Draw the logo image inscribed in a rectangle with width entryWidth (minus some padding) and height 50
|
||||
int headerHeight = 50;
|
||||
GuiUtils.drawInscribedRect(mStack, left + PADDING, relativeY, width - (PADDING * 2), headerHeight, logoDims.width, logoDims.height, false, true);
|
||||
GuiUtils.drawInscribedRect(poseStack, left + PADDING, relativeY, width - (PADDING * 2), headerHeight, logoDims.width, logoDims.height, false, true);
|
||||
relativeY += headerHeight + PADDING;
|
||||
}
|
||||
|
||||
@@ -195,7 +192,7 @@ public class ModListScreen extends Screen
|
||||
if (line != null)
|
||||
{
|
||||
RenderSystem.enableBlend();
|
||||
ModListScreen.this.font.drawShadow(mStack, line, left + PADDING, relativeY, 0xFFFFFF);
|
||||
ModListScreen.this.font.drawShadow(poseStack, line, left + PADDING, relativeY, 0xFFFFFF);
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
relativeY += font.lineHeight;
|
||||
@@ -203,7 +200,7 @@ public class ModListScreen extends Screen
|
||||
|
||||
final Style component = findTextLine(mouseX, mouseY);
|
||||
if (component!=null) {
|
||||
ModListScreen.this.renderComponentHoverEffect(mStack, component, mouseX, mouseY);
|
||||
ModListScreen.this.renderComponentHoverEffect(poseStack, component, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,17 +360,17 @@ public class ModListScreen extends Screen
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack mStack, int mouseX, int mouseY, float partialTicks)
|
||||
public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTick)
|
||||
{
|
||||
this.modList.render(mStack, mouseX, mouseY, partialTicks);
|
||||
this.modList.render(poseStack, mouseX, mouseY, partialTick);
|
||||
if (this.modInfo != null)
|
||||
this.modInfo.render(mStack, mouseX, mouseY, partialTicks);
|
||||
this.modInfo.render(poseStack, mouseX, mouseY, partialTick);
|
||||
|
||||
Component text = new TranslatableComponent("fml.menu.mods.search");
|
||||
int x = modList.getLeft() + ((modList.getRight() - modList.getLeft()) / 2) - (getFontRenderer().width(text) / 2);
|
||||
this.search.render(mStack, mouseX , mouseY, partialTicks);
|
||||
super.render(mStack, mouseX, mouseY, partialTicks);
|
||||
getFontRenderer().draw(mStack, text.getVisualOrderText(), x, search.y - getFontRenderer().lineHeight, 0xFFFFFF);
|
||||
this.search.render(poseStack, mouseX , mouseY, partialTick);
|
||||
super.render(poseStack, mouseX, mouseY, partialTick);
|
||||
getFontRenderer().draw(poseStack, text.getVisualOrderText(), x, search.y - getFontRenderer().lineHeight, 0xFFFFFF);
|
||||
}
|
||||
|
||||
public Minecraft getMinecraftInstance()
|
||||
|
||||
@@ -49,9 +49,8 @@ public class NotificationModUpdateScreen extends Screen
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void render(PoseStack mStack, int mouseX, int mouseY, float partialTicks)
|
||||
public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTick)
|
||||
{
|
||||
if (showNotification == null || !showNotification.shouldDraw() || !FMLConfig.runVersionCheck())
|
||||
{
|
||||
@@ -65,7 +64,7 @@ public class NotificationModUpdateScreen extends Screen
|
||||
int w = modButton.getWidth();
|
||||
int h = modButton.getHeight();
|
||||
|
||||
blit(mStack, x + w - (h / 2 + 4), y + (h / 2 - 4), showNotification.getSheetOffset() * 8, (showNotification.isAnimated() && ((System.currentTimeMillis() / 800 & 1) == 1)) ? 8 : 0, 8, 8, 64, 16);
|
||||
blit(poseStack, x + w - (h / 2 + 4), y + (h / 2 - 4), showNotification.getSheetOffset() * 8, (showNotification.isAnimated() && ((System.currentTimeMillis() / 800 & 1) == 1)) ? 8 : 0, 8, 8, 64, 16);
|
||||
}
|
||||
|
||||
public static NotificationModUpdateScreen init(TitleScreen guiMainMenu, Button modButton)
|
||||
|
||||
@@ -159,7 +159,7 @@ public abstract class ScrollPanel extends AbstractContainerEventHandler implemen
|
||||
/**
|
||||
* Draws the background of the scroll panel. This runs AFTER Scissors are enabled.
|
||||
*/
|
||||
protected void drawBackground(PoseStack matrix, Tesselator tess, float partialTicks)
|
||||
protected void drawBackground(PoseStack matrix, Tesselator tess, float partialTick)
|
||||
{
|
||||
BufferBuilder worldr = tess.getBuilder();
|
||||
|
||||
@@ -185,7 +185,7 @@ public abstract class ScrollPanel extends AbstractContainerEventHandler implemen
|
||||
* Draw anything special on the screen. Scissor (RenderSystem.enableScissor) is enabled
|
||||
* for anything that is rendered outside the view box. Do not mess with Scissor unless you support this.
|
||||
*/
|
||||
protected abstract void drawPanel(PoseStack mStack, int entryRight, int relativeY, Tesselator tess, int mouseX, int mouseY);
|
||||
protected abstract void drawPanel(PoseStack poseStack, int entryRight, int relativeY, Tesselator tess, int mouseX, int mouseY);
|
||||
|
||||
protected boolean clickPanel(double mouseX, double mouseY, int button) { return false; }
|
||||
|
||||
@@ -294,7 +294,7 @@ public abstract class ScrollPanel extends AbstractContainerEventHandler implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack matrix, int mouseX, int mouseY, float partialTicks)
|
||||
public void render(PoseStack matrix, int mouseX, int mouseY, float partialTick)
|
||||
{
|
||||
Tesselator tess = Tesselator.getInstance();
|
||||
BufferBuilder worldr = tess.getBuilder();
|
||||
@@ -303,7 +303,7 @@ public abstract class ScrollPanel extends AbstractContainerEventHandler implemen
|
||||
RenderSystem.enableScissor((int)(left * scale), (int)(client.getWindow().getHeight() - (bottom * scale)),
|
||||
(int)(width * scale), (int)(height * scale));
|
||||
|
||||
this.drawBackground(matrix, tess, partialTicks);
|
||||
this.drawBackground(matrix, tess, partialTick);
|
||||
|
||||
int baseY = this.top + border - (int)this.scrollDistance;
|
||||
this.drawPanel(matrix, right, baseY, tess, mouseX, mouseY);
|
||||
@@ -365,9 +365,9 @@ public abstract class ScrollPanel extends AbstractContainerEventHandler implemen
|
||||
RenderSystem.disableScissor();
|
||||
}
|
||||
|
||||
protected void drawGradientRect(PoseStack mStack, int left, int top, int right, int bottom, int color1, int color2)
|
||||
protected void drawGradientRect(PoseStack poseStack, int left, int top, int right, int bottom, int color1, int color2)
|
||||
{
|
||||
GuiUtils.drawGradientRect(mStack.last().pose(), 0, left, top, right, bottom, color1, color2);
|
||||
GuiUtils.drawGradientRect(poseStack.last().pose(), 0, left, top, right, bottom, color1, color2);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -33,12 +33,12 @@ public class ExtendedButton extends Button
|
||||
* Draws this button to the screen.
|
||||
*/
|
||||
@Override
|
||||
public void renderButton(PoseStack mStack, int mouseX, int mouseY, float partial)
|
||||
public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float partialTick)
|
||||
{
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
int k = this.getYImage(this.isHovered);
|
||||
GuiUtils.drawContinuousTexturedBox(mStack, WIDGETS_LOCATION, this.x, this.y, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.getBlitOffset());
|
||||
this.renderBg(mStack, mc, mouseX, mouseY);
|
||||
GuiUtils.drawContinuousTexturedBox(poseStack, WIDGETS_LOCATION, this.x, this.y, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.getBlitOffset());
|
||||
this.renderBg(poseStack, mc, mouseX, mouseY);
|
||||
|
||||
Component buttonText = this.getMessage();
|
||||
int strWidth = mc.font.width(buttonText);
|
||||
@@ -48,6 +48,6 @@ public class ExtendedButton extends Button
|
||||
//TODO, srg names make it hard to figure out how to append to an ITextProperties from this trim operation, wraping this in StringTextComponent is kinda dirty.
|
||||
buttonText = new TextComponent(mc.font.substrByWidth(buttonText, width - 6 - ellipsisWidth).getString() + "...");
|
||||
|
||||
drawCenteredString(mStack, mc.font, buttonText, this.x + this.width / 2, this.y + (this.height - 8) / 2, getFGColor());
|
||||
drawCenteredString(poseStack, mc.font, buttonText, this.x + this.width / 2, this.y + (this.height - 8) / 2, getFGColor());
|
||||
}
|
||||
}
|
||||
@@ -57,9 +57,9 @@ public class ModListWidget extends ObjectSelectionList<ModListWidget.ModEntry>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderBackground(PoseStack mStack)
|
||||
protected void renderBackground(PoseStack poseStack)
|
||||
{
|
||||
this.parent.renderBackground(mStack);
|
||||
this.parent.renderBackground(poseStack);
|
||||
}
|
||||
|
||||
public class ModEntry extends ObjectSelectionList.Entry<ModEntry> {
|
||||
@@ -77,22 +77,22 @@ public class ModListWidget extends ObjectSelectionList<ModListWidget.ModEntry>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack pStack, int entryIdx, int top, int left, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean p_194999_5_, float partialTicks)
|
||||
public void render(PoseStack poseStack, int entryIdx, int top, int left, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean p_194999_5_, float partialTick)
|
||||
{
|
||||
Component name = new TextComponent(stripControlCodes(modInfo.getDisplayName()));
|
||||
Component version = new TextComponent(stripControlCodes(MavenVersionStringHelper.artifactVersionToString(modInfo.getVersion())));
|
||||
VersionChecker.CheckResult vercheck = VersionChecker.getResult(modInfo);
|
||||
Font font = this.parent.getFontRenderer();
|
||||
font.draw(pStack, Language.getInstance().getVisualOrder(FormattedText.composite(font.substrByWidth(name, listWidth))), left + 3, top + 2, 0xFFFFFF);
|
||||
font.draw(pStack, Language.getInstance().getVisualOrder(FormattedText.composite(font.substrByWidth(version, listWidth))), left + 3, top + 2 + font.lineHeight, 0xCCCCCC);
|
||||
font.draw(poseStack, Language.getInstance().getVisualOrder(FormattedText.composite(font.substrByWidth(name, listWidth))), left + 3, top + 2, 0xFFFFFF);
|
||||
font.draw(poseStack, Language.getInstance().getVisualOrder(FormattedText.composite(font.substrByWidth(version, listWidth))), left + 3, top + 2 + font.lineHeight, 0xCCCCCC);
|
||||
if (vercheck.status().shouldDraw())
|
||||
{
|
||||
//TODO: Consider adding more icons for visualization
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
RenderSystem.setShaderTexture(0, VERSION_CHECK_ICONS);
|
||||
pStack.pushPose();
|
||||
GuiComponent.blit(pStack, getLeft() + width - 12, top + entryHeight / 4, vercheck.status().getSheetOffset() * 8, (vercheck.status().isAnimated() && ((System.currentTimeMillis() / 800 & 1)) == 1) ? 8 : 0, 8, 8, 64, 16);
|
||||
pStack.popPose();
|
||||
poseStack.pushPose();
|
||||
GuiComponent.blit(poseStack, getLeft() + width - 12, top + entryHeight / 4, vercheck.status().getSheetOffset() * 8, (vercheck.status().isAnimated() && ((System.currentTimeMillis() / 800 & 1)) == 1) ? 8 : 0, 8, 8, 64, 16);
|
||||
poseStack.popPose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public class Slider extends ExtendedButton
|
||||
* Fired when the mouse button is dragged. Equivalent of MouseListener.mouseDragged(MouseEvent e).
|
||||
*/
|
||||
@Override
|
||||
protected void renderBg(PoseStack mStack, Minecraft par1Minecraft, int par2, int par3)
|
||||
protected void renderBg(PoseStack poseStack, Minecraft minecraft, int par2, int par3)
|
||||
{
|
||||
if (this.visible)
|
||||
{
|
||||
@@ -104,7 +104,7 @@ public class Slider extends ExtendedButton
|
||||
updateSlider();
|
||||
}
|
||||
|
||||
GuiUtils.drawContinuousTexturedBox(mStack, WIDGETS_LOCATION, this.x + (int)(this.sliderValue * (float)(this.width - 8)), this.y, 0, 66, 8, this.height, 200, 20, 2, 3, 2, 2, this.getBlitOffset());
|
||||
GuiUtils.drawContinuousTexturedBox(poseStack, WIDGETS_LOCATION, this.x + (int)(this.sliderValue * (float)(this.width - 8)), this.y, 0, 66, 8, this.height, 200, 20, 2, 3, 2, 2, this.getBlitOffset());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,15 +30,15 @@ public class UnicodeGlyphButton extends ExtendedButton
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack mStack, int mouseX, int mouseY, float partial)
|
||||
public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTick)
|
||||
{
|
||||
if (this.visible)
|
||||
{
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
this.isHovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
|
||||
int k = this.getYImage(this.isHovered);
|
||||
GuiUtils.drawContinuousTexturedBox(mStack, WIDGETS_LOCATION, this.x, this.y, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.getBlitOffset());
|
||||
this.renderBg(mStack, mc, mouseX, mouseY);
|
||||
GuiUtils.drawContinuousTexturedBox(poseStack, WIDGETS_LOCATION, this.x, this.y, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.getBlitOffset());
|
||||
this.renderBg(poseStack, mc, mouseX, mouseY);
|
||||
|
||||
Component buttonText = this.createNarrationMessage();
|
||||
int glyphWidth = (int) (mc.font.width(glyph) * glyphScale);
|
||||
@@ -52,14 +52,14 @@ public class UnicodeGlyphButton extends ExtendedButton
|
||||
strWidth = mc.font.width(buttonText);
|
||||
totalWidth = glyphWidth + strWidth;
|
||||
|
||||
mStack.pushPose();
|
||||
mStack.scale(glyphScale, glyphScale, 1.0F);
|
||||
this.drawCenteredString(mStack, mc.font, new TextComponent(glyph),
|
||||
poseStack.pushPose();
|
||||
poseStack.scale(glyphScale, glyphScale, 1.0F);
|
||||
this.drawCenteredString(poseStack, mc.font, new TextComponent(glyph),
|
||||
(int) (((this.x + (this.width / 2) - (strWidth / 2)) / glyphScale) - (glyphWidth / (2 * glyphScale)) + 2),
|
||||
(int) (((this.y + ((this.height - 8) / glyphScale) / 2) - 1) / glyphScale), getFGColor());
|
||||
mStack.popPose();
|
||||
poseStack.popPose();
|
||||
|
||||
this.drawCenteredString(mStack, mc.font, buttonText, (int) (this.x + (this.width / 2) + (glyphWidth / glyphScale)),
|
||||
this.drawCenteredString(poseStack, mc.font, buttonText, (int) (this.x + (this.width / 2) + (glyphWidth / glyphScale)),
|
||||
this.y + (this.height - 8) / 2, getFGColor());
|
||||
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ public class EarlyLoaderGUI {
|
||||
this.window = minecraft.getWindow();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void setupMatrix() {
|
||||
RenderSystem.clear(256, Minecraft.ON_OSX);
|
||||
GL11.glMatrixMode(5889);
|
||||
@@ -51,7 +50,6 @@ public class EarlyLoaderGUI {
|
||||
renderMessages();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
void renderTick() {
|
||||
if (handledElsewhere) return;
|
||||
// int guiScale = window.calculateScale(0, false);
|
||||
@@ -115,7 +113,6 @@ public class EarlyLoaderGUI {
|
||||
renderMessage(memory, memorycolour, 1, 1.0f);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
void renderMessage(final String message, final float[] colour, int line, float alpha) {
|
||||
// GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
|
||||
// ByteBuffer charBuffer = MemoryUtil.memAlloc(message.length() * 270);
|
||||
|
||||
@@ -112,8 +112,8 @@ public abstract class BakedModelWrapper<T extends BakedModel> implements BakedMo
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IModelData getModelData(@Nonnull BlockAndTintGetter world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData)
|
||||
public IModelData getModelData(@Nonnull BlockAndTintGetter level, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData modelData)
|
||||
{
|
||||
return originalModel.getModelData(world, pos, state, tileData);
|
||||
return originalModel.getModelData(level, pos, state, modelData);
|
||||
}
|
||||
}
|
||||
@@ -72,12 +72,12 @@ public class CompositeModel implements IDynamicBakedModel
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IModelData getModelData(@Nonnull BlockAndTintGetter world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData)
|
||||
public IModelData getModelData(@Nonnull BlockAndTintGetter level, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData modelData)
|
||||
{
|
||||
CompositeModelData composite = new CompositeModelData();
|
||||
for(Map.Entry<String, BakedModel> entry : bakedParts.entrySet())
|
||||
{
|
||||
composite.putSubmodelData(entry.getKey(), entry.getValue().getModelData(world, pos, state, ModelDataWrapper.wrap(tileData)));
|
||||
composite.putSubmodelData(entry.getKey(), entry.getValue().getModelData(level, pos, state, ModelDataWrapper.wrap(modelData)));
|
||||
}
|
||||
return composite;
|
||||
}
|
||||
|
||||
@@ -237,9 +237,9 @@ public final class DynamicBucketModel implements IModelGeometry<DynamicBucketMod
|
||||
}
|
||||
|
||||
@Override
|
||||
public BakedModel resolve(BakedModel originalModel, ItemStack stack, @Nullable ClientLevel world, @Nullable LivingEntity entity, int seed)
|
||||
public BakedModel resolve(BakedModel originalModel, ItemStack stack, @Nullable ClientLevel level, @Nullable LivingEntity entity, int seed)
|
||||
{
|
||||
BakedModel overriden = nested.resolve(originalModel, stack, world, entity, seed);
|
||||
BakedModel overriden = nested.resolve(originalModel, stack, level, entity, seed);
|
||||
if (overriden != originalModel) return overriden;
|
||||
return FluidUtil.getFluidContained(stack)
|
||||
.map(fluidStack -> {
|
||||
|
||||
@@ -37,13 +37,13 @@ public class ModelDataManager
|
||||
|
||||
private static final Map<ChunkPos, Map<BlockPos, IModelData>> modelDataCache = new ConcurrentHashMap<>();
|
||||
|
||||
private static void cleanCaches(Level world)
|
||||
private static void cleanCaches(Level level)
|
||||
{
|
||||
Preconditions.checkNotNull(world, "World must not be null");
|
||||
Preconditions.checkArgument(world == Minecraft.getInstance().level, "Cannot use model data for a world other than the current client world");
|
||||
if (world != currentLevel.get())
|
||||
Preconditions.checkNotNull(level, "Level must not be null");
|
||||
Preconditions.checkArgument(level == Minecraft.getInstance().level, "Cannot use model data for a level other than the current client level");
|
||||
if (level != currentLevel.get())
|
||||
{
|
||||
currentLevel = new WeakReference<>(world);
|
||||
currentLevel = new WeakReference<>(level);
|
||||
needModelDataRefresh.clear();
|
||||
modelDataCache.clear();
|
||||
}
|
||||
@@ -52,16 +52,16 @@ public class ModelDataManager
|
||||
public static void requestModelDataRefresh(BlockEntity te)
|
||||
{
|
||||
Preconditions.checkNotNull(te, "Tile entity must not be null");
|
||||
Level world = te.getLevel();
|
||||
Level level = te.getLevel();
|
||||
|
||||
cleanCaches(world);
|
||||
cleanCaches(level);
|
||||
needModelDataRefresh.computeIfAbsent(new ChunkPos(te.getBlockPos()), $ -> Collections.synchronizedSet(new HashSet<>()))
|
||||
.add(te.getBlockPos());
|
||||
}
|
||||
|
||||
private static void refreshModelData(Level world, ChunkPos chunk)
|
||||
private static void refreshModelData(Level level, ChunkPos chunk)
|
||||
{
|
||||
cleanCaches(world);
|
||||
cleanCaches(level);
|
||||
Set<BlockPos> needUpdate = needModelDataRefresh.remove(chunk);
|
||||
|
||||
if (needUpdate != null)
|
||||
@@ -69,7 +69,7 @@ public class ModelDataManager
|
||||
Map<BlockPos, IModelData> data = modelDataCache.computeIfAbsent(chunk, $ -> new ConcurrentHashMap<>());
|
||||
for (BlockPos pos : needUpdate)
|
||||
{
|
||||
BlockEntity toUpdate = world.getBlockEntity(pos);
|
||||
BlockEntity toUpdate = level.getBlockEntity(pos);
|
||||
if (toUpdate != null && !toUpdate.isRemoved())
|
||||
{
|
||||
data.put(pos, toUpdate.getModelData());
|
||||
@@ -92,15 +92,15 @@ public class ModelDataManager
|
||||
modelDataCache.remove(chunk);
|
||||
}
|
||||
|
||||
public static @Nullable IModelData getModelData(Level world, BlockPos pos)
|
||||
public static @Nullable IModelData getModelData(Level level, BlockPos pos)
|
||||
{
|
||||
return getModelData(world, new ChunkPos(pos)).get(pos);
|
||||
return getModelData(level, new ChunkPos(pos)).get(pos);
|
||||
}
|
||||
|
||||
public static Map<BlockPos, IModelData> getModelData(Level world, ChunkPos pos)
|
||||
public static Map<BlockPos, IModelData> getModelData(Level level, ChunkPos pos)
|
||||
{
|
||||
Preconditions.checkArgument(world.isClientSide, "Cannot request model data for server world");
|
||||
refreshModelData(world, pos);
|
||||
Preconditions.checkArgument(level.isClientSide, "Cannot request model data for server level");
|
||||
refreshModelData(level, pos);
|
||||
return modelDataCache.getOrDefault(pos, Collections.emptyMap());
|
||||
}
|
||||
}
|
||||
@@ -156,9 +156,9 @@ public class PerspectiveMapWrapper implements IDynamicBakedModel
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BakedModel resolve(BakedModel model, ItemStack stack, @Nullable ClientLevel worldIn, @Nullable LivingEntity entityIn, int seed)
|
||||
public BakedModel resolve(BakedModel model, ItemStack stack, @Nullable ClientLevel level, @Nullable LivingEntity entity, int seed)
|
||||
{
|
||||
model = parent.getOverrides().resolve(parent, stack, worldIn, entityIn, seed);
|
||||
model = parent.getOverrides().resolve(parent, stack, level, entity, seed);
|
||||
return new PerspectiveMapWrapper(model, transforms);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public class MultipartModelData implements IModelData
|
||||
{
|
||||
public static final ModelProperty<MultipartModelData> MULTIPART_DATA = new ModelProperty<>();
|
||||
|
||||
public static IModelData create(List<Pair<Predicate<BlockState>, BakedModel>> selectors, BlockAndTintGetter world, BlockPos pos, BlockState state, IModelData tileData)
|
||||
public static IModelData create(List<Pair<Predicate<BlockState>, BakedModel>> selectors, BlockAndTintGetter level, BlockPos pos, BlockState state, IModelData tileData)
|
||||
{
|
||||
MultipartModelData multipartData = new MultipartModelData(tileData);
|
||||
for (Pair<Predicate<BlockState>, BakedModel> selector : selectors)
|
||||
@@ -29,7 +29,7 @@ public class MultipartModelData implements IModelData
|
||||
if (selector.getLeft().test(state))
|
||||
{
|
||||
BakedModel part = selector.getRight();
|
||||
IModelData partData = part.getModelData(world, pos, state, tileData);
|
||||
IModelData partData = part.getModelData(level, pos, state, tileData);
|
||||
multipartData.setPartData(part, partData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
|
||||
|
||||
/**
|
||||
* Use a custom loader instead of the vanilla elements.
|
||||
* @param customLoaderFactory
|
||||
* @param customLoaderFactory function that returns the custom loader to set, given this and the {@link #existingFileHelper}
|
||||
* @return the custom loader builder
|
||||
*/
|
||||
public <L extends CustomLoaderBuilder<T>> L customLoader(BiFunction<T, ExistingFileHelper, L> customLoaderFactory)
|
||||
|
||||
+11
-11
@@ -37,7 +37,7 @@ public class ForgeBlockModelRenderer extends ModelBlockRenderer
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tesselateWithoutAO(BlockAndTintGetter world, BakedModel model, BlockState state, BlockPos pos, PoseStack matrixStack, VertexConsumer buffer, boolean checkSides, Random rand, long seed, int combinedOverlayIn, IModelData modelData)
|
||||
public boolean tesselateWithoutAO(BlockAndTintGetter level, BakedModel model, BlockState state, BlockPos pos, PoseStack poseStack, VertexConsumer buffer, boolean checkSides, Random rand, long seed, int packedOverlay, IModelData modelData)
|
||||
{
|
||||
if(ForgeConfig.CLIENT.experimentalForgeLightPipelineEnabled.get())
|
||||
{
|
||||
@@ -46,18 +46,18 @@ public class ForgeBlockModelRenderer extends ModelBlockRenderer
|
||||
|
||||
VertexLighterFlat lighter = lighterFlat.get();
|
||||
lighter.setParent(consumer);
|
||||
lighter.setTransform(matrixStack.last());
|
||||
lighter.setTransform(poseStack.last());
|
||||
|
||||
return render(lighter, world, model, state, pos, matrixStack, checkSides, rand, seed, modelData);
|
||||
return render(lighter, level, model, state, pos, poseStack, checkSides, rand, seed, modelData);
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.tesselateWithoutAO(world, model, state, pos, matrixStack, buffer, checkSides, rand, seed, combinedOverlayIn, modelData);
|
||||
return super.tesselateWithoutAO(level, model, state, pos, poseStack, buffer, checkSides, rand, seed, packedOverlay, modelData);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tesselateWithAO(BlockAndTintGetter world, BakedModel model, BlockState state, BlockPos pos, PoseStack matrixStack, VertexConsumer buffer, boolean checkSides, Random rand, long seed, int combinedOverlayIn, IModelData modelData)
|
||||
public boolean tesselateWithAO(BlockAndTintGetter level, BakedModel model, BlockState state, BlockPos pos, PoseStack poseStack, VertexConsumer buffer, boolean checkSides, Random rand, long seed, int packedOverlay, IModelData modelData)
|
||||
{
|
||||
if(ForgeConfig.CLIENT.experimentalForgeLightPipelineEnabled.get())
|
||||
{
|
||||
@@ -66,19 +66,19 @@ public class ForgeBlockModelRenderer extends ModelBlockRenderer
|
||||
|
||||
VertexLighterSmoothAo lighter = lighterSmooth.get();
|
||||
lighter.setParent(consumer);
|
||||
lighter.setTransform(matrixStack.last());
|
||||
lighter.setTransform(poseStack.last());
|
||||
|
||||
return render(lighter, world, model, state, pos, matrixStack, checkSides, rand, seed, modelData);
|
||||
return render(lighter, level, model, state, pos, poseStack, checkSides, rand, seed, modelData);
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.tesselateWithAO(world, model, state, pos, matrixStack, buffer, checkSides, rand, seed, combinedOverlayIn, modelData);
|
||||
return super.tesselateWithAO(level, model, state, pos, poseStack, buffer, checkSides, rand, seed, packedOverlay, modelData);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean render(VertexLighterFlat lighter, BlockAndTintGetter world, BakedModel model, BlockState state, BlockPos pos, PoseStack matrixStack, boolean checkSides, Random rand, long seed, IModelData modelData)
|
||||
public static boolean render(VertexLighterFlat lighter, BlockAndTintGetter level, BakedModel model, BlockState state, BlockPos pos, PoseStack poseStack, boolean checkSides, Random rand, long seed, IModelData modelData)
|
||||
{
|
||||
lighter.setWorld(world);
|
||||
lighter.setWorld(level);
|
||||
lighter.setState(state);
|
||||
lighter.setBlockPos(pos);
|
||||
boolean empty = true;
|
||||
@@ -99,7 +99,7 @@ public class ForgeBlockModelRenderer extends ModelBlockRenderer
|
||||
quads = model.getQuads(state, side, rand, modelData);
|
||||
if(!quads.isEmpty())
|
||||
{
|
||||
if(!checkSides || Block.shouldRenderFace(state, world, pos, side, pos.relative(side)))
|
||||
if(!checkSides || Block.shouldRenderFace(state, level, pos, side, pos.relative(side)))
|
||||
{
|
||||
if(empty) lighter.updateBlockInfo();
|
||||
empty = false;
|
||||
|
||||
@@ -295,9 +295,9 @@ public class VertexLighterFlat extends QuadGatheringTransformer
|
||||
this.diffuse = diffuse;
|
||||
}
|
||||
|
||||
public void setWorld(BlockAndTintGetter world)
|
||||
public void setWorld(BlockAndTintGetter level)
|
||||
{
|
||||
blockInfo.setLevel(world);
|
||||
blockInfo.setLevel(level);
|
||||
}
|
||||
|
||||
public void setState(BlockState state)
|
||||
|
||||
@@ -37,17 +37,17 @@ public class FarmlandWaterManager
|
||||
* <br>
|
||||
* If you don't want to water the region anymore, call {@link SimpleTicket#invalidate()}. Also call this
|
||||
* when the region this is unloaded (e.g. your TE is unloaded or the block is removed), and validate once it is loaded
|
||||
* @param world The world where the region should be marked. Only server-side worlds are allowed
|
||||
* @param level The level where the region should be marked. Only server-side worlds are allowed
|
||||
* @param ticket Your ticket you want to have registered
|
||||
* @param masterChunk The chunk pos that is controls when the ticket may be unloaded. The ticket should originate from here.
|
||||
* @param additionalChunks The chunks in that this ticket wants to operate as well.
|
||||
* @return The ticket for your requested region.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static<T extends SimpleTicket<Vec3>> T addCustomTicket(Level world, T ticket, ChunkPos masterChunk, ChunkPos... additionalChunks)
|
||||
public static<T extends SimpleTicket<Vec3>> T addCustomTicket(Level level, T ticket, ChunkPos masterChunk, ChunkPos... additionalChunks)
|
||||
{
|
||||
Preconditions.checkArgument(!world.isClientSide, "Water region is only determined server-side");
|
||||
Map<ChunkPos, ChunkTicketManager<Vec3>> ticketMap = customWaterHandler.computeIfAbsent(world, id -> new MapMaker().weakValues().makeMap());
|
||||
Preconditions.checkArgument(!level.isClientSide, "Water region is only determined server-side");
|
||||
Map<ChunkPos, ChunkTicketManager<Vec3>> ticketMap = customWaterHandler.computeIfAbsent(level, id -> new MapMaker().weakValues().makeMap());
|
||||
ChunkTicketManager<Vec3>[] additionalTickets = new ChunkTicketManager[additionalChunks.length];
|
||||
for (int i = 0; i < additionalChunks.length; i++)
|
||||
additionalTickets[i] = ticketMap.computeIfAbsent(additionalChunks[i], ChunkTicketManager::new);
|
||||
@@ -63,11 +63,11 @@ public class FarmlandWaterManager
|
||||
* when the region this is unloaded (e.g. your TE is unloaded or the block is removed), and validate once it is loaded
|
||||
* <br>
|
||||
* The AABB in the ticket is immutable
|
||||
* @param world The world where the region should be marked. Only server-side worlds are allowed
|
||||
* @param level The level where the region should be marked. Only server-side worlds are allowed
|
||||
* @param aabb The region where blocks should be watered
|
||||
* @return The ticket for your requested region.
|
||||
*/
|
||||
public static AABBTicket addAABBTicket(Level world, AABB aabb)
|
||||
public static AABBTicket addAABBTicket(Level level, AABB aabb)
|
||||
{
|
||||
if (DEBUG)
|
||||
LOGGER.info("FarmlandWaterManager: New AABBTicket, aabb={}", aabb);
|
||||
@@ -98,7 +98,7 @@ public class FarmlandWaterManager
|
||||
posSet.remove(masterPos);
|
||||
if (DEBUG)
|
||||
LOGGER.info("FarmlandWaterManager: {} center pos, {} dummy posses. Dist to center {}", masterPos, posSet.toArray(new ChunkPos[0]), masterDistance);
|
||||
return addCustomTicket(world, new AABBTicket(aabb), masterPos, posSet.toArray(new ChunkPos[0]));
|
||||
return addCustomTicket(level, new AABBTicket(aabb), masterPos, posSet.toArray(new ChunkPos[0]));
|
||||
}
|
||||
|
||||
private static double getDistanceSq(ChunkPos pos, Vec3 vec3d)
|
||||
@@ -112,12 +112,12 @@ public class FarmlandWaterManager
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if a block is in a region that is watered by blocks. This does not check vanilla water, see {@code net.minecraft.world.level.block.FarmBlock#isNearWater(LevelReader, BlockPos)}
|
||||
* Tests if a block is in a region that is watered by blocks. This does not check vanilla water, see {@code net.minecraft.level.level.block.FarmBlock#isNearWater(LevelReader, BlockPos)}
|
||||
* @return true if there is a ticket with an AABB that includes your block
|
||||
*/
|
||||
public static boolean hasBlockWaterTicket(LevelReader world, BlockPos pos)
|
||||
public static boolean hasBlockWaterTicket(LevelReader level, BlockPos pos)
|
||||
{
|
||||
ChunkTicketManager<Vec3> ticketManager = getTicketManager(new ChunkPos(pos.getX() >> 4, pos.getZ() >> 4), world);
|
||||
ChunkTicketManager<Vec3> ticketManager = getTicketManager(new ChunkPos(pos.getX() >> 4, pos.getZ() >> 4), level);
|
||||
if (ticketManager != null)
|
||||
{
|
||||
Vec3 posAsVec3d = new Vec3(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
|
||||
@@ -142,9 +142,9 @@ public class FarmlandWaterManager
|
||||
}
|
||||
}
|
||||
|
||||
private static ChunkTicketManager<Vec3> getTicketManager(ChunkPos pos, LevelReader world) {
|
||||
Preconditions.checkArgument(!world.isClientSide(), "Water region is only determined server-side");
|
||||
Map<ChunkPos, ChunkTicketManager<Vec3>> ticketMap = customWaterHandler.get(world);
|
||||
private static ChunkTicketManager<Vec3> getTicketManager(ChunkPos pos, LevelReader level) {
|
||||
Preconditions.checkArgument(!level.isClientSide(), "Water region is only determined server-side");
|
||||
Map<ChunkPos, ChunkTicketManager<Vec3>> ticketMap = customWaterHandler.get(level);
|
||||
if (ticketMap == null)
|
||||
{
|
||||
return null;
|
||||
|
||||
@@ -408,16 +408,20 @@ public class ForgeConfigSpec extends UnmodifiableConfigWrapper<UnmodifiableConfi
|
||||
public <V extends Enum<V>> EnumValue<V> defineEnum(List<String> path, V defaultValue, EnumGetMethod converter) {
|
||||
return defineEnum(path, defaultValue, converter, defaultValue.getDeclaringClass().getEnumConstants());
|
||||
}
|
||||
public <V extends Enum<V>> EnumValue<V> defineEnum(String path, V defaultValue, @SuppressWarnings("unchecked") V... acceptableValues) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public <V extends Enum<V>> EnumValue<V> defineEnum(String path, V defaultValue, V... acceptableValues) {
|
||||
return defineEnum(split(path), defaultValue, acceptableValues);
|
||||
}
|
||||
public <V extends Enum<V>> EnumValue<V> defineEnum(String path, V defaultValue, EnumGetMethod converter, @SuppressWarnings("unchecked") V... acceptableValues) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public <V extends Enum<V>> EnumValue<V> defineEnum(String path, V defaultValue, EnumGetMethod converter, V... acceptableValues) {
|
||||
return defineEnum(split(path), defaultValue, converter, acceptableValues);
|
||||
}
|
||||
public <V extends Enum<V>> EnumValue<V> defineEnum(List<String> path, V defaultValue, @SuppressWarnings("unchecked") V... acceptableValues) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public <V extends Enum<V>> EnumValue<V> defineEnum(List<String> path, V defaultValue, V... acceptableValues) {
|
||||
return defineEnum(path, defaultValue, (Collection<V>) Arrays.asList(acceptableValues));
|
||||
}
|
||||
public <V extends Enum<V>> EnumValue<V> defineEnum(List<String> path, V defaultValue, EnumGetMethod converter, @SuppressWarnings("unchecked") V... acceptableValues) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public <V extends Enum<V>> EnumValue<V> defineEnum(List<String> path, V defaultValue, EnumGetMethod converter, V... acceptableValues) {
|
||||
return defineEnum(path, defaultValue, converter, Arrays.asList(acceptableValues));
|
||||
}
|
||||
public <V extends Enum<V>> EnumValue<V> defineEnum(String path, V defaultValue, Collection<V> acceptableValues) {
|
||||
@@ -429,7 +433,6 @@ public class ForgeConfigSpec extends UnmodifiableConfigWrapper<UnmodifiableConfi
|
||||
public <V extends Enum<V>> EnumValue<V> defineEnum(List<String> path, V defaultValue, Collection<V> acceptableValues) {
|
||||
return defineEnum(path, defaultValue, EnumGetMethod.NAME_IGNORECASE, acceptableValues);
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
public <V extends Enum<V>> EnumValue<V> defineEnum(List<String> path, V defaultValue, EnumGetMethod converter, Collection<V> acceptableValues) {
|
||||
return defineEnum(path, defaultValue, converter, obj -> {
|
||||
if (obj instanceof Enum) {
|
||||
|
||||
@@ -216,7 +216,7 @@ public class ForgeHooks
|
||||
* Called when a player uses 'pick block', calls new Entity and Block hooks.
|
||||
*/
|
||||
@SuppressWarnings("resource")
|
||||
public static boolean onPickBlock(HitResult target, Player player, Level world)
|
||||
public static boolean onPickBlock(HitResult target, Player player, Level level)
|
||||
{
|
||||
ItemStack result = ItemStack.EMPTY;
|
||||
boolean isCreative = player.getAbilities().instabuild;
|
||||
@@ -225,15 +225,15 @@ public class ForgeHooks
|
||||
if (target.getType() == HitResult.Type.BLOCK)
|
||||
{
|
||||
BlockPos pos = ((BlockHitResult)target).getBlockPos();
|
||||
BlockState state = world.getBlockState(pos);
|
||||
BlockState state = level.getBlockState(pos);
|
||||
|
||||
if (state.isAir())
|
||||
return false;
|
||||
|
||||
if (isCreative && Screen.hasControlDown() && state.hasBlockEntity())
|
||||
te = world.getBlockEntity(pos);
|
||||
te = level.getBlockEntity(pos);
|
||||
|
||||
result = state.getCloneItemStack(target, world, pos, player);
|
||||
result = state.getCloneItemStack(target, level, pos, player);
|
||||
|
||||
if (result.isEmpty())
|
||||
LOGGER.warn("Picking on: [{}] {} gave null item", target.getType(), state.getBlock().getRegistryName());
|
||||
@@ -358,13 +358,13 @@ public class ForgeHooks
|
||||
return Math.max(0,event.getVisibilityModifier());
|
||||
}
|
||||
|
||||
public static Optional<BlockPos> isLivingOnLadder(@Nonnull BlockState state, @Nonnull Level world, @Nonnull BlockPos pos, @Nonnull LivingEntity entity)
|
||||
public static Optional<BlockPos> isLivingOnLadder(@Nonnull BlockState state, @Nonnull Level level, @Nonnull BlockPos pos, @Nonnull LivingEntity entity)
|
||||
{
|
||||
boolean isSpectator = (entity instanceof Player && entity.isSpectator());
|
||||
if (isSpectator) return Optional.empty();
|
||||
if (!ForgeConfig.SERVER.fullBoundingBoxLadders.get())
|
||||
{
|
||||
return state.isLadder(world, pos, entity) ? Optional.of(pos) : Optional.empty();
|
||||
return state.isLadder(level, pos, entity) ? Optional.of(pos) : Optional.empty();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -379,8 +379,8 @@ public class ForgeHooks
|
||||
for (int z2 = mZ; z2 < bb.maxZ; z2++)
|
||||
{
|
||||
BlockPos tmp = new BlockPos(x2, y2, z2);
|
||||
state = world.getBlockState(tmp);
|
||||
if (state.isLadder(world, tmp, entity))
|
||||
state = level.getBlockState(tmp);
|
||||
if (state.isLadder(level, tmp, entity))
|
||||
{
|
||||
return Optional.of(tmp);
|
||||
}
|
||||
@@ -508,12 +508,12 @@ public class ForgeHooks
|
||||
return ichat;
|
||||
}
|
||||
|
||||
public static int onBlockBreakEvent(Level world, GameType gameType, ServerPlayer entityPlayer, BlockPos pos)
|
||||
public static int onBlockBreakEvent(Level level, GameType gameType, ServerPlayer entityPlayer, BlockPos pos)
|
||||
{
|
||||
// Logic from tryHarvestBlock for pre-canceling the event
|
||||
boolean preCancelEvent = false;
|
||||
ItemStack itemstack = entityPlayer.getMainHandItem();
|
||||
if (!itemstack.isEmpty() && !itemstack.getItem().canAttackBlock(world.getBlockState(pos), world, pos, entityPlayer))
|
||||
if (!itemstack.isEmpty() && !itemstack.getItem().canAttackBlock(level.getBlockState(pos), level, pos, entityPlayer))
|
||||
{
|
||||
preCancelEvent = true;
|
||||
}
|
||||
@@ -525,20 +525,20 @@ public class ForgeHooks
|
||||
|
||||
if (!entityPlayer.mayBuild())
|
||||
{
|
||||
if (itemstack.isEmpty() || !itemstack.hasAdventureModeBreakTagForBlock(world.getTagManager(), new BlockInWorld(world, pos, false)))
|
||||
if (itemstack.isEmpty() || !itemstack.hasAdventureModeBreakTagForBlock(level.getTagManager(), new BlockInWorld(level, pos, false)))
|
||||
preCancelEvent = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Tell client the block is gone immediately then process events
|
||||
if (world.getBlockEntity(pos) == null)
|
||||
if (level.getBlockEntity(pos) == null)
|
||||
{
|
||||
entityPlayer.connection.send(new ClientboundBlockUpdatePacket(pos, world.getFluidState(pos).createLegacyBlock()));
|
||||
entityPlayer.connection.send(new ClientboundBlockUpdatePacket(pos, level.getFluidState(pos).createLegacyBlock()));
|
||||
}
|
||||
|
||||
// Post the block break event
|
||||
BlockState state = world.getBlockState(pos);
|
||||
BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(world, pos, state, entityPlayer);
|
||||
BlockState state = level.getBlockState(pos);
|
||||
BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(level, pos, state, entityPlayer);
|
||||
event.setCanceled(preCancelEvent);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
|
||||
@@ -546,10 +546,10 @@ public class ForgeHooks
|
||||
if (event.isCanceled())
|
||||
{
|
||||
// Let the client know the block still exists
|
||||
entityPlayer.connection.send(new ClientboundBlockUpdatePacket(world, pos));
|
||||
entityPlayer.connection.send(new ClientboundBlockUpdatePacket(level, pos));
|
||||
|
||||
// Update any tile entity data for this block
|
||||
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||
BlockEntity blockEntity = level.getBlockEntity(pos);
|
||||
if (blockEntity != null)
|
||||
{
|
||||
Packet<?> pkt = blockEntity.getUpdatePacket();
|
||||
@@ -565,10 +565,10 @@ public class ForgeHooks
|
||||
public static InteractionResult onPlaceItemIntoWorld(@Nonnull UseOnContext context)
|
||||
{
|
||||
ItemStack itemstack = context.getItemInHand();
|
||||
Level world = context.getLevel();
|
||||
Level level = context.getLevel();
|
||||
|
||||
Player player = context.getPlayer();
|
||||
if (player != null && !player.getAbilities().mayBuild && !itemstack.hasAdventureModePlaceTagForBlock(world.getTagManager(), new BlockInWorld(world, context.getClickedPos(), false)))
|
||||
if (player != null && !player.getAbilities().mayBuild && !itemstack.hasAdventureModePlaceTagForBlock(level.getTagManager(), new BlockInWorld(level, context.getClickedPos(), false)))
|
||||
return InteractionResult.PASS;
|
||||
|
||||
// handle all placement events here
|
||||
@@ -579,14 +579,14 @@ public class ForgeHooks
|
||||
nbt = itemstack.getTag().copy();
|
||||
|
||||
if (!(itemstack.getItem() instanceof BucketItem)) // if not bucket
|
||||
world.captureBlockSnapshots = true;
|
||||
level.captureBlockSnapshots = true;
|
||||
|
||||
ItemStack copy = itemstack.copy();
|
||||
InteractionResult ret = itemstack.getItem().useOn(context);
|
||||
if (itemstack.isEmpty())
|
||||
ForgeEventFactory.onPlayerDestroyItem(player, copy, context.getHand());
|
||||
|
||||
world.captureBlockSnapshots = false;
|
||||
level.captureBlockSnapshots = false;
|
||||
|
||||
if (ret.consumesAction())
|
||||
{
|
||||
@@ -598,8 +598,8 @@ public class ForgeHooks
|
||||
newNBT = itemstack.getTag().copy();
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
List<BlockSnapshot> blockSnapshots = (List<BlockSnapshot>)world.capturedBlockSnapshots.clone();
|
||||
world.capturedBlockSnapshots.clear();
|
||||
List<BlockSnapshot> blockSnapshots = (List<BlockSnapshot>)level.capturedBlockSnapshots.clone();
|
||||
level.capturedBlockSnapshots.clear();
|
||||
|
||||
// make sure to set pre-placement item data for event
|
||||
itemstack.setCount(size);
|
||||
@@ -623,9 +623,9 @@ public class ForgeHooks
|
||||
// revert back all captured blocks
|
||||
for (BlockSnapshot blocksnapshot : Lists.reverse(blockSnapshots))
|
||||
{
|
||||
world.restoringBlockSnapshots = true;
|
||||
level.restoringBlockSnapshots = true;
|
||||
blocksnapshot.restore(true, false);
|
||||
world.restoringBlockSnapshots = false;
|
||||
level.restoringBlockSnapshots = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -638,16 +638,16 @@ public class ForgeHooks
|
||||
{
|
||||
int updateFlag = snap.getFlag();
|
||||
BlockState oldBlock = snap.getReplacedBlock();
|
||||
BlockState newBlock = world.getBlockState(snap.getPos());
|
||||
newBlock.onPlace(world, snap.getPos(), oldBlock, false);
|
||||
BlockState newBlock = level.getBlockState(snap.getPos());
|
||||
newBlock.onPlace(level, snap.getPos(), oldBlock, false);
|
||||
|
||||
world.markAndNotifyBlock(snap.getPos(), world.getChunkAt(snap.getPos()), oldBlock, newBlock, updateFlag, 512);
|
||||
level.markAndNotifyBlock(snap.getPos(), level.getChunkAt(snap.getPos()), oldBlock, newBlock, updateFlag, 512);
|
||||
}
|
||||
if (player != null)
|
||||
player.awardStat(Stats.ITEM_USED.get(item));
|
||||
}
|
||||
}
|
||||
world.capturedBlockSnapshots.clear();
|
||||
level.capturedBlockSnapshots.clear();
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -973,16 +973,16 @@ public class ForgeHooks
|
||||
return ctx.validateEntryName(name);
|
||||
}
|
||||
|
||||
public static boolean onCropsGrowPre(Level worldIn, BlockPos pos, BlockState state, boolean def)
|
||||
public static boolean onCropsGrowPre(Level level, BlockPos pos, BlockState state, boolean def)
|
||||
{
|
||||
BlockEvent ev = new BlockEvent.CropGrowEvent.Pre(worldIn,pos,state);
|
||||
BlockEvent ev = new BlockEvent.CropGrowEvent.Pre(level,pos,state);
|
||||
MinecraftForge.EVENT_BUS.post(ev);
|
||||
return (ev.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (ev.getResult() == net.minecraftforge.eventbus.api.Event.Result.DEFAULT && def));
|
||||
}
|
||||
|
||||
public static void onCropsGrowPost(Level worldIn, BlockPos pos, BlockState state)
|
||||
public static void onCropsGrowPost(Level level, BlockPos pos, BlockState state)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new BlockEvent.CropGrowEvent.Post(worldIn, pos, state, worldIn.getBlockState(pos)));
|
||||
MinecraftForge.EVENT_BUS.post(new BlockEvent.CropGrowEvent.Post(level, pos, state, level.getBlockState(pos)));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1057,19 +1057,19 @@ public class ForgeHooks
|
||||
return modId;
|
||||
}
|
||||
|
||||
public static boolean onFarmlandTrample(Level world, BlockPos pos, BlockState state, float fallDistance, Entity entity)
|
||||
public static boolean onFarmlandTrample(Level level, BlockPos pos, BlockState state, float fallDistance, Entity entity)
|
||||
{
|
||||
if (entity.canTrample(state, pos, fallDistance))
|
||||
{
|
||||
BlockEvent.FarmlandTrampleEvent event = new BlockEvent.FarmlandTrampleEvent(world, pos, state, fallDistance, entity);
|
||||
BlockEvent.FarmlandTrampleEvent event = new BlockEvent.FarmlandTrampleEvent(level, pos, state, fallDistance, entity);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return !event.isCanceled();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int onNoteChange(Level world, BlockPos pos, BlockState state, int old, int _new) {
|
||||
NoteBlockEvent.Change event = new NoteBlockEvent.Change(world, pos, state, old, _new);
|
||||
public static int onNoteChange(Level level, BlockPos pos, BlockState state, int old, int _new) {
|
||||
NoteBlockEvent.Change event = new NoteBlockEvent.Change(level, pos, state, old, _new);
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
return -1;
|
||||
return event.getVanillaNoteId();
|
||||
@@ -1124,10 +1124,10 @@ public class ForgeHooks
|
||||
return id;
|
||||
}
|
||||
|
||||
public static boolean canEntityDestroy(Level world, BlockPos pos, LivingEntity entity)
|
||||
public static boolean canEntityDestroy(Level level, BlockPos pos, LivingEntity entity)
|
||||
{
|
||||
BlockState state = world.getBlockState(pos);
|
||||
return ForgeEventFactory.getMobGriefingEvent(world, entity) && state.canEntityDestroy(world, pos, entity) && ForgeEventFactory.onEntityDestroyBlock(entity, pos, state);
|
||||
BlockState state = level.getBlockState(pos);
|
||||
return ForgeEventFactory.getMobGriefingEvent(level, entity) && state.canEntityDestroy(level, pos, entity) && ForgeEventFactory.onEntityDestroyBlock(entity, pos, state);
|
||||
}
|
||||
|
||||
private static final Map<IRegistryDelegate<Item>, Integer> VANILLA_BURNS = new HashMap<>();
|
||||
|
||||
@@ -31,11 +31,11 @@ public interface IForgeShearable
|
||||
* Example: Sheep return false when they have no wool
|
||||
*
|
||||
* @param item The ItemStack that is being used, may be empty.
|
||||
* @param world The current world.
|
||||
* @param pos Block's position in world.
|
||||
* @param level The current level.
|
||||
* @param pos Block's position in level.
|
||||
* @return If this is shearable, and onSheared should be called.
|
||||
*/
|
||||
default boolean isShearable(@Nonnull ItemStack item, Level world, BlockPos pos)
|
||||
default boolean isShearable(@Nonnull ItemStack item, Level level, BlockPos pos)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -53,13 +53,13 @@ public interface IForgeShearable
|
||||
* over the values passed into this function.
|
||||
*
|
||||
* @param item The ItemStack that is being used, may be empty.
|
||||
* @param world The current world.
|
||||
* @param pos If this is a block, the block's position in world.
|
||||
* @param level The current level.
|
||||
* @param pos If this is a block, the block's position in level.
|
||||
* @param fortune The fortune level of the shears being used.
|
||||
* @return A List containing all items from this shearing. May be empty.
|
||||
*/
|
||||
@Nonnull
|
||||
default List<ItemStack> onSheared(@Nullable Player player, @Nonnull ItemStack item, Level world, BlockPos pos, int fortune)
|
||||
default List<ItemStack> onSheared(@Nullable Player player, @Nonnull ItemStack item, Level level, BlockPos pos, int fortune)
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import net.minecraft.world.level.BlockGetter;
|
||||
|
||||
public interface IPlantable
|
||||
{
|
||||
default PlantType getPlantType(BlockGetter world, BlockPos pos) {
|
||||
default PlantType getPlantType(BlockGetter level, BlockPos pos) {
|
||||
if (this instanceof CropBlock) return PlantType.CROP;
|
||||
if (this instanceof SaplingBlock) return PlantType.PLAINS;
|
||||
if (this instanceof FlowerBlock) return PlantType.PLAINS;
|
||||
@@ -28,5 +28,5 @@ public interface IPlantable
|
||||
return net.minecraftforge.common.PlantType.PLAINS;
|
||||
}
|
||||
|
||||
BlockState getPlant(BlockGetter world, BlockPos pos);
|
||||
BlockState getPlant(BlockGetter level, BlockPos pos);
|
||||
}
|
||||
@@ -90,12 +90,11 @@ public class ExistingFileHelper {
|
||||
* <p>
|
||||
* Only create a new helper if you intentionally want to ignore the existence of
|
||||
* other generated files.
|
||||
*
|
||||
* @param existingPacks
|
||||
* @param existingMods
|
||||
* @param enable
|
||||
* @param assetIndex
|
||||
* @param assetsDir
|
||||
* @param existingPacks a collection of paths to existing packs
|
||||
* @param existingMods a set of mod IDs for existing mods
|
||||
* @param enable {@code true} if validation is enabled
|
||||
* @param assetIndex the identifier for the asset index, generally Minecraft's current major version
|
||||
* @param assetsDir the directory in which to find vanilla assets and indexes
|
||||
*/
|
||||
public ExistingFileHelper(Collection<Path> existingPacks, final Set<String> existingMods, boolean enable, @Nullable final String assetIndex, @Nullable final File assetsDir) {
|
||||
this.clientResources = new SimpleReloadableResourceManager(PackType.CLIENT_RESOURCES);
|
||||
|
||||
@@ -113,8 +113,6 @@ public interface IForgeAbstractMinecart
|
||||
* functions differs from getMaxCartSpeedOnRail() in that it controls
|
||||
* current movement and cannot be overridden. The value however can never be
|
||||
* higher than getMaxCartSpeedOnRail().
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
float getCurrentCartSpeedCapOnRail();
|
||||
void setCurrentCartSpeedCapOnRail(float value);
|
||||
|
||||
@@ -20,20 +20,20 @@ public interface IForgeBaseRailBlock
|
||||
/**
|
||||
* Return true if the rail can make corners.
|
||||
* Used by placement logic.
|
||||
* @param world The world.
|
||||
* @param pos Block's position in world
|
||||
* @param level The level.
|
||||
* @param pos Block's position in level
|
||||
* @return True if the rail can make corners.
|
||||
*/
|
||||
boolean isFlexibleRail(BlockState state, BlockGetter world, BlockPos pos);
|
||||
boolean isFlexibleRail(BlockState state, BlockGetter level, BlockPos pos);
|
||||
|
||||
/**
|
||||
* Returns true if the rail can make up and down slopes.
|
||||
* Used by placement logic.
|
||||
* @param world The world.
|
||||
* @param pos Block's position in world
|
||||
* @param level The level.
|
||||
* @param pos Block's position in level
|
||||
* @return True if the rail can make slopes.
|
||||
*/
|
||||
default boolean canMakeSlopes(BlockState state, BlockGetter world, BlockPos pos)
|
||||
default boolean canMakeSlopes(BlockState state, BlockGetter level, BlockPos pos)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -44,22 +44,22 @@ public interface IForgeBaseRailBlock
|
||||
* for example when making diamond junctions or switches.
|
||||
* The cart parameter will often be null unless it it called from EntityMinecart.
|
||||
*
|
||||
* @param world The world.
|
||||
* @param pos Block's position in world
|
||||
* @param level The level.
|
||||
* @param pos Block's position in level
|
||||
* @param state The BlockState
|
||||
* @param cart The cart asking for the metadata, null if it is not called by EntityMinecart.
|
||||
* @return The direction.
|
||||
*/
|
||||
RailShape getRailDirection(BlockState state, BlockGetter world, BlockPos pos, @Nullable AbstractMinecart cart);
|
||||
RailShape getRailDirection(BlockState state, BlockGetter level, BlockPos pos, @Nullable AbstractMinecart cart);
|
||||
|
||||
/**
|
||||
* Returns the max speed of the rail at the specified position.
|
||||
* @param world The world.
|
||||
* @param level The level.
|
||||
* @param cart The cart on the rail, may be null.
|
||||
* @param pos Block's position in world
|
||||
* @param pos Block's position in level
|
||||
* @return The max speed of the current rail.
|
||||
*/
|
||||
default float getRailMaxSpeed(BlockState state, Level world, BlockPos pos, AbstractMinecart cart)
|
||||
default float getRailMaxSpeed(BlockState state, Level level, BlockPos pos, AbstractMinecart cart)
|
||||
{
|
||||
return 0.4f;
|
||||
}
|
||||
@@ -67,9 +67,9 @@ public interface IForgeBaseRailBlock
|
||||
/**
|
||||
* This function is called by any minecart that passes over this rail.
|
||||
* It is called once per update tick that the minecart is on the rail.
|
||||
* @param world The world.
|
||||
* @param level The level.
|
||||
* @param cart The cart on the rail.
|
||||
* @param pos Block's position in world
|
||||
* @param pos Block's position in level
|
||||
*/
|
||||
default void onMinecartPass(BlockState state, Level world, BlockPos pos, AbstractMinecart cart){}
|
||||
default void onMinecartPass(BlockState state, Level level, BlockPos pos, AbstractMinecart cart){}
|
||||
}
|
||||
@@ -63,12 +63,12 @@ public interface IForgeBlock
|
||||
* {@link FishingHook} uses {@code .92}.
|
||||
*
|
||||
* @param state state of the block
|
||||
* @param world the world
|
||||
* @param pos the position in the world
|
||||
* @param level the level
|
||||
* @param pos the position in the level
|
||||
* @param entity the entity in question
|
||||
* @return the factor by which the entity's motion should be multiplied
|
||||
*/
|
||||
default float getFriction(BlockState state, LevelReader world, BlockPos pos, @Nullable Entity entity)
|
||||
default float getFriction(BlockState state, LevelReader level, BlockPos pos, @Nullable Entity entity)
|
||||
{
|
||||
return self().getFriction();
|
||||
}
|
||||
@@ -76,12 +76,9 @@ public interface IForgeBlock
|
||||
/**
|
||||
* Get a light value for this block, taking into account the given state and coordinates, normal ranges are between 0 and 15
|
||||
*
|
||||
* @param state
|
||||
* @param world
|
||||
* @param pos
|
||||
* @return The light value
|
||||
*/
|
||||
default int getLightEmission(BlockState state, BlockGetter world, BlockPos pos)
|
||||
default int getLightEmission(BlockState state, BlockGetter level, BlockPos pos)
|
||||
{
|
||||
return state.getLightEmission();
|
||||
}
|
||||
@@ -90,12 +87,12 @@ public interface IForgeBlock
|
||||
* Checks if a player or entity can use this block to 'climb' like a ladder.
|
||||
*
|
||||
* @param state The current state
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param entity The entity trying to use the ladder, CAN be null.
|
||||
* @return True if the block should act like a ladder
|
||||
*/
|
||||
default boolean isLadder(BlockState state, LevelReader world, BlockPos pos, LivingEntity entity)
|
||||
default boolean isLadder(BlockState state, LevelReader level, BlockPos pos, LivingEntity entity)
|
||||
{
|
||||
return state.is(BlockTags.CLIMBABLE);
|
||||
}
|
||||
@@ -104,12 +101,12 @@ public interface IForgeBlock
|
||||
* Checks if this block makes an open trapdoor above it climbable.
|
||||
*
|
||||
* @param state The current state
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param trapdoorState The current state of the open trapdoor above
|
||||
* @return True if the block should act like a ladder
|
||||
*/
|
||||
default boolean makesOpenTrapdoorAboveClimbable(BlockState state, LevelReader world, BlockPos pos, BlockState trapdoorState)
|
||||
default boolean makesOpenTrapdoorAboveClimbable(BlockState state, LevelReader level, BlockPos pos, BlockState trapdoorState)
|
||||
{
|
||||
return state.getBlock() instanceof LadderBlock && state.getValue(LadderBlock.FACING) == trapdoorState.getValue(TrapDoorBlock.FACING);
|
||||
}
|
||||
@@ -118,11 +115,11 @@ public interface IForgeBlock
|
||||
* Determines if this block should set fire and deal fire damage
|
||||
* to entities coming into contact with it.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @return True if the block should deal damage
|
||||
*/
|
||||
default boolean isBurning(BlockState state, BlockGetter world, BlockPos pos)
|
||||
default boolean isBurning(BlockState state, BlockGetter level, BlockPos pos)
|
||||
{
|
||||
return this == Blocks.FIRE || this == Blocks.LAVA;
|
||||
}
|
||||
@@ -130,12 +127,12 @@ public interface IForgeBlock
|
||||
/**
|
||||
* Determines if the player can harvest this block, obtaining it's drops when the block is destroyed.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param level The current level
|
||||
* @param pos The block's current position
|
||||
* @param player The player damaging the block
|
||||
* @return True to spawn the drops
|
||||
*/
|
||||
default public boolean canHarvestBlock(BlockState state, BlockGetter world, BlockPos pos, Player player)
|
||||
default public boolean canHarvestBlock(BlockState state, BlockGetter level, BlockPos pos, Player player)
|
||||
{
|
||||
return ForgeHooks.isCorrectToolForDrops(state, player);
|
||||
}
|
||||
@@ -152,18 +149,18 @@ public interface IForgeBlock
|
||||
* server sides!
|
||||
*
|
||||
* @param state The current state.
|
||||
* @param world The current world
|
||||
* @param level The current level
|
||||
* @param player The player damaging the block, may be null
|
||||
* @param pos Block position in world
|
||||
* @param pos Block position in level
|
||||
* @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 onDestroyedByPlayer(BlockState state, Level world, BlockPos pos, Player player, boolean willHarvest, FluidState fluid)
|
||||
default boolean onDestroyedByPlayer(BlockState state, Level level, BlockPos pos, Player player, boolean willHarvest, FluidState fluid)
|
||||
{
|
||||
self().playerWillDestroy(world, pos, state, player);
|
||||
return world.setBlock(pos, fluid.createLegacyBlock(), world.isClientSide ? 11 : 3);
|
||||
self().playerWillDestroy(level, pos, state, player);
|
||||
return level.setBlock(pos, fluid.createLegacyBlock(), level.isClientSide ? 11 : 3);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -172,12 +169,12 @@ public interface IForgeBlock
|
||||
* perform the sleeping functionality in it's activated event.
|
||||
*
|
||||
* @param state The current state
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param player The player or camera entity, null in some cases.
|
||||
* @return True to treat this as a bed
|
||||
*/
|
||||
default boolean isBed(BlockState state, BlockGetter world, BlockPos pos, @Nullable Entity player)
|
||||
default boolean isBed(BlockState state, BlockGetter level, BlockPos pos, @Nullable Entity player)
|
||||
{
|
||||
return self() instanceof BedBlock; //TODO: Forge: Keep isBed function?
|
||||
}
|
||||
@@ -188,17 +185,17 @@ public interface IForgeBlock
|
||||
*
|
||||
* @param state The current state
|
||||
* @param type The entity type used when checking if a dismount blockstate is dangerous. Currently always PLAYER.
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param levelReader The current level
|
||||
* @param pos Block position in level
|
||||
* @param orientation The angle the entity had when setting the respawn point
|
||||
* @param entity The entity respawning, often null
|
||||
* @return The spawn position or the empty optional if respawning here is not possible
|
||||
*/
|
||||
default Optional<Vec3> getRespawnPosition(BlockState state, EntityType<?> type, LevelReader world, BlockPos pos, float orientation, @Nullable LivingEntity entity)
|
||||
default Optional<Vec3> getRespawnPosition(BlockState state, EntityType<?> type, LevelReader levelReader, BlockPos pos, float orientation, @Nullable LivingEntity entity)
|
||||
{
|
||||
if (isBed(state, world, pos, entity) && world instanceof Level level && BedBlock.canSetSpawn(level))
|
||||
if (isBed(state, levelReader, pos, entity) && levelReader instanceof Level level && BedBlock.canSetSpawn(level))
|
||||
{
|
||||
return BedBlock.findStandUpPosition(type, world, pos, orientation);
|
||||
return BedBlock.findStandUpPosition(type, levelReader, pos, orientation);
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
@@ -208,28 +205,27 @@ public interface IForgeBlock
|
||||
* prevent any mob from spawning on the block.
|
||||
*
|
||||
* @param state The current state
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param type The Mob Category Type
|
||||
* @return True to allow a mob of the specified category to spawn, false to prevent it.
|
||||
*/
|
||||
default boolean isValidSpawn(BlockState state, BlockGetter world, BlockPos pos, SpawnPlacements.Type type, EntityType<?> entityType)
|
||||
default boolean isValidSpawn(BlockState state, BlockGetter level, BlockPos pos, SpawnPlacements.Type type, EntityType<?> entityType)
|
||||
{
|
||||
return state.isValidSpawn(world, pos, entityType);
|
||||
return state.isValidSpawn(level, pos, entityType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a user either starts or stops sleeping in the bed.
|
||||
*
|
||||
* @param state
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param sleeper The sleeper or camera entity, null in some cases.
|
||||
* @param occupied True if we are occupying the bed, or false if they are stopping use of the bed
|
||||
*/
|
||||
default void setBedOccupied(BlockState state, Level world, BlockPos pos, LivingEntity sleeper, boolean occupied)
|
||||
default void setBedOccupied(BlockState state, Level level, BlockPos pos, LivingEntity sleeper, boolean occupied)
|
||||
{
|
||||
world.setBlock(pos, state.setValue(BedBlock.OCCUPIED, occupied), 3);
|
||||
level.setBlock(pos, state.setValue(BedBlock.OCCUPIED, occupied), 3);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -237,11 +233,11 @@ public interface IForgeBlock
|
||||
* are returned by BlockDirectional. Called every frame tick for every living entity. Be VERY fast.
|
||||
*
|
||||
* @param state The current state
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @return Bed direction
|
||||
*/
|
||||
default Direction getBedDirection(BlockState state, LevelReader world, BlockPos pos)
|
||||
default Direction getBedDirection(BlockState state, LevelReader level, BlockPos pos)
|
||||
{
|
||||
return state.getValue(HorizontalDirectionalBlock.FACING);
|
||||
}
|
||||
@@ -249,12 +245,12 @@ public interface IForgeBlock
|
||||
/**
|
||||
* Location sensitive version of getExplosionResistance
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param explosion The explosion
|
||||
* @return The amount of the explosion absorbed.
|
||||
*/
|
||||
default float getExplosionResistance(BlockState state, BlockGetter world, BlockPos pos, Explosion explosion)
|
||||
default float getExplosionResistance(BlockState state, BlockGetter level, BlockPos pos, Explosion explosion)
|
||||
{
|
||||
return self().getExplosionResistance();
|
||||
}
|
||||
@@ -266,9 +262,9 @@ public interface IForgeBlock
|
||||
* @param target The full target the player is looking at
|
||||
* @return A ItemStack to add to the player's inventory, empty itemstack if nothing should be added.
|
||||
*/
|
||||
default ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter world, BlockPos pos, Player player)
|
||||
default ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter level, BlockPos pos, Player player)
|
||||
{
|
||||
return self().getCloneItemStack(world, pos, state);
|
||||
return self().getCloneItemStack(level, pos, state);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -276,14 +272,14 @@ public interface IForgeBlock
|
||||
* particles, this is a server side method that spawns particles with
|
||||
* WorldServer.spawnParticle.
|
||||
*
|
||||
* @param worldserver The current Server World
|
||||
* @param level The current server level
|
||||
* @param pos The position of the block.
|
||||
* @param state2 The state at the specific world/pos
|
||||
* @param state2 The state at the specific level/pos
|
||||
* @param entity The entity that hit landed on the block
|
||||
* @param numberOfParticles That vanilla world have spawned
|
||||
* @param numberOfParticles That vanilla level have spawned
|
||||
* @return True to prevent vanilla landing particles from spawning
|
||||
*/
|
||||
default boolean addLandingEffects(BlockState state1, ServerLevel worldserver, BlockPos pos, BlockState state2, LivingEntity entity, int numberOfParticles)
|
||||
default boolean addLandingEffects(BlockState state1, ServerLevel level, BlockPos pos, BlockState state2, LivingEntity entity, int numberOfParticles)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -295,12 +291,12 @@ public interface IForgeBlock
|
||||
* By default vanilla spawns particles only on the client and the server methods no-op.
|
||||
*
|
||||
* @param state The BlockState the entity is running on.
|
||||
* @param world The world.
|
||||
* @param level The level.
|
||||
* @param pos The position at the entities feet.
|
||||
* @param entity The entity running on the block.
|
||||
* @return True to prevent vanilla running particles from spawning.
|
||||
*/
|
||||
default boolean addRunningEffects(BlockState state, Level world, BlockPos pos, Entity entity)
|
||||
default boolean addRunningEffects(BlockState state, Level level, BlockPos pos, Entity entity)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -317,24 +313,24 @@ public interface IForgeBlock
|
||||
* Water check if its still water
|
||||
*
|
||||
* @param state The Current state
|
||||
* @param world The current world
|
||||
* @param level The current level
|
||||
*
|
||||
* @param facing The direction relative to the given position the plant wants to be, typically its UP
|
||||
* @param plantable The plant that wants to check
|
||||
* @return True to allow the plant to be planted/stay.
|
||||
*/
|
||||
boolean canSustainPlant(BlockState state, BlockGetter world, BlockPos pos, Direction facing, IPlantable plantable);
|
||||
boolean canSustainPlant(BlockState state, BlockGetter level, BlockPos pos, Direction facing, IPlantable plantable);
|
||||
|
||||
/**
|
||||
* Checks if this soil is fertile, typically this means that growth rates
|
||||
* of plants on this soil will be slightly sped up.
|
||||
* Only vanilla case is tilledField when it is within range of water.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @return True if the soil should be considered fertile.
|
||||
*/
|
||||
default boolean isFertile(BlockState state, BlockGetter world, BlockPos pos)
|
||||
default boolean isFertile(BlockState state, BlockGetter level, BlockPos pos)
|
||||
{
|
||||
if (state.is(Blocks.FARMLAND))
|
||||
return state.getValue(FarmBlock.MOISTURE) > 0;
|
||||
@@ -345,12 +341,12 @@ public interface IForgeBlock
|
||||
/**
|
||||
* Determines if this block can be used as the frame of a conduit.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param conduit Conduit position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param conduit Conduit position in level
|
||||
* @return True, to support the conduit, and make it active with this block.
|
||||
*/
|
||||
default boolean isConduitFrame(BlockState state, LevelReader world, BlockPos pos, BlockPos conduit)
|
||||
default boolean isConduitFrame(BlockState state, LevelReader level, BlockPos pos, BlockPos conduit)
|
||||
{
|
||||
return state.getBlock() == Blocks.PRISMARINE ||
|
||||
state.getBlock() == Blocks.PRISMARINE_BRICKS ||
|
||||
@@ -362,11 +358,11 @@ public interface IForgeBlock
|
||||
* Determines if this block can be used as part of a frame of a nether portal.
|
||||
*
|
||||
* @param state The current state
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @return True, to support being part of a nether portal frame, false otherwise.
|
||||
*/
|
||||
default boolean isPortalFrame(BlockState state, BlockGetter world, BlockPos pos)
|
||||
default boolean isPortalFrame(BlockState state, BlockGetter level, BlockPos pos)
|
||||
{
|
||||
return state.is(Blocks.OBSIDIAN);
|
||||
}
|
||||
@@ -375,50 +371,51 @@ public interface IForgeBlock
|
||||
* Gathers how much experience this block drops when broken.
|
||||
*
|
||||
* @param state The current state
|
||||
* @param world The world
|
||||
* @param level The level
|
||||
* @param pos Block position
|
||||
* @param fortune
|
||||
* @param fortuneLevel fortune enchantment level of tool being used
|
||||
* @param silkTouchLevel silk touch enchantment level of tool being used
|
||||
* @return Amount of XP from breaking this block.
|
||||
*/
|
||||
default int getExpDrop(BlockState state, LevelReader world, BlockPos pos, int fortune, int silktouch)
|
||||
default int getExpDrop(BlockState state, LevelReader level, BlockPos pos, int fortuneLevel, int silkTouchLevel)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
default BlockState rotate(BlockState state, LevelAccessor world, BlockPos pos, Rotation direction)
|
||||
default BlockState rotate(BlockState state, LevelAccessor level, BlockPos pos, Rotation direction)
|
||||
{
|
||||
return state.rotate(direction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the amount of enchanting power this block can provide to an enchanting table.
|
||||
* @param world The World
|
||||
* @param pos Block position in world
|
||||
* @param level The level
|
||||
* @param pos Block position in level
|
||||
* @return The amount of enchanting power this block produces.
|
||||
*/
|
||||
default float getEnchantPowerBonus(BlockState state, LevelReader world, BlockPos pos)
|
||||
default float getEnchantPowerBonus(BlockState state, LevelReader level, BlockPos pos)
|
||||
{
|
||||
return state.is(Blocks.BOOKSHELF) ? 1: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a tile entity on a side of this block changes is created or is destroyed.
|
||||
* @param world The world
|
||||
* @param pos Block position in world
|
||||
* @param level The level
|
||||
* @param pos Block position in level
|
||||
* @param neighbor Block position of neighbor
|
||||
*/
|
||||
default void onNeighborChange(BlockState state, LevelReader world, BlockPos pos, BlockPos neighbor){}
|
||||
default void onNeighborChange(BlockState state, LevelReader level, BlockPos pos, BlockPos neighbor){}
|
||||
|
||||
/**
|
||||
* Called to determine whether to allow the a block to handle its own indirect power rather than using the default rules.
|
||||
* @param world The world
|
||||
* @param pos Block position in world
|
||||
* @param level The level
|
||||
* @param pos Block position in level
|
||||
* @param side The INPUT side of the block to be powered - ie the opposite of this block's output side
|
||||
* @return Whether Block#isProvidingWeakPower should be called when determining indirect power
|
||||
*/
|
||||
default boolean shouldCheckWeakPower(BlockState state, LevelReader world, BlockPos pos, Direction side)
|
||||
default boolean shouldCheckWeakPower(BlockState state, LevelReader level, BlockPos pos, Direction side)
|
||||
{
|
||||
return state.isRedstoneConductor(world, pos);
|
||||
return state.isRedstoneConductor(level, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -426,11 +423,11 @@ public interface IForgeBlock
|
||||
* Weak changes are changes 1 block away through a solid block.
|
||||
* Similar to comparators.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @return true To be notified of changes
|
||||
*/
|
||||
default boolean getWeakChanges(BlockState state, LevelReader world, BlockPos pos)
|
||||
default boolean getWeakChanges(BlockState state, LevelReader level, BlockPos pos)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -438,25 +435,25 @@ public interface IForgeBlock
|
||||
/**
|
||||
* Sensitive version of getSoundType
|
||||
* @param state The state
|
||||
* @param world The world
|
||||
* @param pos The position. Note that the world may not necessarily have {@code state} here!
|
||||
* @param level The level
|
||||
* @param pos The position. Note that the level may not necessarily have {@code state} here!
|
||||
* @param entity The entity that is breaking/stepping on/placing/hitting/falling on this block, or null if no entity is in this context
|
||||
* @return A SoundType to use
|
||||
*/
|
||||
default SoundType getSoundType(BlockState state, LevelReader world, BlockPos pos, @Nullable Entity entity)
|
||||
default SoundType getSoundType(BlockState state, LevelReader level, BlockPos pos, @Nullable Entity entity)
|
||||
{
|
||||
return self().getSoundType(state);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param state The state
|
||||
* @param world The world
|
||||
* @param level The level
|
||||
* @param pos The position of this state
|
||||
* @param beaconPos The position of the beacon
|
||||
* @return A float RGB [0.0, 1.0] array to be averaged with a beacon's existing beam color, or null to do nothing to the beam
|
||||
*/
|
||||
@Nullable
|
||||
default float[] getBeaconColorMultiplier(BlockState state, LevelReader world, BlockPos pos, BlockPos beaconPos)
|
||||
default float[] getBeaconColorMultiplier(BlockState state, LevelReader level, BlockPos pos, BlockPos beaconPos)
|
||||
{
|
||||
if (self() instanceof BeaconBeamBlock)
|
||||
return ((BeaconBeamBlock) self()).getColor().getTextureDiffuseColors();
|
||||
@@ -469,12 +466,12 @@ public interface IForgeBlock
|
||||
* Can be used by fluid blocks to determine if the viewpoint is within the fluid or not.
|
||||
*
|
||||
* @param state the state
|
||||
* @param world the world
|
||||
* @param level the level
|
||||
* @param pos the position
|
||||
* @param viewpoint the viewpoint
|
||||
* @return the block state that should be 'seen'
|
||||
*/
|
||||
default BlockState getStateAtViewpoint(BlockState state, BlockGetter world, BlockPos pos, Vec3 viewpoint)
|
||||
default BlockState getStateAtViewpoint(BlockState state, BlockGetter level, BlockPos pos, Vec3 viewpoint)
|
||||
{
|
||||
return state;
|
||||
}
|
||||
@@ -485,9 +482,9 @@ public interface IForgeBlock
|
||||
* @return the PathNodeType
|
||||
*/
|
||||
@Nullable
|
||||
default BlockPathTypes getAiPathNodeType(BlockState state, BlockGetter world, BlockPos pos, @Nullable Mob entity)
|
||||
default BlockPathTypes getAiPathNodeType(BlockState state, BlockGetter level, BlockPos pos, @Nullable Mob entity)
|
||||
{
|
||||
return state.getBlock() == Blocks.LAVA ? BlockPathTypes.LAVA : state.isBurning(world, pos) ? BlockPathTypes.DAMAGE_FIRE : null;
|
||||
return state.getBlock() == Blocks.LAVA ? BlockPathTypes.LAVA : state.isBurning(level, pos) ? BlockPathTypes.DAMAGE_FIRE : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -526,12 +523,12 @@ public interface IForgeBlock
|
||||
* 300 being a 100% chance, 0, being a 0% chance.
|
||||
*
|
||||
* @param state The current state
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param face The face that the fire is coming from
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param direction The direction that the fire is coming from
|
||||
* @return A number ranging from 0 to 300 relating used to determine if the block will be consumed by fire
|
||||
*/
|
||||
default int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face)
|
||||
default int getFlammability(BlockState state, BlockGetter level, BlockPos pos, Direction direction)
|
||||
{
|
||||
return ((FireBlock)Blocks.FIRE).getBurnOdd(state);
|
||||
}
|
||||
@@ -541,38 +538,38 @@ public interface IForgeBlock
|
||||
*
|
||||
*
|
||||
* @param state The current state
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param face The face that the fire is coming from
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param direction The direction that the fire is coming from
|
||||
* @return True if the face can be on fire, false otherwise.
|
||||
*/
|
||||
default boolean isFlammable(BlockState state, BlockGetter world, BlockPos pos, Direction face)
|
||||
default boolean isFlammable(BlockState state, BlockGetter level, BlockPos pos, Direction direction)
|
||||
{
|
||||
return state.getFlammability(world, pos, face) > 0;
|
||||
return state.getFlammability(level, pos, direction) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* If the block is flammable, this is called when it gets lit on fire.
|
||||
*
|
||||
* @param state The current state
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param face The face that the fire is coming from
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param direction The direction that the fire is coming from
|
||||
* @param igniter The entity that lit the fire
|
||||
*/
|
||||
default void onCaughtFire(BlockState state, Level world, BlockPos pos, @Nullable Direction face, @Nullable LivingEntity igniter) {}
|
||||
default void onCaughtFire(BlockState state, Level level, BlockPos pos, @Nullable Direction direction, @Nullable LivingEntity igniter) {}
|
||||
|
||||
/**
|
||||
* Called when fire is updating on a neighbor block.
|
||||
* The higher the number returned, the faster fire will spread around this block.
|
||||
*
|
||||
* @param state The current state
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param face The face that the fire is coming from
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param direction The direction that the fire is coming from
|
||||
* @return A number that is used to determine the speed of fire growth around the block
|
||||
*/
|
||||
default int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face)
|
||||
default int getFireSpreadSpeed(BlockState state, BlockGetter level, BlockPos pos, Direction direction)
|
||||
{
|
||||
return ((FireBlock)Blocks.FIRE).getFlameOdds(state);
|
||||
}
|
||||
@@ -583,25 +580,25 @@ public interface IForgeBlock
|
||||
* Also prevents firing from dying from rain.
|
||||
*
|
||||
* @param state The current state
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param side The face that the fire is coming from
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param direction The direction that the fire is coming from
|
||||
* @return True if this block sustains fire, meaning it will never go out.
|
||||
*/
|
||||
default boolean isFireSource(BlockState state, LevelReader world, BlockPos pos, Direction side)
|
||||
default boolean isFireSource(BlockState state, LevelReader level, BlockPos pos, Direction direction)
|
||||
{
|
||||
return state.is(world.dimensionType().infiniburn());
|
||||
return state.is(level.dimensionType().infiniburn());
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if this block is can be destroyed by the specified entities normal behavior.
|
||||
*
|
||||
* @param state The current state
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @return True to allow the ender dragon to destroy this block
|
||||
*/
|
||||
default boolean canEntityDestroy(BlockState state, BlockGetter world, BlockPos pos, Entity entity)
|
||||
default boolean canEntityDestroy(BlockState state, BlockGetter level, BlockPos pos, Entity entity)
|
||||
{
|
||||
if (entity instanceof EnderDragon)
|
||||
{
|
||||
@@ -619,7 +616,7 @@ public interface IForgeBlock
|
||||
/**
|
||||
* Determines if this block should drop loot when exploded.
|
||||
*/
|
||||
default boolean canDropFromExplosion(BlockState state, BlockGetter world, BlockPos pos, Explosion explosion)
|
||||
default boolean canDropFromExplosion(BlockState state, BlockGetter level, BlockPos pos, Explosion explosion)
|
||||
{
|
||||
return state.getBlock().dropFromExplosion(explosion);
|
||||
}
|
||||
@@ -635,21 +632,21 @@ public interface IForgeBlock
|
||||
* Useful for allowing the block to take into account tile entities,
|
||||
* state, etc. when exploded, before it is removed.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param explosion The explosion instance affecting the block
|
||||
*/
|
||||
default void onBlockExploded(BlockState state, Level world, BlockPos pos, Explosion explosion)
|
||||
default void onBlockExploded(BlockState state, Level level, BlockPos pos, Explosion explosion)
|
||||
{
|
||||
world.setBlock(pos, Blocks.AIR.defaultBlockState(), 3);
|
||||
self().wasExploded(world, pos, explosion);
|
||||
level.setBlock(pos, Blocks.AIR.defaultBlockState(), 3);
|
||||
self().wasExploded(level, pos, explosion);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if this block's collision box should be treated as though it can extend above its block space.
|
||||
* Use this to replicate fence and wall behavior.
|
||||
*/
|
||||
default boolean collisionExtendsVertically(BlockState state, BlockGetter world, BlockPos pos, Entity collidingEntity)
|
||||
default boolean collisionExtendsVertically(BlockState state, BlockGetter level, BlockPos pos, Entity collidingEntity)
|
||||
{
|
||||
return state.is(BlockTags.FENCES) || state.is(BlockTags.WALLS) || self() instanceof FenceGateBlock;
|
||||
}
|
||||
@@ -658,12 +655,12 @@ public interface IForgeBlock
|
||||
* Called to determine whether this block should use the fluid overlay texture or flowing texture when it is placed under the fluid.
|
||||
*
|
||||
* @param state The current state
|
||||
* @param world The world
|
||||
* @param pos Block position in world
|
||||
* @param level The level
|
||||
* @param pos Block position in level
|
||||
* @param fluidState The state of the fluid
|
||||
* @return Whether the fluid overlay texture should be used
|
||||
*/
|
||||
default boolean shouldDisplayFluidOverlay(BlockState state, BlockAndTintGetter world, BlockPos pos, FluidState fluidState)
|
||||
default boolean shouldDisplayFluidOverlay(BlockState state, BlockAndTintGetter level, BlockPos pos, FluidState fluidState)
|
||||
{
|
||||
return state.getBlock() instanceof HalfTransparentBlock || state.getBlock() instanceof LeavesBlock;
|
||||
}
|
||||
@@ -674,15 +671,15 @@ public interface IForgeBlock
|
||||
* Return null if vanilla behavior should be disabled.
|
||||
*
|
||||
* @param state The current state
|
||||
* @param world The world
|
||||
* @param pos The block position in world
|
||||
* @param level The level
|
||||
* @param pos The block position in level
|
||||
* @param player The player clicking the block
|
||||
* @param stack The stack being used by the player
|
||||
* @param toolAction The action being performed by the tool
|
||||
* @return The resulting state after the action has been performed
|
||||
*/
|
||||
@Nullable
|
||||
default BlockState getToolModifiedState(BlockState state, Level world, BlockPos pos, Player player, ItemStack stack, ToolAction toolAction)
|
||||
default BlockState getToolModifiedState(BlockState state, Level level, BlockPos pos, Player player, ItemStack stack, ToolAction toolAction)
|
||||
{
|
||||
if (!stack.canPerformAction(toolAction)) return null;
|
||||
if (ToolActions.AXE_STRIP.equals(toolAction)) return AxeItem.getAxeStrippingState(state);
|
||||
@@ -699,12 +696,12 @@ public interface IForgeBlock
|
||||
* Checks if a player or entity handles movement on this block like scaffolding.
|
||||
*
|
||||
* @param state The current state
|
||||
* @param world The current world
|
||||
* @param pos The block position in world
|
||||
* @param level The current level
|
||||
* @param pos The block position in level
|
||||
* @param entity The entity on the scaffolding
|
||||
* @return True if the block should act like scaffolding
|
||||
*/
|
||||
default boolean isScaffolding(BlockState state, LevelReader world, BlockPos pos, LivingEntity entity)
|
||||
default boolean isScaffolding(BlockState state, LevelReader level, BlockPos pos, LivingEntity entity)
|
||||
{
|
||||
return state.is(Blocks.SCAFFOLDING);
|
||||
}
|
||||
@@ -721,24 +718,24 @@ public interface IForgeBlock
|
||||
* is called, this callback is used during the evaluation of its new shape.
|
||||
*
|
||||
* @param state The current state
|
||||
* @param world The world
|
||||
* @param pos The block position in world
|
||||
* @param level The level
|
||||
* @param pos The block position in level
|
||||
* @param direction The coming direction of the redstone dust connection (with respect to the block at pos)
|
||||
* @return True if redstone dust should visually connect on the side passed
|
||||
* <p>
|
||||
* If the return value is evaluated based on world and pos (e.g. from BlockEntity), then the implementation of
|
||||
* If the return value is evaluated based on level and pos (e.g. from BlockEntity), then the implementation of
|
||||
* this block should notify its neighbors to update their shapes when necessary. Consider using
|
||||
* {@link BlockState#updateNeighbourShapes(LevelAccessor, BlockPos, int, int)} or
|
||||
* {@link BlockState#updateShape(Direction, BlockState, LevelAccessor, BlockPos, BlockPos)}.
|
||||
* <p>
|
||||
* Example:
|
||||
* <p>
|
||||
* 1. {@code yourBlockState.updateNeighbourShapes(world, yourBlockPos, UPDATE_ALL);}
|
||||
* 1. {@code yourBlockState.updateNeighbourShapes(level, yourBlockPos, UPDATE_ALL);}
|
||||
* <p>
|
||||
* 2. {@code neighborState.updateShape(fromDirection, stateOfYourBlock, world, neighborBlockPos, yourBlockPos)},
|
||||
* 2. {@code neighborState.updateShape(fromDirection, stateOfYourBlock, level, neighborBlockPos, yourBlockPos)},
|
||||
* where {@code fromDirection} is defined from the neighbor block's point of view.
|
||||
*/
|
||||
default boolean canConnectRedstone(BlockState state, BlockGetter world, BlockPos pos, @Nullable Direction direction)
|
||||
default boolean canConnectRedstone(BlockState state, BlockGetter level, BlockPos pos, @Nullable Direction direction)
|
||||
{
|
||||
if (state.is(Blocks.REDSTONE_WIRE))
|
||||
{
|
||||
|
||||
@@ -155,8 +155,8 @@ public interface IForgeBlockEntity extends ICapabilitySerializable<CompoundTag>
|
||||
default void requestModelDataUpdate()
|
||||
{
|
||||
BlockEntity te = self();
|
||||
Level world = te.getLevel();
|
||||
if (world != null && world.isClientSide)
|
||||
Level level = te.getLevel();
|
||||
if (level != null && level.isClientSide)
|
||||
{
|
||||
ModelDataManager.requestModelDataRefresh(te);
|
||||
}
|
||||
|
||||
@@ -54,48 +54,48 @@ public interface IForgeBlockState
|
||||
* {@link ItemEntity} uses {@code .98}, and
|
||||
* {@link FishingHook} uses {@code .92}.
|
||||
*
|
||||
* @param world the world
|
||||
* @param pos the position in the world
|
||||
* @param level the level
|
||||
* @param pos the position in the level
|
||||
* @param entity the entity in question
|
||||
* @return the factor by which the entity's motion should be multiplied
|
||||
*/
|
||||
default float getFriction(LevelReader world, BlockPos pos, @Nullable Entity entity)
|
||||
default float getFriction(LevelReader level, BlockPos pos, @Nullable Entity entity)
|
||||
{
|
||||
return self().getBlock().getFriction(self(), world, pos, entity);
|
||||
return self().getBlock().getFriction(self(), level, pos, entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a light value for this block, taking into account the given state and coordinates, normal ranges are between 0 and 15
|
||||
*/
|
||||
default int getLightEmission(BlockGetter world, BlockPos pos)
|
||||
default int getLightEmission(BlockGetter level, BlockPos pos)
|
||||
{
|
||||
return self().getBlock().getLightEmission(self(), world, pos);
|
||||
return self().getBlock().getLightEmission(self(), level, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a player or entity can use this block to 'climb' like a ladder.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param entity The entity trying to use the ladder, CAN be null.
|
||||
* @return True if the block should act like a ladder
|
||||
*/
|
||||
default boolean isLadder(LevelReader world, BlockPos pos, LivingEntity entity)
|
||||
default boolean isLadder(LevelReader level, BlockPos pos, LivingEntity entity)
|
||||
{
|
||||
return self().getBlock().isLadder(self(), world, pos, entity);
|
||||
return self().getBlock().isLadder(self(), level, pos, entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the player can harvest this block, obtaining it's drops when the block is destroyed.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param level The current level
|
||||
* @param pos The block's current position
|
||||
* @param player The player damaging the block
|
||||
* @return True to spawn the drops
|
||||
*/
|
||||
default boolean canHarvestBlock(BlockGetter world, BlockPos pos, Player player)
|
||||
default boolean canHarvestBlock(BlockGetter level, BlockPos pos, Player player)
|
||||
{
|
||||
return self().getBlock().canHarvestBlock(self(), world, pos, player);
|
||||
return self().getBlock().canHarvestBlock(self(), level, pos, player);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,17 +109,17 @@ public interface IForgeBlockState
|
||||
* Note: When used in multiplayer, this is called on both client and
|
||||
* server sides!
|
||||
*
|
||||
* @param world The current world
|
||||
* @param level The current level
|
||||
* @param player The player damaging the block, may be null
|
||||
* @param pos Block position in world
|
||||
* @param pos Block position in level
|
||||
* @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.
|
||||
* @param fluid The current fluid and block state for the position in the level.
|
||||
* @return True if the block is actually destroyed.
|
||||
*/
|
||||
default boolean onDestroyedByPlayer(Level world, BlockPos pos, Player player, boolean willHarvest, FluidState fluid)
|
||||
default boolean onDestroyedByPlayer(Level level, BlockPos pos, Player player, boolean willHarvest, FluidState fluid)
|
||||
{
|
||||
return self().getBlock().onDestroyedByPlayer(self(), world, pos, player, willHarvest, fluid);
|
||||
return self().getBlock().onDestroyedByPlayer(self(), level, pos, player, willHarvest, fluid);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,28 +127,28 @@ public interface IForgeBlockState
|
||||
* players to sleep in it, though the block has to specifically
|
||||
* perform the sleeping functionality in it's activated event.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param sleeper The sleeper or camera entity, null in some cases.
|
||||
* @return True to treat this as a bed
|
||||
*/
|
||||
default boolean isBed(BlockGetter world, BlockPos pos, @Nullable LivingEntity sleeper)
|
||||
default boolean isBed(BlockGetter level, BlockPos pos, @Nullable LivingEntity sleeper)
|
||||
{
|
||||
return self().getBlock().isBed(self(), world, pos, sleeper);
|
||||
return self().getBlock().isBed(self(), level, pos, sleeper);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a specified mob type can spawn on this block, returning false will
|
||||
* prevent any mob from spawning on the block.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param type The Mob Category Type
|
||||
* @return True to allow a mob of the specified category to spawn, false to prevent it.
|
||||
*/
|
||||
default boolean isValidSpawn(LevelReader world, BlockPos pos, Type type, EntityType<?> entityType)
|
||||
default boolean isValidSpawn(LevelReader level, BlockPos pos, Type type, EntityType<?> entityType)
|
||||
{
|
||||
return self().getBlock().isValidSpawn(self(), world, pos, type, entityType);
|
||||
return self().getBlock().isValidSpawn(self(), level, pos, type, entityType);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -156,54 +156,54 @@ public interface IForgeBlockState
|
||||
* respawning at this block.
|
||||
*
|
||||
* @param type The entity type used when checking if a dismount blockstate is dangerous. Currently always PLAYER.
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param orientation The angle the entity had when setting the respawn point
|
||||
* @param entity The entity respawning, often null
|
||||
* @return The spawn position or the empty optional if respawning here is not possible
|
||||
*/
|
||||
default Optional<Vec3> getRespawnPosition(EntityType<?> type, LevelReader world, BlockPos pos, float orientation, @Nullable LivingEntity entity)
|
||||
default Optional<Vec3> getRespawnPosition(EntityType<?> type, LevelReader level, BlockPos pos, float orientation, @Nullable LivingEntity entity)
|
||||
{
|
||||
return self().getBlock().getRespawnPosition(self(), type, world, pos, orientation, entity);
|
||||
return self().getBlock().getRespawnPosition(self(), type, level, pos, orientation, entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a user either starts or stops sleeping in the bed.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param sleeper The sleeper or camera entity, null in some cases.
|
||||
* @param occupied True if we are occupying the bed, or false if they are stopping use of the bed
|
||||
*/
|
||||
default void setBedOccupied(Level world, BlockPos pos, LivingEntity sleeper, boolean occupied)
|
||||
default void setBedOccupied(Level level, BlockPos pos, LivingEntity sleeper, boolean occupied)
|
||||
{
|
||||
self().getBlock().setBedOccupied(self(), world, pos, sleeper, occupied);
|
||||
self().getBlock().setBedOccupied(self(), level, pos, sleeper, occupied);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the direction of the block. Same values that
|
||||
* are returned by BlockDirectional
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @return Bed direction
|
||||
*/
|
||||
default Direction getBedDirection(LevelReader world, BlockPos pos)
|
||||
default Direction getBedDirection(LevelReader level, BlockPos pos)
|
||||
{
|
||||
return self().getBlock().getBedDirection(self(), world, pos);
|
||||
return self().getBlock().getBedDirection(self(), level, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Location sensitive version of getExplosionResistance
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param explosion The explosion
|
||||
* @return The amount of the explosion absorbed.
|
||||
*/
|
||||
default float getExplosionResistance(BlockGetter world, BlockPos pos, Explosion explosion)
|
||||
default float getExplosionResistance(BlockGetter level, BlockPos pos, Explosion explosion)
|
||||
{
|
||||
return self().getBlock().getExplosionResistance(self(), world, pos, explosion);
|
||||
return self().getBlock().getExplosionResistance(self(), level, pos, explosion);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -213,9 +213,9 @@ public interface IForgeBlockState
|
||||
* @param target The full target the player is looking at
|
||||
* @return A ItemStack to add to the player's inventory, empty itemstack if nothing should be added.
|
||||
*/
|
||||
default ItemStack getCloneItemStack(HitResult target, BlockGetter world, BlockPos pos, Player player)
|
||||
default ItemStack getCloneItemStack(HitResult target, BlockGetter level, BlockPos pos, Player player)
|
||||
{
|
||||
return self().getBlock().getCloneItemStack(self(), target, world, pos, player);
|
||||
return self().getBlock().getCloneItemStack(self(), target, level, pos, player);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -223,16 +223,16 @@ public interface IForgeBlockState
|
||||
* particles, this is a server side method that spawns particles with
|
||||
* WorldServer.spawnParticle.
|
||||
*
|
||||
* @param worldserver The current Server World
|
||||
* @param level The current server level
|
||||
* @param pos The position of the block.
|
||||
* @param state2 The state at the specific world/pos
|
||||
* @param entity The entity that hit landed on the block
|
||||
* @param numberOfParticles That vanilla world have spawned
|
||||
* @return True to prevent vanilla landing particles from spawning
|
||||
*/
|
||||
default boolean addLandingEffects(ServerLevel worldserver, BlockPos pos, BlockState state2, LivingEntity entity, int numberOfParticles)
|
||||
default boolean addLandingEffects(ServerLevel level, BlockPos pos, BlockState state2, LivingEntity entity, int numberOfParticles)
|
||||
{
|
||||
return self().getBlock().addLandingEffects(self(), worldserver, pos, state2, entity, numberOfParticles);
|
||||
return self().getBlock().addLandingEffects(self(), level, pos, state2, entity, numberOfParticles);
|
||||
}
|
||||
/**
|
||||
* Allows a block to override the standard vanilla running particles.
|
||||
@@ -240,14 +240,14 @@ public interface IForgeBlockState
|
||||
* Client and server side, it's up to the implementor to client check / server check.
|
||||
* By default vanilla spawns particles only on the client and the server methods no-op.
|
||||
*
|
||||
* @param world The world.
|
||||
* @param level The level.
|
||||
* @param pos The position at the entities feet.
|
||||
* @param entity The entity running on the block.
|
||||
* @return True to prevent vanilla running particles from spawning.
|
||||
*/
|
||||
default boolean addRunningEffects(Level world, BlockPos pos, Entity entity)
|
||||
default boolean addRunningEffects(Level level, BlockPos pos, Entity entity)
|
||||
{
|
||||
return self().getBlock().addRunningEffects(self(), world, pos, entity);
|
||||
return self().getBlock().addRunningEffects(self(), level, pos, entity);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -261,14 +261,14 @@ public interface IForgeBlockState
|
||||
* Plains check if its grass or dirt
|
||||
* Water check if its still water
|
||||
*
|
||||
* @param world The current world
|
||||
* @param level The current level
|
||||
* @param facing The direction relative to the given position the plant wants to be, typically its UP
|
||||
* @param plantable The plant that wants to check
|
||||
* @return True to allow the plant to be planted/stay.
|
||||
*/
|
||||
default boolean canSustainPlant(BlockGetter world, BlockPos pos, Direction facing, IPlantable plantable)
|
||||
default boolean canSustainPlant(BlockGetter level, BlockPos pos, Direction facing, IPlantable plantable)
|
||||
{
|
||||
return self().getBlock().canSustainPlant(self(), world, pos, facing, plantable);
|
||||
return self().getBlock().canSustainPlant(self(), level, pos, facing, plantable);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -276,90 +276,91 @@ public interface IForgeBlockState
|
||||
* of plants on this soil will be slightly sped up.
|
||||
* Only vanilla case is tilledField when it is within range of water.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @return True if the soil should be considered fertile.
|
||||
*/
|
||||
default boolean isFertile(BlockGetter world, BlockPos pos)
|
||||
default boolean isFertile(BlockGetter level, BlockPos pos)
|
||||
{
|
||||
return self().getBlock().isFertile(self(), world, pos);
|
||||
return self().getBlock().isFertile(self(), level, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if this block can be used as the frame of a conduit.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param conduit Conduit position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param conduit Conduit position in level
|
||||
* @return True, to support the conduit, and make it active with this block.
|
||||
*/
|
||||
default boolean isConduitFrame(LevelReader world, BlockPos pos, BlockPos conduit)
|
||||
default boolean isConduitFrame(LevelReader level, BlockPos pos, BlockPos conduit)
|
||||
{
|
||||
return self().getBlock().isConduitFrame(self(), world, pos, conduit);
|
||||
return self().getBlock().isConduitFrame(self(), level, pos, conduit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if this block can be used as part of a frame of a nether portal.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @return True, to support being part of a nether portal frame, false otherwise.
|
||||
*/
|
||||
default boolean isPortalFrame(BlockGetter world, BlockPos pos)
|
||||
default boolean isPortalFrame(BlockGetter level, BlockPos pos)
|
||||
{
|
||||
return self().getBlock().isPortalFrame(self(), world, pos);
|
||||
return self().getBlock().isPortalFrame(self(), level, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gathers how much experience this block drops when broken.
|
||||
*
|
||||
* @param world The world
|
||||
* @param level The level
|
||||
* @param pos Block position
|
||||
* @param fortune
|
||||
* @param fortuneLevel fortune enchantment level of tool being used
|
||||
* @param silkTouchLevel silk touch enchantment level of tool being used
|
||||
* @return Amount of XP from breaking this block.
|
||||
*/
|
||||
default int getExpDrop(LevelReader world, BlockPos pos, int fortune, int silktouch)
|
||||
default int getExpDrop(LevelReader level, BlockPos pos, int fortuneLevel, int silkTouchLevel)
|
||||
{
|
||||
return self().getBlock().getExpDrop(self(), world, pos, fortune, silktouch);
|
||||
return self().getBlock().getExpDrop(self(), level, pos, fortuneLevel, silkTouchLevel);
|
||||
}
|
||||
|
||||
default BlockState rotate(LevelAccessor world, BlockPos pos, Rotation direction)
|
||||
default BlockState rotate(LevelAccessor level, BlockPos pos, Rotation direction)
|
||||
{
|
||||
return self().getBlock().rotate(self(), world, pos, direction);
|
||||
return self().getBlock().rotate(self(), level, pos, direction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the amount of enchanting power this block can provide to an enchanting table.
|
||||
* @param world The World
|
||||
* @param pos Block position in world
|
||||
* @param level The level
|
||||
* @param pos Block position in level
|
||||
* @return The amount of enchanting power this block produces.
|
||||
*/
|
||||
default float getEnchantPowerBonus(LevelReader world, BlockPos pos)
|
||||
default float getEnchantPowerBonus(LevelReader level, BlockPos pos)
|
||||
{
|
||||
return self().getBlock().getEnchantPowerBonus(self(), world, pos);
|
||||
return self().getBlock().getEnchantPowerBonus(self(), level, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a tile entity on a side of this block changes is created or is destroyed.
|
||||
* @param world The world
|
||||
* @param pos Block position in world
|
||||
* @param level The level
|
||||
* @param pos Block position in level
|
||||
* @param neighbor Block position of neighbor
|
||||
*/
|
||||
default void onNeighborChange(LevelReader world, BlockPos pos, BlockPos neighbor)
|
||||
default void onNeighborChange(LevelReader level, BlockPos pos, BlockPos neighbor)
|
||||
{
|
||||
self().getBlock().onNeighborChange(self(), world, pos, neighbor);
|
||||
self().getBlock().onNeighborChange(self(), level, pos, neighbor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to determine whether to allow the a block to handle its own indirect power rather than using the default rules.
|
||||
* @param world The world
|
||||
* @param pos Block position in world
|
||||
* @param level The level
|
||||
* @param pos Block position in level
|
||||
* @param side The INPUT side of the block to be powered - ie the opposite of this block's output side
|
||||
* @return Whether Block#isProvidingWeakPower should be called when determining indirect power
|
||||
*/
|
||||
default boolean shouldCheckWeakPower(LevelReader world, BlockPos pos, Direction side)
|
||||
default boolean shouldCheckWeakPower(LevelReader level, BlockPos pos, Direction side)
|
||||
{
|
||||
return self().getBlock().shouldCheckWeakPower(self(), world, pos, side);
|
||||
return self().getBlock().shouldCheckWeakPower(self(), level, pos, side);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -367,37 +368,37 @@ public interface IForgeBlockState
|
||||
* Weak changes are changes 1 block away through a solid block.
|
||||
* Similar to comparators.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @return true To be notified of changes
|
||||
*/
|
||||
default boolean getWeakChanges(LevelReader world, BlockPos pos)
|
||||
default boolean getWeakChanges(LevelReader level, BlockPos pos)
|
||||
{
|
||||
return self().getBlock().getWeakChanges(self(), world, pos);
|
||||
return self().getBlock().getWeakChanges(self(), level, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sensitive version of getSoundType
|
||||
* @param world The world
|
||||
* @param pos The position. Note that the world may not necessarily have {@code state} here!
|
||||
* @param level The level
|
||||
* @param pos The position. Note that the level may not necessarily have {@code state} here!
|
||||
* @param entity The entity that is breaking/stepping on/placing/hitting/falling on this block, or null if no entity is in this context
|
||||
* @return A SoundType to use
|
||||
*/
|
||||
default SoundType getSoundType(LevelReader world, BlockPos pos, @Nullable Entity entity)
|
||||
default SoundType getSoundType(LevelReader level, BlockPos pos, @Nullable Entity entity)
|
||||
{
|
||||
return self().getBlock().getSoundType(self(), world, pos, entity);
|
||||
return self().getBlock().getSoundType(self(), level, pos, entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param world The world
|
||||
* @param level The level
|
||||
* @param pos The position of this state
|
||||
* @param beacon The position of the beacon
|
||||
* @return A float RGB [0.0, 1.0] array to be averaged with a beacon's existing beam color, or null to do nothing to the beam
|
||||
*/
|
||||
@Nullable
|
||||
default float[] getBeaconColorMultiplier(LevelReader world, BlockPos pos, BlockPos beacon)
|
||||
default float[] getBeaconColorMultiplier(LevelReader level, BlockPos pos, BlockPos beacon)
|
||||
{
|
||||
return self().getBlock().getBeaconColorMultiplier(self(), world, pos, beacon);
|
||||
return self().getBlock().getBeaconColorMultiplier(self(), level, pos, beacon);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -405,14 +406,14 @@ public interface IForgeBlockState
|
||||
* {@link Camera#getBlockAtCamera()}).
|
||||
* Can be used by fluid blocks to determine if the viewpoint is within the fluid or not.
|
||||
*
|
||||
* @param world the world
|
||||
* @param level the level
|
||||
* @param pos the position
|
||||
* @param viewpoint the viewpoint
|
||||
* @return the block state that should be 'seen'
|
||||
*/
|
||||
default BlockState getStateAtViewpoint(BlockGetter world, BlockPos pos, Vec3 viewpoint)
|
||||
default BlockState getStateAtViewpoint(BlockGetter level, BlockPos pos, Vec3 viewpoint)
|
||||
{
|
||||
return self().getBlock().getStateAtViewpoint(self(), world, pos, viewpoint);
|
||||
return self().getBlock().getStateAtViewpoint(self(), level, pos, viewpoint);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -445,54 +446,54 @@ public interface IForgeBlockState
|
||||
* Chance that fire will spread and consume this block.
|
||||
* 300 being a 100% chance, 0, being a 0% chance.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param face The face that the fire is coming from
|
||||
* @return A number ranging from 0 to 300 relating used to determine if the block will be consumed by fire
|
||||
*/
|
||||
default int getFlammability(BlockGetter world, BlockPos pos, Direction face)
|
||||
default int getFlammability(BlockGetter level, BlockPos pos, Direction face)
|
||||
{
|
||||
return self().getBlock().getFlammability(self(), world, pos, face);
|
||||
return self().getBlock().getFlammability(self(), level, pos, face);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when fire is updating, checks if a block face can catch fire.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param face The face that the fire is coming from
|
||||
* @return True if the face can be on fire, false otherwise.
|
||||
*/
|
||||
default boolean isFlammable(BlockGetter world, BlockPos pos, Direction face)
|
||||
default boolean isFlammable(BlockGetter level, BlockPos pos, Direction face)
|
||||
{
|
||||
return self().getBlock().isFlammable(self(), world, pos, face);
|
||||
return self().getBlock().isFlammable(self(), level, pos, face);
|
||||
}
|
||||
|
||||
/**
|
||||
* If the block is flammable, this is called when it gets lit on fire.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param face The face that the fire is coming from
|
||||
* @param igniter The entity that lit the fire
|
||||
*/
|
||||
default void onCaughtFire(Level world, BlockPos pos, @Nullable Direction face, @Nullable LivingEntity igniter)
|
||||
default void onCaughtFire(Level level, BlockPos pos, @Nullable Direction face, @Nullable LivingEntity igniter)
|
||||
{
|
||||
self().getBlock().onCaughtFire(self(), world, pos, face, igniter);
|
||||
self().getBlock().onCaughtFire(self(), level, pos, face, igniter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when fire is updating on a neighbor block.
|
||||
* The higher the number returned, the faster fire will spread around this block.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param face The face that the fire is coming from
|
||||
* @return A number that is used to determine the speed of fire growth around the block
|
||||
*/
|
||||
default int getFireSpreadSpeed(BlockGetter world, BlockPos pos, Direction face)
|
||||
default int getFireSpreadSpeed(BlockGetter level, BlockPos pos, Direction face)
|
||||
{
|
||||
return self().getBlock().getFireSpreadSpeed(self(), world, pos, face);
|
||||
return self().getBlock().getFireSpreadSpeed(self(), level, pos, face);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -500,39 +501,39 @@ public interface IForgeBlockState
|
||||
* Returning true will prevent the fire from naturally dying during updating.
|
||||
* Also prevents firing from dying from rain.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param side The face that the fire is coming from
|
||||
* @return True if this block sustains fire, meaning it will never go out.
|
||||
*/
|
||||
default boolean isFireSource(LevelReader world, BlockPos pos, Direction side)
|
||||
default boolean isFireSource(LevelReader level, BlockPos pos, Direction side)
|
||||
{
|
||||
return self().getBlock().isFireSource(self(), world, pos, side);
|
||||
return self().getBlock().isFireSource(self(), level, pos, side);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if this block is can be destroyed by the specified entities normal behavior.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @return True to allow the ender dragon to destroy this block
|
||||
*/
|
||||
default boolean canEntityDestroy(BlockGetter world, BlockPos pos, Entity entity)
|
||||
default boolean canEntityDestroy(BlockGetter level, BlockPos pos, Entity entity)
|
||||
{
|
||||
return self().getBlock().canEntityDestroy(self(), world, pos, entity);
|
||||
return self().getBlock().canEntityDestroy(self(), level, pos, entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if this block should set fire and deal fire damage
|
||||
* to entities coming into contact with it.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @return True if the block should deal damage
|
||||
*/
|
||||
default boolean isBurning(BlockGetter world, BlockPos pos)
|
||||
default boolean isBurning(BlockGetter level, BlockPos pos)
|
||||
{
|
||||
return self().getBlock().isBurning(self(), world, pos);
|
||||
return self().getBlock().isBurning(self(), level, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -541,9 +542,9 @@ public interface IForgeBlockState
|
||||
* @return the PathNodeType
|
||||
*/
|
||||
@Nullable
|
||||
default BlockPathTypes getBlockPathType(BlockGetter world, BlockPos pos)
|
||||
default BlockPathTypes getBlockPathType(BlockGetter level, BlockPos pos)
|
||||
{
|
||||
return getBlockPathType(world, pos, null);
|
||||
return getBlockPathType(level, pos, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -552,17 +553,17 @@ public interface IForgeBlockState
|
||||
* @return the PathNodeType
|
||||
*/
|
||||
@Nullable
|
||||
default BlockPathTypes getBlockPathType(BlockGetter world, BlockPos pos, @Nullable Mob entity)
|
||||
default BlockPathTypes getBlockPathType(BlockGetter level, BlockPos pos, @Nullable Mob mob)
|
||||
{
|
||||
return self().getBlock().getAiPathNodeType(self(), world, pos, entity);
|
||||
return self().getBlock().getAiPathNodeType(self(), level, pos, mob);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if this block should drop loot when exploded.
|
||||
*/
|
||||
default boolean canDropFromExplosion(BlockGetter world, BlockPos pos, Explosion explosion)
|
||||
default boolean canDropFromExplosion(BlockGetter level, BlockPos pos, Explosion explosion)
|
||||
{
|
||||
return self().getBlock().canDropFromExplosion(self(), world, pos, explosion);
|
||||
return self().getBlock().canDropFromExplosion(self(), level, pos, explosion);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -570,35 +571,35 @@ public interface IForgeBlockState
|
||||
* Useful for allowing the block to take into account tile entities,
|
||||
* state, etc. when exploded, before it is removed.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param explosion The explosion instance affecting the block
|
||||
*/
|
||||
default void onBlockExploded(Level world, BlockPos pos, Explosion explosion)
|
||||
default void onBlockExploded(Level level, BlockPos pos, Explosion explosion)
|
||||
{
|
||||
self().getBlock().onBlockExploded(self(), world, pos, explosion);
|
||||
self().getBlock().onBlockExploded(self(), level, pos, explosion);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if this block's collision box should be treated as though it can extend above its block space.
|
||||
* This can be used to replicate fence and wall behavior.
|
||||
*/
|
||||
default boolean collisionExtendsVertically(BlockGetter world, BlockPos pos, Entity collidingEntity)
|
||||
default boolean collisionExtendsVertically(BlockGetter level, BlockPos pos, Entity collidingEntity)
|
||||
{
|
||||
return self().getBlock().collisionExtendsVertically(self(), world, pos, collidingEntity);
|
||||
return self().getBlock().collisionExtendsVertically(self(), level, pos, collidingEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to determine whether this block should use the fluid overlay texture or flowing texture when it is placed under the fluid.
|
||||
*
|
||||
* @param world The world
|
||||
* @param pos Block position in world
|
||||
* @param level The level
|
||||
* @param pos Block position in level
|
||||
* @param fluidState The state of the fluid
|
||||
* @return Whether the fluid overlay texture should be used
|
||||
*/
|
||||
default boolean shouldDisplayFluidOverlay(BlockAndTintGetter world, BlockPos pos, FluidState fluidState)
|
||||
default boolean shouldDisplayFluidOverlay(BlockAndTintGetter level, BlockPos pos, FluidState fluidState)
|
||||
{
|
||||
return self().getBlock().shouldDisplayFluidOverlay(self(), world, pos, fluidState);
|
||||
return self().getBlock().shouldDisplayFluidOverlay(self(), level, pos, fluidState);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -606,18 +607,18 @@ public interface IForgeBlockState
|
||||
* For example: Used to determine if an axe can strip, a shovel can path, or a hoe can till.
|
||||
* Return null if vanilla behavior should be disabled.
|
||||
*
|
||||
* @param world The world
|
||||
* @param pos The block position in world
|
||||
* @param level The level
|
||||
* @param pos The block position in level
|
||||
* @param player The player clicking the block
|
||||
* @param stack The stack being used by the player
|
||||
* @param toolAction The tool type to be considered when performing the action
|
||||
* @return The resulting state after the action has been performed
|
||||
*/
|
||||
@Nullable
|
||||
default BlockState getToolModifiedState(Level world, BlockPos pos, Player player, ItemStack stack, ToolAction toolAction)
|
||||
default BlockState getToolModifiedState(Level level, BlockPos pos, Player player, ItemStack stack, ToolAction toolAction)
|
||||
{
|
||||
BlockState eventState = net.minecraftforge.event.ForgeEventFactory.onToolUse(self(), world, pos, player, stack, toolAction);
|
||||
return eventState != self() ? eventState : self().getBlock().getToolModifiedState(self(), world, pos, player, stack, toolAction);
|
||||
BlockState eventState = net.minecraftforge.event.ForgeEventFactory.onToolUse(self(), level, pos, player, stack, toolAction);
|
||||
return eventState != self() ? eventState : self().getBlock().getToolModifiedState(self(), level, pos, player, stack, toolAction);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -636,13 +637,13 @@ public interface IForgeBlockState
|
||||
* <p>
|
||||
* Modded redstone wire blocks should call this function to determine visual connections.
|
||||
*
|
||||
* @param world The world
|
||||
* @param pos The block position in world
|
||||
* @param level The level
|
||||
* @param pos The block position in level
|
||||
* @param direction The coming direction of the redstone dust connection (with respect to the block at pos)
|
||||
* @return True if redstone dust should visually connect on the side passed
|
||||
*/
|
||||
default boolean canRedstoneConnectTo(BlockGetter world, BlockPos pos, @Nullable Direction direction)
|
||||
default boolean canRedstoneConnectTo(BlockGetter level, BlockPos pos, @Nullable Direction direction)
|
||||
{
|
||||
return self().getBlock().canConnectRedstone(self(), world, pos, direction);
|
||||
return self().getBlock().canConnectRedstone(self(), level, pos, direction);
|
||||
}
|
||||
}
|
||||
@@ -28,30 +28,30 @@ public interface IForgeFluid
|
||||
* Called when the entity is inside this block, may be used to determined if the entity can breathing,
|
||||
* display material overlays, or if the entity can swim inside a block.
|
||||
*
|
||||
* @param world that is being tested.
|
||||
* @param level that is being tested.
|
||||
* @param pos position thats being tested.
|
||||
* @param entity that is being tested.
|
||||
* @param yToTest, primarily for testingHead, which sends the the eye level of the entity, other wise it sends a y that can be tested vs liquid height.
|
||||
* @param tag Fluid category
|
||||
* @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment.
|
||||
*/
|
||||
default boolean isEntityInside(FluidState state, LevelReader world, BlockPos pos, Entity entity, double yToTest, SetTag<Fluid> tag, boolean testingHead)
|
||||
default boolean isEntityInside(FluidState state, LevelReader level, BlockPos pos, Entity entity, double yToTest, SetTag<Fluid> tag, boolean testingHead)
|
||||
{
|
||||
return state.is(tag) && yToTest < (double)(pos.getY() + state.getHeight(world, pos) + 0.11111111F);
|
||||
return state.is(tag) && yToTest < (double)(pos.getY() + state.getHeight(level, pos) + 0.11111111F);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when boats or fishing hooks are inside the block to check if they are inside
|
||||
* the material requested.
|
||||
*
|
||||
* @param world world that is being tested.
|
||||
* @param level level that is being tested.
|
||||
* @param pos block thats being tested.
|
||||
* @param boundingBox box to test, generally the bounds of an entity that are besting tested.
|
||||
* @param materialIn to check for.
|
||||
* @return null for default behavior, true if the box is within the material, false if it was not.
|
||||
*/
|
||||
@Nullable
|
||||
default Boolean isAABBInsideMaterial(FluidState state, LevelReader world, BlockPos pos, AABB boundingBox, Material materialIn)
|
||||
default Boolean isAABBInsideMaterial(FluidState state, LevelReader level, BlockPos pos, AABB boundingBox, Material materialIn)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -59,13 +59,13 @@ public interface IForgeFluid
|
||||
/**
|
||||
* Called when entities are moving to check if they are inside a liquid
|
||||
*
|
||||
* @param world world that is being tested.
|
||||
* @param level level that is being tested.
|
||||
* @param pos block thats being tested.
|
||||
* @param boundingBox box to test, generally the bounds of an entity that are besting tested.
|
||||
* @return null for default behavior, true if the box is within the material, false if it was not.
|
||||
*/
|
||||
@Nullable
|
||||
default Boolean isAABBInsideLiquid(FluidState state, LevelReader world, BlockPos pos, AABB boundingBox)
|
||||
default Boolean isAABBInsideLiquid(FluidState state, LevelReader level, BlockPos pos, AABB boundingBox)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -73,13 +73,13 @@ public interface IForgeFluid
|
||||
/**
|
||||
* Location sensitive version of getExplosionResistance
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param explosion The explosion
|
||||
* @return The amount of the explosion absorbed.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
default float getExplosionResistance(FluidState state, BlockGetter world, BlockPos pos, Explosion explosion)
|
||||
default float getExplosionResistance(FluidState state, BlockGetter level, BlockPos pos, Explosion explosion)
|
||||
{
|
||||
return state.getExplosionResistance();
|
||||
}
|
||||
|
||||
@@ -25,30 +25,30 @@ public interface IForgeFluidState
|
||||
* Called when the entity is inside this block, may be used to determined if the entity can breathing,
|
||||
* display material overlays, or if the entity can swim inside a block.
|
||||
*
|
||||
* @param world that is being tested.
|
||||
* @param level that is being tested.
|
||||
* @param pos position thats being tested.
|
||||
* @param entity that is being tested.
|
||||
* @param yToTest, primarily for testingHead, which sends the the eye level of the entity, other wise it sends a y that can be tested vs liquid height.
|
||||
* @param tag to test for.
|
||||
* @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment.
|
||||
*/
|
||||
default boolean isEntityInside(LevelReader world, BlockPos pos, Entity entity, double yToTest, SetTag<Fluid> tag, boolean testingHead)
|
||||
default boolean isEntityInside(LevelReader level, BlockPos pos, Entity entity, double yToTest, SetTag<Fluid> tag, boolean testingHead)
|
||||
{
|
||||
// return ifluidstate.isTagged(p_213290_1_) && d0 < (double)((float)blockpos.getY() + ifluidstate.getActualHeight(this.world, blockpos) + 0.11111111F);
|
||||
return self().getType().isEntityInside(self(), world, pos, entity, yToTest, tag, testingHead);
|
||||
// return ifluidstate.isTagged(p_213290_1_) && d0 < (double)((float)blockpos.getY() + ifluidstate.getActualHeight(this.level, blockpos) + 0.11111111F);
|
||||
return self().getType().isEntityInside(self(), level, pos, entity, yToTest, tag, testingHead);
|
||||
}
|
||||
|
||||
/**
|
||||
* Location sensitive version of getExplosionResistance
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param level The current level
|
||||
* @param pos Block position in level
|
||||
* @param explosion The explosion
|
||||
* @return The amount of the explosion absorbed.
|
||||
*/
|
||||
default float getExplosionResistance(BlockGetter world, BlockPos pos, Explosion explosion)
|
||||
default float getExplosionResistance(BlockGetter level, BlockPos pos, Explosion explosion)
|
||||
{
|
||||
return self().getType().getExplosionResistance(self(), world, pos, explosion);
|
||||
return self().getType().getExplosionResistance(self(), level, pos, explosion);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -246,10 +246,10 @@ public interface IForgeItem
|
||||
* as a EntityItem. This is in ticks, standard result is 6000, or 5 mins.
|
||||
*
|
||||
* @param itemStack The current ItemStack
|
||||
* @param world The world the entity is in
|
||||
* @param level The level the entity is in
|
||||
* @return The normal lifespan in ticks.
|
||||
*/
|
||||
default int getEntityLifespan(ItemStack itemStack, Level world)
|
||||
default int getEntityLifespan(ItemStack itemStack, Level level)
|
||||
{
|
||||
return 6000;
|
||||
}
|
||||
@@ -272,16 +272,16 @@ public interface IForgeItem
|
||||
/**
|
||||
* This function should return a new entity to replace the dropped item.
|
||||
* Returning null here will not kill the EntityItem and will leave it to
|
||||
* function normally. Called when the item it placed in a world.
|
||||
* function normally. Called when the item it placed in a level.
|
||||
*
|
||||
* @param world The world object
|
||||
* @param level The level object
|
||||
* @param location The EntityItem object, useful for getting the position of
|
||||
* the entity
|
||||
* @param itemstack The current item stack
|
||||
* @param stack The current item stack
|
||||
* @return A new Entity object to spawn or null
|
||||
*/
|
||||
@Nullable
|
||||
default Entity createEntity(Level world, Entity location, ItemStack itemstack)
|
||||
default Entity createEntity(Level level, Entity location, ItemStack stack)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -316,12 +316,11 @@ public interface IForgeItem
|
||||
* Should this item, when held, allow sneak-clicks to pass through to the
|
||||
* underlying block?
|
||||
*
|
||||
* @param world The world
|
||||
* @param pos Block position in world
|
||||
* @param level The level
|
||||
* @param pos Block position in level
|
||||
* @param player The Player that is wielding the item
|
||||
* @return
|
||||
*/
|
||||
default boolean doesSneakBypassUse(ItemStack stack, net.minecraft.world.level.LevelReader world, BlockPos pos, Player player)
|
||||
default boolean doesSneakBypassUse(ItemStack stack, net.minecraft.world.level.LevelReader level, BlockPos pos, Player player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -329,7 +328,7 @@ public interface IForgeItem
|
||||
/**
|
||||
* Called to tick armor in the armor slot. Override to do something
|
||||
*/
|
||||
default void onArmorTick(ItemStack stack, Level world, Player player)
|
||||
default void onArmorTick(ItemStack stack, Level level, Player player)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -633,10 +632,10 @@ public interface IForgeItem
|
||||
* armor slot.
|
||||
*
|
||||
* @param stack the armor itemstack
|
||||
* @param world the world the horse is in
|
||||
* @param level the level the horse is in
|
||||
* @param horse the horse wearing this armor
|
||||
*/
|
||||
default void onHorseArmorTick(ItemStack stack, Level world, Mob horse)
|
||||
default void onHorseArmorTick(ItemStack stack, Level level, Mob horse)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -220,12 +220,12 @@ public interface IForgeItemStack extends ICapabilitySerializable<CompoundTag>
|
||||
* Retrieves the normal 'lifespan' of this item when it is dropped on the ground
|
||||
* as a EntityItem. This is in ticks, standard result is 6000, or 5 mins.
|
||||
*
|
||||
* @param world The world the entity is in
|
||||
* @param level The level the entity is in
|
||||
* @return The normal lifespan in ticks.
|
||||
*/
|
||||
default int getEntityLifespan(Level world)
|
||||
default int getEntityLifespan(Level level)
|
||||
{
|
||||
return self().getItem().getEntityLifespan(self(), world);
|
||||
return self().getItem().getEntityLifespan(self(), level);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -253,21 +253,21 @@ public interface IForgeItemStack extends ICapabilitySerializable<CompoundTag>
|
||||
/**
|
||||
* Called to tick armor in the armor slot. Override to do something
|
||||
*/
|
||||
default void onArmorTick(Level world, Player player)
|
||||
default void onArmorTick(Level level, Player player)
|
||||
{
|
||||
self().getItem().onArmorTick(self(), world, player);
|
||||
self().getItem().onArmorTick(self(), level, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called every tick from {@code Horse#playGallopSound(SoundEvent)} on the item in the
|
||||
* armor slot.
|
||||
*
|
||||
* @param world the world the horse is in
|
||||
* @param level the level the horse is in
|
||||
* @param horse the horse wearing this armor
|
||||
*/
|
||||
default void onHorseArmorTick(Level world, Mob horse)
|
||||
default void onHorseArmorTick(Level level, Mob horse)
|
||||
{
|
||||
self().getItem().onHorseArmorTick(self(), world, horse);
|
||||
self().getItem().onHorseArmorTick(self(), level, horse);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -365,14 +365,13 @@ public interface IForgeItemStack extends ICapabilitySerializable<CompoundTag>
|
||||
*
|
||||
* Should this item, when held, allow sneak-clicks to pass through to the underlying block?
|
||||
*
|
||||
* @param world The world
|
||||
* @param pos Block position in world
|
||||
* @param level The level
|
||||
* @param pos Block position in level
|
||||
* @param player The Player that is wielding the item
|
||||
* @return
|
||||
*/
|
||||
default boolean doesSneakBypassUse(net.minecraft.world.level.LevelReader world, BlockPos pos, Player player)
|
||||
default boolean doesSneakBypassUse(net.minecraft.world.level.LevelReader level, BlockPos pos, Player player)
|
||||
{
|
||||
return self().isEmpty() || self().getItem().doesSneakBypassUse(self(), world, pos, player);
|
||||
return self().isEmpty() || self().getItem().doesSneakBypassUse(self(), level, pos, player);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,10 +34,10 @@ public interface IForgeMobEffect
|
||||
/**
|
||||
* Used for determining {@code PotionEffect} sort order in GUIs.
|
||||
* Defaults to the {@code PotionEffect}'s liquid color.
|
||||
* @param potionEffect the {@code PotionEffect} instance containing the potion
|
||||
* @param effectInstance the {@code PotionEffect} instance containing the potion
|
||||
* @return a value used to sort {@code PotionEffect}s in GUIs
|
||||
*/
|
||||
default int getSortOrder(MobEffectInstance potionEffect) {
|
||||
default int getSortOrder(MobEffectInstance effectInstance) {
|
||||
return self().getColor();
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,6 @@ public class LootModifierManager extends SimpleJsonResourceReloadListener {
|
||||
|
||||
/**
|
||||
* An immutable collection of the registered loot modifiers in layered order.
|
||||
* @return
|
||||
*/
|
||||
public Collection<IGlobalLootModifier> getAllLootMods() {
|
||||
return registeredLootModifiers.values();
|
||||
|
||||
@@ -76,10 +76,10 @@ import java.util.UUID;
|
||||
//Preliminary, simple Fake Player class
|
||||
public class FakePlayer extends ServerPlayer
|
||||
{
|
||||
public FakePlayer(ServerLevel world, GameProfile name)
|
||||
public FakePlayer(ServerLevel level, GameProfile name)
|
||||
{
|
||||
super(world.getServer(), world, name);
|
||||
this.connection = new FakePlayerNetHandler(world.getServer(), this);
|
||||
super(level.getServer(), level, name);
|
||||
this.connection = new FakePlayerNetHandler(level.getServer(), this);
|
||||
}
|
||||
|
||||
@Override public Vec3 position(){ return new Vec3(0, 0, 0); }
|
||||
|
||||
@@ -54,7 +54,8 @@ public class TablePrinter<T>
|
||||
return this;
|
||||
}
|
||||
|
||||
public TablePrinter<T> add(T row, @SuppressWarnings("unchecked") T... more)
|
||||
@SuppressWarnings("unchecked")
|
||||
public TablePrinter<T> add(T row, T... more)
|
||||
{
|
||||
add(row);
|
||||
for (T t : more)
|
||||
|
||||
@@ -44,7 +44,7 @@ public class ForgeChunkManager
|
||||
private static final Map<String, LoadingValidationCallback> callbacks = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Sets the forced chunk loading validation callback for the given mod. This allows for validating and removing no longer valid tickets on world load.
|
||||
* Sets the forced chunk loading validation callback for the given mod. This allows for validating and removing no longer valid tickets on level load.
|
||||
*
|
||||
* @apiNote This method should be called from a {@link net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent} using one of the {@link
|
||||
* net.minecraftforge.fml.event.lifecycle.ParallelDispatchEvent} enqueueWork methods.
|
||||
@@ -58,11 +58,11 @@ public class ForgeChunkManager
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a world has any forced chunks. Mainly used for seeing if a world should continue ticking with no players in it.
|
||||
* Checks if a level has any forced chunks. Mainly used for seeing if a level should continue ticking with no players in it.
|
||||
*/
|
||||
public static boolean hasForcedChunks(ServerLevel world)
|
||||
public static boolean hasForcedChunks(ServerLevel level)
|
||||
{
|
||||
ForcedChunksSavedData data = world.getDataStorage().get(ForcedChunksSavedData::load, "chunks");
|
||||
ForcedChunksSavedData data = level.getDataStorage().get(ForcedChunksSavedData::load, "chunks");
|
||||
if (data == null) return false;
|
||||
return !data.getChunks().isEmpty() || !data.getBlockForcedChunks().isEmpty() || !data.getEntityForcedChunks().isEmpty();
|
||||
}
|
||||
@@ -73,9 +73,9 @@ public class ForgeChunkManager
|
||||
* @param add {@code true} to force the chunk, {@code false} to unforce the chunk.
|
||||
* @param ticking {@code true} to make the chunk receive full chunk ticks even if there is no player nearby.
|
||||
*/
|
||||
public static boolean forceChunk(ServerLevel world, String modId, BlockPos owner, int chunkX, int chunkZ, boolean add, boolean ticking)
|
||||
public static boolean forceChunk(ServerLevel level, String modId, BlockPos owner, int chunkX, int chunkZ, boolean add, boolean ticking)
|
||||
{
|
||||
return forceChunk(world, modId, owner, chunkX, chunkZ, add, ticking, ticking ? BLOCK_TICKING : BLOCK, ForcedChunksSavedData::getBlockForcedChunks);
|
||||
return forceChunk(level, modId, owner, chunkX, chunkZ, add, ticking, ticking ? BLOCK_TICKING : BLOCK, ForcedChunksSavedData::getBlockForcedChunks);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,9 +84,9 @@ public class ForgeChunkManager
|
||||
* @param add {@code true} to force the chunk, {@code false} to unforce the chunk.
|
||||
* @param ticking {@code true} to make the chunk receive full chunk ticks even if there is no player nearby.
|
||||
*/
|
||||
public static boolean forceChunk(ServerLevel world, String modId, Entity owner, int chunkX, int chunkZ, boolean add, boolean ticking)
|
||||
public static boolean forceChunk(ServerLevel level, String modId, Entity owner, int chunkX, int chunkZ, boolean add, boolean ticking)
|
||||
{
|
||||
return forceChunk(world, modId, owner.getUUID(), chunkX, chunkZ, add, ticking);
|
||||
return forceChunk(level, modId, owner.getUUID(), chunkX, chunkZ, add, ticking);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,9 +95,9 @@ public class ForgeChunkManager
|
||||
* @param add {@code true} to force the chunk, {@code false} to unforce the chunk.
|
||||
* @param ticking {@code true} to make the chunk receive full chunk ticks even if there is no player nearby.
|
||||
*/
|
||||
public static boolean forceChunk(ServerLevel world, String modId, UUID owner, int chunkX, int chunkZ, boolean add, boolean ticking)
|
||||
public static boolean forceChunk(ServerLevel level, String modId, UUID owner, int chunkX, int chunkZ, boolean add, boolean ticking)
|
||||
{
|
||||
return forceChunk(world, modId, owner, chunkX, chunkZ, add, ticking, ticking ? ENTITY_TICKING : ENTITY, ForcedChunksSavedData::getEntityForcedChunks);
|
||||
return forceChunk(level, modId, owner, chunkX, chunkZ, add, ticking, ticking ? ENTITY_TICKING : ENTITY, ForcedChunksSavedData::getEntityForcedChunks);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,7 +107,7 @@ public class ForgeChunkManager
|
||||
*
|
||||
* @implNote Based on {@link ServerLevel#setChunkForced(int, int, boolean)}
|
||||
*/
|
||||
private static <T extends Comparable<? super T>> boolean forceChunk(ServerLevel world, String modId, T owner, int chunkX, int chunkZ, boolean add, boolean ticking,
|
||||
private static <T extends Comparable<? super T>> boolean forceChunk(ServerLevel level, String modId, T owner, int chunkX, int chunkZ, boolean add, boolean ticking,
|
||||
TicketType<TicketOwner<T>> type, Function<ForcedChunksSavedData, TicketTracker<T>> ticketGetter)
|
||||
{
|
||||
if (!ModList.get().isLoaded(modId))
|
||||
@@ -115,7 +115,7 @@ public class ForgeChunkManager
|
||||
LOGGER.warn("A mod attempted to force a chunk for an unloaded mod of id: {}", modId);
|
||||
return false;
|
||||
}
|
||||
ForcedChunksSavedData saveData = world.getDataStorage().computeIfAbsent(ForcedChunksSavedData::load, ForcedChunksSavedData::new, "chunks");
|
||||
ForcedChunksSavedData saveData = level.getDataStorage().computeIfAbsent(ForcedChunksSavedData::load, ForcedChunksSavedData::new, "chunks");
|
||||
ChunkPos pos = new ChunkPos(chunkX, chunkZ);
|
||||
long chunk = pos.toLong();
|
||||
TicketTracker<T> tickets = ticketGetter.apply(saveData);
|
||||
@@ -125,7 +125,7 @@ public class ForgeChunkManager
|
||||
{
|
||||
success = tickets.add(ticketOwner, chunk, ticking);
|
||||
if (success)
|
||||
world.getChunk(chunkX, chunkZ);
|
||||
level.getChunk(chunkX, chunkZ);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -134,13 +134,13 @@ public class ForgeChunkManager
|
||||
if (success)
|
||||
{
|
||||
saveData.setDirty(true);
|
||||
forceChunk(world, pos, type, ticketOwner, add, ticking);
|
||||
forceChunk(level, pos, type, ticketOwner, add, ticking);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds/Removes a ticket from the world's chunk provider with the proper levels to match the forced chunks.
|
||||
* Adds/Removes a ticket from the level's chunk provider with the proper levels to match the forced chunks.
|
||||
*
|
||||
* @param add {@code true} to force the chunk, {@code false} to unforce the chunk.
|
||||
* @param ticking {@code true} to make the chunk receive full chunk ticks even if there is no player nearby.
|
||||
@@ -148,29 +148,29 @@ public class ForgeChunkManager
|
||||
* @implNote We use distance 2 for what we pass, as when using register/releaseTicket the ticket's level is set to 33 - distance and the level that forced chunks use
|
||||
* is 31.
|
||||
*/
|
||||
private static <T extends Comparable<? super T>> void forceChunk(ServerLevel world, ChunkPos pos, TicketType<TicketOwner<T>> type, TicketOwner<T> owner, boolean add,
|
||||
private static <T extends Comparable<? super T>> void forceChunk(ServerLevel level, ChunkPos pos, TicketType<TicketOwner<T>> type, TicketOwner<T> owner, boolean add,
|
||||
boolean ticking)
|
||||
{
|
||||
if (add)
|
||||
{
|
||||
if (ticking)
|
||||
world.getChunkSource().registerTickingTicket(type, pos, 2, owner);
|
||||
level.getChunkSource().registerTickingTicket(type, pos, 2, owner);
|
||||
else
|
||||
world.getChunkSource().addRegionTicket(type, pos, 2, owner);
|
||||
level.getChunkSource().addRegionTicket(type, pos, 2, owner);
|
||||
}
|
||||
else if (ticking)
|
||||
world.getChunkSource().releaseTickingTicket(type, pos, 2, owner);
|
||||
level.getChunkSource().releaseTickingTicket(type, pos, 2, owner);
|
||||
else
|
||||
world.getChunkSource().removeRegionTicket(type, pos, 2, owner);
|
||||
level.getChunkSource().removeRegionTicket(type, pos, 2, owner);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reinstates forge's forced chunks when vanilla initially loads a world and reinstates their forced chunks. This method also will validate all of forge's forced
|
||||
* Reinstates forge's forced chunks when vanilla initially loads a level and reinstates their forced chunks. This method also will validate all of forge's forced
|
||||
* chunks using and registered {@link LoadingValidationCallback}.
|
||||
*
|
||||
* @apiNote Internal
|
||||
*/
|
||||
public static void reinstatePersistentChunks(ServerLevel world, ForcedChunksSavedData saveData)
|
||||
public static void reinstatePersistentChunks(ServerLevel level, ForcedChunksSavedData saveData)
|
||||
{
|
||||
if (!callbacks.isEmpty())
|
||||
{
|
||||
@@ -187,15 +187,15 @@ public class ForgeChunkManager
|
||||
{
|
||||
Map<BlockPos, Pair<LongSet, LongSet>> ownedBlockTickets = hasBlockTicket ? Collections.unmodifiableMap(blockTickets.get(modId)) : Collections.emptyMap();
|
||||
Map<UUID, Pair<LongSet, LongSet>> ownedEntityTickets = hasEntityTicket ? Collections.unmodifiableMap(entityTickets.get(modId)) : Collections.emptyMap();
|
||||
entry.getValue().validateTickets(world, new TicketHelper(saveData, modId, ownedBlockTickets, ownedEntityTickets));
|
||||
entry.getValue().validateTickets(level, new TicketHelper(saveData, modId, ownedBlockTickets, ownedEntityTickets));
|
||||
}
|
||||
}
|
||||
}
|
||||
//Reinstate the chunks that we want to load
|
||||
reinstatePersistentChunks(world, BLOCK, saveData.getBlockForcedChunks().chunks, false);
|
||||
reinstatePersistentChunks(world, BLOCK_TICKING, saveData.getBlockForcedChunks().tickingChunks, true);
|
||||
reinstatePersistentChunks(world, ENTITY, saveData.getEntityForcedChunks().chunks, false);
|
||||
reinstatePersistentChunks(world, ENTITY_TICKING, saveData.getEntityForcedChunks().tickingChunks, true);
|
||||
reinstatePersistentChunks(level, BLOCK, saveData.getBlockForcedChunks().chunks, false);
|
||||
reinstatePersistentChunks(level, BLOCK_TICKING, saveData.getBlockForcedChunks().tickingChunks, true);
|
||||
reinstatePersistentChunks(level, ENTITY, saveData.getEntityForcedChunks().chunks, false);
|
||||
reinstatePersistentChunks(level, ENTITY_TICKING, saveData.getEntityForcedChunks().tickingChunks, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -224,16 +224,16 @@ public class ForgeChunkManager
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds back any persistent forced chunks to the world's chunk provider.
|
||||
* Adds back any persistent forced chunks to the level's chunk provider.
|
||||
*/
|
||||
private static <T extends Comparable<? super T>> void reinstatePersistentChunks(ServerLevel world, TicketType<TicketOwner<T>> type,
|
||||
private static <T extends Comparable<? super T>> void reinstatePersistentChunks(ServerLevel level, TicketType<TicketOwner<T>> type,
|
||||
Map<TicketOwner<T>, LongSet> tickets, boolean ticking)
|
||||
{
|
||||
for (Map.Entry<TicketOwner<T>, LongSet> entry : tickets.entrySet())
|
||||
{
|
||||
for (long chunk : entry.getValue())
|
||||
{
|
||||
forceChunk(world, new ChunkPos(chunk), type, entry.getKey(), true, ticking);
|
||||
forceChunk(level, new ChunkPos(chunk), type, entry.getKey(), true, ticking);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -321,7 +321,7 @@ public class ForgeChunkManager
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.warn("Found chunk loading data for mod {} which is currently not available or active - it will be removed from the world save.", modId);
|
||||
LOGGER.warn("Found chunk loading data for mod {} which is currently not available or active - it will be removed from the level save.", modId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -355,10 +355,10 @@ public class ForgeChunkManager
|
||||
/**
|
||||
* Called back when tickets are about to be loaded and reinstated to allow mods to invalidate and remove specific tickets that may no longer be valid.
|
||||
*
|
||||
* @param world The world
|
||||
* @param level The level
|
||||
* @param ticketHelper Ticket helper to remove any invalid tickets.
|
||||
*/
|
||||
void validateTickets(ServerLevel world, TicketHelper ticketHelper);
|
||||
void validateTickets(ServerLevel level, TicketHelper ticketHelper);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -156,9 +156,9 @@ public class ForgeEventFactory
|
||||
return MinecraftForge.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static NeighborNotifyEvent onNeighborNotify(Level world, BlockPos pos, BlockState state, EnumSet<Direction> notifiedSides, boolean forceRedstoneUpdate)
|
||||
public static NeighborNotifyEvent onNeighborNotify(Level level, BlockPos pos, BlockState state, EnumSet<Direction> notifiedSides, boolean forceRedstoneUpdate)
|
||||
{
|
||||
NeighborNotifyEvent event = new NeighborNotifyEvent(world, pos, state, notifiedSides, forceRedstoneUpdate);
|
||||
NeighborNotifyEvent event = new NeighborNotifyEvent(level, pos, state, notifiedSides, forceRedstoneUpdate);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event;
|
||||
}
|
||||
@@ -181,33 +181,33 @@ public class ForgeEventFactory
|
||||
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(player, stack, hand));
|
||||
}
|
||||
|
||||
public static Result canEntitySpawn(Mob entity, LevelAccessor world, double x, double y, double z, BaseSpawner spawner, MobSpawnType spawnReason)
|
||||
public static Result canEntitySpawn(Mob entity, LevelAccessor level, double x, double y, double z, BaseSpawner spawner, MobSpawnType spawnReason)
|
||||
{
|
||||
if (entity == null)
|
||||
return Result.DEFAULT;
|
||||
LivingSpawnEvent.CheckSpawn event = new LivingSpawnEvent.CheckSpawn(entity, world, x, y, z, spawner, spawnReason);
|
||||
LivingSpawnEvent.CheckSpawn event = new LivingSpawnEvent.CheckSpawn(entity, level, x, y, z, spawner, spawnReason);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event.getResult();
|
||||
}
|
||||
|
||||
@Deprecated(forRemoval = true, since = "1.18.1")
|
||||
public static boolean canEntitySpawnSpawner(Mob entity, Level world, float x, float y, float z, BaseSpawner spawner)
|
||||
public static boolean canEntitySpawnSpawner(Mob entity, Level level, float x, float y, float z, BaseSpawner spawner)
|
||||
{
|
||||
Result result = canEntitySpawn(entity, world, x, y, z, spawner, MobSpawnType.SPAWNER);
|
||||
Result result = canEntitySpawn(entity, level, x, y, z, spawner, MobSpawnType.SPAWNER);
|
||||
if (result == Result.DEFAULT)
|
||||
return entity.checkSpawnRules(world, MobSpawnType.SPAWNER) && entity.checkSpawnObstruction(world); // vanilla logic (inverted)
|
||||
return entity.checkSpawnRules(level, MobSpawnType.SPAWNER) && entity.checkSpawnObstruction(level); // vanilla logic (inverted)
|
||||
else
|
||||
return result == Result.ALLOW;
|
||||
}
|
||||
|
||||
@Deprecated(forRemoval = true, since = "1.18.1")
|
||||
public static boolean doSpecialSpawn(Mob entity, Level world, float x, float y, float z, BaseSpawner spawner, MobSpawnType spawnReason)
|
||||
public static boolean doSpecialSpawn(Mob entity, Level level, float x, float y, float z, BaseSpawner spawner, MobSpawnType spawnReason)
|
||||
{
|
||||
return doSpecialSpawn(entity, (LevelAccessor)world, x, y, z, spawner, spawnReason);
|
||||
return doSpecialSpawn(entity, (LevelAccessor)level, x, y, z, spawner, spawnReason);
|
||||
}
|
||||
public static boolean doSpecialSpawn(Mob entity, LevelAccessor world, float x, float y, float z, BaseSpawner spawner, MobSpawnType spawnReason)
|
||||
public static boolean doSpecialSpawn(Mob entity, LevelAccessor level, float x, float y, float z, BaseSpawner spawner, MobSpawnType spawnReason)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new LivingSpawnEvent.SpecialSpawn(entity, world, x, y, z, spawner, spawnReason));
|
||||
return MinecraftForge.EVENT_BUS.post(new LivingSpawnEvent.SpecialSpawn(entity, level, x, y, z, spawner, spawnReason));
|
||||
}
|
||||
|
||||
public static Result canEntityDespawn(Mob entity)
|
||||
@@ -255,9 +255,9 @@ public class ForgeEventFactory
|
||||
return event.getDisplayName();
|
||||
}
|
||||
|
||||
public static BlockState fireFluidPlaceBlockEvent(LevelAccessor world, BlockPos pos, BlockPos liquidPos, BlockState state)
|
||||
public static BlockState fireFluidPlaceBlockEvent(LevelAccessor level, BlockPos pos, BlockPos liquidPos, BlockState state)
|
||||
{
|
||||
BlockEvent.FluidPlaceBlockEvent event = new BlockEvent.FluidPlaceBlockEvent(world, pos, liquidPos, state);
|
||||
BlockEvent.FluidPlaceBlockEvent event = new BlockEvent.FluidPlaceBlockEvent(level, pos, liquidPos, state);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event.getNewState();
|
||||
}
|
||||
@@ -269,9 +269,9 @@ public class ForgeEventFactory
|
||||
return event;
|
||||
}
|
||||
|
||||
public static SummonAidEvent fireZombieSummonAid(Zombie zombie, Level world, int x, int y, int z, LivingEntity attacker, double summonChance)
|
||||
public static SummonAidEvent fireZombieSummonAid(Zombie zombie, Level level, int x, int y, int z, LivingEntity attacker, double summonChance)
|
||||
{
|
||||
SummonAidEvent summonEvent = new SummonAidEvent(zombie, world, x, y, z, attacker, summonChance);
|
||||
SummonAidEvent summonEvent = new SummonAidEvent(zombie, level, x, y, z, attacker, summonChance);
|
||||
MinecraftForge.EVENT_BUS.post(summonEvent);
|
||||
return summonEvent;
|
||||
}
|
||||
@@ -359,19 +359,19 @@ public class ForgeEventFactory
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static BlockState onToolUse(BlockState originalState, Level world, BlockPos pos, Player player, ItemStack stack, ToolAction toolAction)
|
||||
public static BlockState onToolUse(BlockState originalState, Level level, BlockPos pos, Player player, ItemStack stack, ToolAction toolAction)
|
||||
{
|
||||
BlockToolInteractEvent event = new BlockToolInteractEvent(world, pos, originalState, player, stack, toolAction);
|
||||
BlockToolInteractEvent event = new BlockToolInteractEvent(level, pos, originalState, player, stack, toolAction);
|
||||
return MinecraftForge.EVENT_BUS.post(event) ? null : event.getFinalState();
|
||||
}
|
||||
|
||||
public static int onApplyBonemeal(@Nonnull Player player, @Nonnull Level world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull ItemStack stack)
|
||||
public static int onApplyBonemeal(@Nonnull Player player, @Nonnull Level level, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull ItemStack stack)
|
||||
{
|
||||
BonemealEvent event = new BonemealEvent(player, world, pos, state, stack);
|
||||
BonemealEvent event = new BonemealEvent(player, level, pos, state, stack);
|
||||
if (MinecraftForge.EVENT_BUS.post(event)) return -1;
|
||||
if (event.getResult() == Result.ALLOW)
|
||||
{
|
||||
if (!world.isClientSide)
|
||||
if (!level.isClientSide)
|
||||
stack.shrink(1);
|
||||
return 1;
|
||||
}
|
||||
@@ -379,9 +379,9 @@ public class ForgeEventFactory
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static InteractionResultHolder<ItemStack> onBucketUse(@Nonnull Player player, @Nonnull Level world, @Nonnull ItemStack stack, @Nullable HitResult target)
|
||||
public static InteractionResultHolder<ItemStack> onBucketUse(@Nonnull Player player, @Nonnull Level level, @Nonnull ItemStack stack, @Nullable HitResult target)
|
||||
{
|
||||
FillBucketEvent event = new FillBucketEvent(player, stack, world, target);
|
||||
FillBucketEvent event = new FillBucketEvent(player, stack, level, target);
|
||||
if (MinecraftForge.EVENT_BUS.post(event)) return new InteractionResultHolder<ItemStack>(InteractionResult.FAIL, stack);
|
||||
|
||||
if (event.getResult() == Result.ALLOW)
|
||||
@@ -465,9 +465,9 @@ public class ForgeEventFactory
|
||||
MinecraftForge.EVENT_BUS.post(new PlayerFlyableFallEvent(player, distance, multiplier));
|
||||
}
|
||||
|
||||
public static boolean onPlayerSpawnSet(Player player, ResourceKey<Level> world, BlockPos pos, boolean forced)
|
||||
public static boolean onPlayerSpawnSet(Player player, ResourceKey<Level> levelKey, BlockPos pos, boolean forced)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new PlayerSetSpawnEvent(player, world, pos, forced));
|
||||
return MinecraftForge.EVENT_BUS.post(new PlayerSetSpawnEvent(player, levelKey, pos, forced));
|
||||
}
|
||||
|
||||
public static void onPlayerClone(Player player, Player oldPlayer, boolean wasDeath)
|
||||
@@ -475,12 +475,12 @@ public class ForgeEventFactory
|
||||
MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerEvent.Clone(player, oldPlayer, wasDeath));
|
||||
}
|
||||
|
||||
public static boolean onExplosionStart(Level world, Explosion explosion)
|
||||
public static boolean onExplosionStart(Level level, Explosion explosion)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new ExplosionEvent.Start(world, explosion));
|
||||
return MinecraftForge.EVENT_BUS.post(new ExplosionEvent.Start(level, explosion));
|
||||
}
|
||||
|
||||
public static void onExplosionDetonate(Level world, Explosion explosion, List<Entity> list, double diameter)
|
||||
public static void onExplosionDetonate(Level level, Explosion explosion, List<Entity> list, double diameter)
|
||||
{
|
||||
//Filter entities to only those who are effected, to prevent modders from seeing more then will be hurt.
|
||||
/* Enable this if we get issues with modders looping to much.
|
||||
@@ -493,12 +493,12 @@ public class ForgeEventFactory
|
||||
if (e.isImmuneToExplosions() || dist > 1.0F) itr.remove();
|
||||
}
|
||||
*/
|
||||
MinecraftForge.EVENT_BUS.post(new ExplosionEvent.Detonate(world, explosion, list));
|
||||
MinecraftForge.EVENT_BUS.post(new ExplosionEvent.Detonate(level, explosion, list));
|
||||
}
|
||||
|
||||
public static boolean onCreateWorldSpawn(Level world, ServerLevelData settings)
|
||||
public static boolean onCreateWorldSpawn(Level level, ServerLevelData settings)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new WorldEvent.CreateSpawnPosition(world, settings));
|
||||
return MinecraftForge.EVENT_BUS.post(new WorldEvent.CreateSpawnPosition(level, settings));
|
||||
}
|
||||
|
||||
public static float onLivingHeal(LivingEntity entity, float amount)
|
||||
@@ -606,17 +606,17 @@ public class ForgeEventFactory
|
||||
return canContinueSleep == Result.ALLOW;
|
||||
}
|
||||
|
||||
public static InteractionResultHolder<ItemStack> onArrowNock(ItemStack item, Level world, Player player, InteractionHand hand, boolean hasAmmo)
|
||||
public static InteractionResultHolder<ItemStack> onArrowNock(ItemStack item, Level level, Player player, InteractionHand hand, boolean hasAmmo)
|
||||
{
|
||||
ArrowNockEvent event = new ArrowNockEvent(player, item, hand, world, hasAmmo);
|
||||
ArrowNockEvent event = new ArrowNockEvent(player, item, hand, level, hasAmmo);
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
return new InteractionResultHolder<ItemStack>(InteractionResult.FAIL, item);
|
||||
return event.getAction();
|
||||
}
|
||||
|
||||
public static int onArrowLoose(ItemStack stack, Level world, Player player, int charge, boolean hasAmmo)
|
||||
public static int onArrowLoose(ItemStack stack, Level level, Player player, int charge, boolean hasAmmo)
|
||||
{
|
||||
ArrowLooseEvent event = new ArrowLooseEvent(player, stack, world, charge, hasAmmo);
|
||||
ArrowLooseEvent event = new ArrowLooseEvent(player, stack, level, charge, hasAmmo);
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
return -1;
|
||||
return event.getCharge();
|
||||
@@ -635,24 +635,24 @@ public class ForgeEventFactory
|
||||
return event.getTable();
|
||||
}
|
||||
|
||||
public static boolean canCreateFluidSource(LevelReader world, BlockPos pos, BlockState state, boolean def)
|
||||
public static boolean canCreateFluidSource(LevelReader level, BlockPos pos, BlockState state, boolean def)
|
||||
{
|
||||
CreateFluidSourceEvent evt = new CreateFluidSourceEvent(world, pos, state);
|
||||
CreateFluidSourceEvent evt = new CreateFluidSourceEvent(level, pos, state);
|
||||
MinecraftForge.EVENT_BUS.post(evt);
|
||||
|
||||
Result result = evt.getResult();
|
||||
return result == Result.DEFAULT ? def : result == Result.ALLOW;
|
||||
}
|
||||
|
||||
public static Optional<PortalShape> onTrySpawnPortal(LevelAccessor world, BlockPos pos, Optional<PortalShape> size)
|
||||
public static Optional<PortalShape> onTrySpawnPortal(LevelAccessor level, BlockPos pos, Optional<PortalShape> size)
|
||||
{
|
||||
if (!size.isPresent()) return size;
|
||||
return !MinecraftForge.EVENT_BUS.post(new BlockEvent.PortalSpawnEvent(world, pos, world.getBlockState(pos), size.get())) ? size : Optional.empty();
|
||||
return !MinecraftForge.EVENT_BUS.post(new BlockEvent.PortalSpawnEvent(level, pos, level.getBlockState(pos), size.get())) ? size : Optional.empty();
|
||||
}
|
||||
|
||||
public static int onEnchantmentLevelSet(Level world, BlockPos pos, int enchantRow, int power, ItemStack itemStack, int level)
|
||||
public static int onEnchantmentLevelSet(Level level, BlockPos pos, int enchantRow, int power, ItemStack itemStack, int enchantmentLevel)
|
||||
{
|
||||
net.minecraftforge.event.enchanting.EnchantmentLevelSetEvent e = new net.minecraftforge.event.enchanting.EnchantmentLevelSetEvent(world, pos, enchantRow, power, itemStack, level);
|
||||
net.minecraftforge.event.enchanting.EnchantmentLevelSetEvent e = new net.minecraftforge.event.enchanting.EnchantmentLevelSetEvent(level, pos, enchantRow, power, itemStack, enchantmentLevel);
|
||||
net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e);
|
||||
return e.getLevel();
|
||||
}
|
||||
@@ -662,49 +662,49 @@ public class ForgeEventFactory
|
||||
return !MinecraftForge.EVENT_BUS.post(new LivingDestroyBlockEvent(entity, pos, state));
|
||||
}
|
||||
|
||||
public static boolean getMobGriefingEvent(Level world, Entity entity)
|
||||
public static boolean getMobGriefingEvent(Level level, Entity entity)
|
||||
{
|
||||
EntityMobGriefingEvent event = new EntityMobGriefingEvent(entity);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
|
||||
Result result = event.getResult();
|
||||
return result == Result.DEFAULT ? world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) : result == Result.ALLOW;
|
||||
return result == Result.DEFAULT ? level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) : result == Result.ALLOW;
|
||||
}
|
||||
|
||||
public static boolean saplingGrowTree(LevelAccessor world, Random rand, BlockPos pos)
|
||||
public static boolean saplingGrowTree(LevelAccessor level, Random rand, BlockPos pos)
|
||||
{
|
||||
SaplingGrowTreeEvent event = new SaplingGrowTreeEvent(world, rand, pos);
|
||||
SaplingGrowTreeEvent event = new SaplingGrowTreeEvent(level, rand, pos);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event.getResult() != Result.DENY;
|
||||
}
|
||||
|
||||
public static void fireChunkWatch(boolean watch, ServerPlayer entity, ChunkPos chunkpos, ServerLevel world)
|
||||
public static void fireChunkWatch(boolean watch, ServerPlayer entity, ChunkPos chunkpos, ServerLevel level)
|
||||
{
|
||||
if (watch)
|
||||
MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.Watch(entity, chunkpos, world));
|
||||
MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.Watch(entity, chunkpos, level));
|
||||
else
|
||||
MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.UnWatch(entity, chunkpos, world));
|
||||
MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.UnWatch(entity, chunkpos, level));
|
||||
}
|
||||
|
||||
public static void fireChunkWatch(boolean wasLoaded, boolean load, ServerPlayer entity, ChunkPos chunkpos, ServerLevel world)
|
||||
public static void fireChunkWatch(boolean wasLoaded, boolean load, ServerPlayer entity, ChunkPos chunkpos, ServerLevel level)
|
||||
{
|
||||
if (wasLoaded != load)
|
||||
fireChunkWatch(load, entity, chunkpos, world);
|
||||
fireChunkWatch(load, entity, chunkpos, level);
|
||||
}
|
||||
|
||||
public static boolean onPistonMovePre(Level world, BlockPos pos, Direction direction, boolean extending)
|
||||
public static boolean onPistonMovePre(Level level, BlockPos pos, Direction direction, boolean extending)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new PistonEvent.Pre(world, pos, direction, extending ? PistonEvent.PistonMoveType.EXTEND : PistonEvent.PistonMoveType.RETRACT));
|
||||
return MinecraftForge.EVENT_BUS.post(new PistonEvent.Pre(level, pos, direction, extending ? PistonEvent.PistonMoveType.EXTEND : PistonEvent.PistonMoveType.RETRACT));
|
||||
}
|
||||
|
||||
public static boolean onPistonMovePost(Level world, BlockPos pos, Direction direction, boolean extending)
|
||||
public static boolean onPistonMovePost(Level level, BlockPos pos, Direction direction, boolean extending)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new PistonEvent.Post(world, pos, direction, extending ? PistonEvent.PistonMoveType.EXTEND : PistonEvent.PistonMoveType.RETRACT));
|
||||
return MinecraftForge.EVENT_BUS.post(new PistonEvent.Post(level, pos, direction, extending ? PistonEvent.PistonMoveType.EXTEND : PistonEvent.PistonMoveType.RETRACT));
|
||||
}
|
||||
|
||||
public static long onSleepFinished(ServerLevel world, long newTime, long minTime)
|
||||
public static long onSleepFinished(ServerLevel level, long newTime, long minTime)
|
||||
{
|
||||
SleepFinishedTimeEvent event = new SleepFinishedTimeEvent(world, newTime, minTime);
|
||||
SleepFinishedTimeEvent event = new SleepFinishedTimeEvent(level, newTime, minTime);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event.getNewTime();
|
||||
}
|
||||
@@ -848,14 +848,14 @@ public class ForgeEventFactory
|
||||
MinecraftForge.EVENT_BUS.post(new TickEvent.PlayerTickEvent(TickEvent.Phase.END, player));
|
||||
}
|
||||
|
||||
public static void onPreWorldTick(Level world)
|
||||
public static void onPreWorldTick(Level level)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new TickEvent.WorldTickEvent(LogicalSide.SERVER, TickEvent.Phase.START, world));
|
||||
MinecraftForge.EVENT_BUS.post(new TickEvent.WorldTickEvent(LogicalSide.SERVER, TickEvent.Phase.START, level));
|
||||
}
|
||||
|
||||
public static void onPostWorldTick(Level world)
|
||||
public static void onPostWorldTick(Level level)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new TickEvent.WorldTickEvent(LogicalSide.SERVER, TickEvent.Phase.END, world));
|
||||
MinecraftForge.EVENT_BUS.post(new TickEvent.WorldTickEvent(LogicalSide.SERVER, TickEvent.Phase.END, level));
|
||||
}
|
||||
|
||||
public static void onPreClientTick()
|
||||
|
||||
@@ -304,7 +304,6 @@ public class PlayerEvent extends LivingEvent
|
||||
/**
|
||||
* Construct and return a recommended file for the supplied suffix
|
||||
* @param suffix The suffix to use.
|
||||
* @return
|
||||
*/
|
||||
public File getPlayerFile(String suffix)
|
||||
{
|
||||
@@ -357,7 +356,6 @@ public class PlayerEvent extends LivingEvent
|
||||
/**
|
||||
* Construct and return a recommended file for the supplied suffix
|
||||
* @param suffix The suffix to use.
|
||||
* @return
|
||||
*/
|
||||
public File getPlayerFile(String suffix)
|
||||
{
|
||||
|
||||
@@ -82,9 +82,9 @@ public class BlockEvent extends Event
|
||||
}
|
||||
else
|
||||
{
|
||||
int bonusLevel = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.BLOCK_FORTUNE, player.getMainHandItem());
|
||||
int silklevel = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, player.getMainHandItem());
|
||||
this.exp = state.getExpDrop(world, pos, bonusLevel, silklevel);
|
||||
int fortuneLevel = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.BLOCK_FORTUNE, player.getMainHandItem());
|
||||
int silkTouchLevel = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, player.getMainHandItem());
|
||||
this.exp = state.getExpDrop(world, pos, fortuneLevel, silkTouchLevel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ChunkDataEvent extends ChunkEvent
|
||||
/**
|
||||
* ChunkDataEvent.Load is fired when vanilla Minecraft attempts to load Chunk data.<br>
|
||||
* This event is fired during chunk loading in
|
||||
* {@link ChunkSerializer#read(ServerLevel, StructureManager, PoiManager, ChunkPos, CompoundTag)} which means it is async, so be careful.<br>
|
||||
* {@link ChunkSerializer#read(ServerLevel, PoiManager, ChunkPos, CompoundTag)} which means it is async, so be careful.<br>
|
||||
* <br>
|
||||
* This event is not {@link Cancelable}.<br>
|
||||
* <br>
|
||||
|
||||
@@ -23,7 +23,6 @@ public abstract class PistonEvent extends BlockEvent
|
||||
private final PistonMoveType moveType;
|
||||
|
||||
/**
|
||||
* @param world
|
||||
* @param pos - The position of the piston
|
||||
* @param direction - The move direction of the piston
|
||||
*/
|
||||
|
||||
@@ -50,7 +50,7 @@ public class WorldEvent extends Event
|
||||
/**
|
||||
* WorldEvent.Load is fired when Minecraft loads a world.<br>
|
||||
* This event is fired when a world is loaded in
|
||||
* {@link ClientLevel#ClientLevel(ClientPacketListener, ClientLevel.ClientLevelData, ResourceKey, DimensionType, int, Supplier, LevelRenderer, boolean, long)},
|
||||
* {@link ClientLevel#ClientLevel(ClientPacketListener, ClientLevel.ClientLevelData, ResourceKey, DimensionType, int, int, Supplier, LevelRenderer, boolean, long)},
|
||||
* {@code MinecraftServer#createLevels(ChunkProgressListener)}. <br>
|
||||
* <br>
|
||||
* This event is not {@link Cancelable}.<br>
|
||||
|
||||
@@ -55,11 +55,11 @@ public class DispenseFluidContainer extends DefaultDispenseItemBehavior
|
||||
@Nonnull
|
||||
private ItemStack fillContainer(@Nonnull BlockSource source, @Nonnull ItemStack stack)
|
||||
{
|
||||
Level world = source.getLevel();
|
||||
Level level = source.getLevel();
|
||||
Direction dispenserFacing = source.getBlockState().getValue(DispenserBlock.FACING);
|
||||
BlockPos blockpos = source.getPos().relative(dispenserFacing);
|
||||
|
||||
FluidActionResult actionResult = FluidUtil.tryPickUpFluid(stack, null, world, blockpos, dispenserFacing.getOpposite());
|
||||
FluidActionResult actionResult = FluidUtil.tryPickUpFluid(stack, null, level, blockpos, dispenserFacing.getOpposite());
|
||||
ItemStack resultStack = actionResult.getResult();
|
||||
|
||||
if (!actionResult.isSuccess() || resultStack.isEmpty())
|
||||
|
||||
@@ -308,17 +308,17 @@ public class FluidAttributes
|
||||
public SoundEvent getEmptySound(FluidStack stack) { return getEmptySound(); }
|
||||
|
||||
/* World-based Accessors */
|
||||
public int getLuminosity(BlockAndTintGetter world, BlockPos pos){ return getLuminosity(); }
|
||||
public int getDensity(BlockAndTintGetter world, BlockPos pos){ return getDensity(); }
|
||||
public int getTemperature(BlockAndTintGetter world, BlockPos pos){ return getTemperature(); }
|
||||
public int getViscosity(BlockAndTintGetter world, BlockPos pos){ return getViscosity(); }
|
||||
public boolean isGaseous(BlockAndTintGetter world, BlockPos pos){ return isGaseous(); }
|
||||
public Rarity getRarity(BlockAndTintGetter world, BlockPos pos){ return getRarity(); }
|
||||
public int getColor(BlockAndTintGetter world, BlockPos pos){ return getColor(); }
|
||||
public ResourceLocation getStillTexture(BlockAndTintGetter world, BlockPos pos) { return getStillTexture(); }
|
||||
public ResourceLocation getFlowingTexture(BlockAndTintGetter world, BlockPos pos) { return getFlowingTexture(); }
|
||||
public SoundEvent getFillSound(BlockAndTintGetter world, BlockPos pos) { return getFillSound(); }
|
||||
public SoundEvent getEmptySound(BlockAndTintGetter world, BlockPos pos) { return getEmptySound(); }
|
||||
public int getLuminosity(BlockAndTintGetter level, BlockPos pos){ return getLuminosity(); }
|
||||
public int getDensity(BlockAndTintGetter level, BlockPos pos){ return getDensity(); }
|
||||
public int getTemperature(BlockAndTintGetter level, BlockPos pos){ return getTemperature(); }
|
||||
public int getViscosity(BlockAndTintGetter level, BlockPos pos){ return getViscosity(); }
|
||||
public boolean isGaseous(BlockAndTintGetter level, BlockPos pos){ return isGaseous(); }
|
||||
public Rarity getRarity(BlockAndTintGetter level, BlockPos pos){ return getRarity(); }
|
||||
public int getColor(BlockAndTintGetter level, BlockPos pos){ return getColor(); }
|
||||
public ResourceLocation getStillTexture(BlockAndTintGetter level, BlockPos pos) { return getStillTexture(); }
|
||||
public ResourceLocation getFlowingTexture(BlockAndTintGetter level, BlockPos pos) { return getFlowingTexture(); }
|
||||
public SoundEvent getFillSound(BlockAndTintGetter level, BlockPos pos) { return getFillSound(); }
|
||||
public SoundEvent getEmptySound(BlockAndTintGetter level, BlockPos pos) { return getEmptySound(); }
|
||||
|
||||
public static Builder builder(ResourceLocation stillTexture, ResourceLocation flowingTexture) {
|
||||
return new Builder(stillTexture, flowingTexture, FluidAttributes::new);
|
||||
@@ -435,9 +435,9 @@ public class FluidAttributes
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor(BlockAndTintGetter world, BlockPos pos)
|
||||
public int getColor(BlockAndTintGetter level, BlockPos pos)
|
||||
{
|
||||
return BiomeColors.getAverageWaterColor(world, pos) | 0xFF000000;
|
||||
return BiomeColors.getAverageWaterColor(level, pos) | 0xFF000000;
|
||||
}
|
||||
|
||||
public static Builder builder(ResourceLocation stillTexture, ResourceLocation flowingTexture) {
|
||||
|
||||
@@ -279,7 +279,6 @@ public class FluidStack
|
||||
/**
|
||||
* Determines if the Fluids are equal and this stack is larger.
|
||||
*
|
||||
* @param other
|
||||
* @return true if this FluidStack contains the other FluidStack (same fluid and >= amount)
|
||||
*/
|
||||
public boolean containsFluid(@Nonnull FluidStack other)
|
||||
|
||||
@@ -58,17 +58,17 @@ public class FluidUtil
|
||||
*
|
||||
* @param player The player doing the interaction between the item and fluid handler block.
|
||||
* @param hand The player's hand that is holding an item that should interact with the fluid handler block.
|
||||
* @param world The world that contains the fluid handler block.
|
||||
* @param pos The position of the fluid handler block in the world.
|
||||
* @param level The level that contains the fluid handler block.
|
||||
* @param pos The position of the fluid handler block in the level.
|
||||
* @param side The side of the block to interact with. May be null.
|
||||
* @return true if the interaction succeeded and updated the item held by the player, false otherwise.
|
||||
*/
|
||||
public static boolean interactWithFluidHandler(@Nonnull Player player, @Nonnull InteractionHand hand, @Nonnull Level world, @Nonnull BlockPos pos, @Nullable Direction side)
|
||||
public static boolean interactWithFluidHandler(@Nonnull Player player, @Nonnull InteractionHand hand, @Nonnull Level level, @Nonnull BlockPos pos, @Nullable Direction side)
|
||||
{
|
||||
Preconditions.checkNotNull(world);
|
||||
Preconditions.checkNotNull(level);
|
||||
Preconditions.checkNotNull(pos);
|
||||
|
||||
return getFluidHandler(world, pos, side).map(handler -> interactWithFluidHandler(player, hand, handler)).orElse(false);
|
||||
return getFluidHandler(level, pos, side).map(handler -> interactWithFluidHandler(player, hand, handler)).orElse(false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -442,14 +442,14 @@ public class FluidUtil
|
||||
/**
|
||||
* Helper method to get an IFluidHandler for at a block position.
|
||||
*/
|
||||
public static LazyOptional<IFluidHandler> getFluidHandler(Level world, BlockPos blockPos, @Nullable Direction side)
|
||||
public static LazyOptional<IFluidHandler> getFluidHandler(Level level, BlockPos blockPos, @Nullable Direction side)
|
||||
{
|
||||
BlockState state = world.getBlockState(blockPos);
|
||||
BlockState state = level.getBlockState(blockPos);
|
||||
Block block = state.getBlock();
|
||||
|
||||
if (state.hasBlockEntity())
|
||||
{
|
||||
BlockEntity blockEntity = world.getBlockEntity(blockPos);
|
||||
BlockEntity blockEntity = level.getBlockEntity(blockPos);
|
||||
if (blockEntity != null)
|
||||
{
|
||||
return blockEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side);
|
||||
@@ -459,38 +459,38 @@ public class FluidUtil
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to pick up a fluid in the world and put it in an empty container item.
|
||||
* Attempts to pick up a fluid in the level and put it in an empty container item.
|
||||
*
|
||||
* @param emptyContainer The empty container to fill.
|
||||
* Will not be modified directly, if modifications are necessary a modified copy is returned in the result.
|
||||
* @param playerIn The player filling the container. Optional.
|
||||
* @param worldIn The world the fluid is in.
|
||||
* @param pos The position of the fluid in the world.
|
||||
* @param level The level the fluid is in.
|
||||
* @param pos The position of the fluid in the level.
|
||||
* @param side The side of the fluid that is being drained.
|
||||
* @return a {@link FluidActionResult} holding the result and the resulting container.
|
||||
*/
|
||||
@Nonnull
|
||||
public static FluidActionResult tryPickUpFluid(@Nonnull ItemStack emptyContainer, @Nullable Player playerIn, Level worldIn, BlockPos pos, Direction side)
|
||||
public static FluidActionResult tryPickUpFluid(@Nonnull ItemStack emptyContainer, @Nullable Player playerIn, Level level, BlockPos pos, Direction side)
|
||||
{
|
||||
if (emptyContainer.isEmpty() || worldIn == null || pos == null)
|
||||
if (emptyContainer.isEmpty() || level == null || pos == null)
|
||||
{
|
||||
return FluidActionResult.FAILURE;
|
||||
}
|
||||
|
||||
BlockState state = worldIn.getBlockState(pos);
|
||||
BlockState state = level.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
IFluidHandler targetFluidHandler;
|
||||
if (block instanceof IFluidBlock)
|
||||
{
|
||||
targetFluidHandler = new FluidBlockWrapper((IFluidBlock) block, worldIn, pos);
|
||||
targetFluidHandler = new FluidBlockWrapper((IFluidBlock) block, level, pos);
|
||||
}
|
||||
else if (block instanceof BucketPickup)
|
||||
{
|
||||
targetFluidHandler = new BucketPickupHandlerWrapper((BucketPickup) block, worldIn, pos);
|
||||
targetFluidHandler = new BucketPickupHandlerWrapper((BucketPickup) block, level, pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
Optional<IFluidHandler> fluidHandler = getFluidHandler(worldIn, pos, side).resolve();
|
||||
Optional<IFluidHandler> fluidHandler = getFluidHandler(level, pos, side).resolve();
|
||||
if (!fluidHandler.isPresent())
|
||||
{
|
||||
return FluidActionResult.FAILURE;
|
||||
@@ -505,26 +505,26 @@ public class FluidUtil
|
||||
* Use the returned {@link FluidActionResult} to update the container ItemStack.
|
||||
*
|
||||
* @param player Player who places the fluid. May be null for blocks like dispensers.
|
||||
* @param world Level to place the fluid in
|
||||
* @param hand
|
||||
* @param pos The position in the world to place the fluid block
|
||||
* @param level Level to place the fluid in
|
||||
* @param hand hand of the player to place the fluid with
|
||||
* @param pos The position in the level to place the fluid block
|
||||
* @param container The fluid container holding the fluidStack to place
|
||||
* @param resource The fluidStack to place
|
||||
* @return the container's ItemStack with the remaining amount of fluid if the placement was successful, null otherwise
|
||||
*/
|
||||
@Nonnull
|
||||
public static FluidActionResult tryPlaceFluid(@Nullable Player player, Level world, InteractionHand hand, BlockPos pos, @Nonnull ItemStack container, FluidStack resource)
|
||||
public static FluidActionResult tryPlaceFluid(@Nullable Player player, Level level, InteractionHand hand, BlockPos pos, @Nonnull ItemStack container, FluidStack resource)
|
||||
{
|
||||
ItemStack containerCopy = ItemHandlerHelper.copyStackWithSize(container, 1); // do not modify the input
|
||||
return getFluidHandler(containerCopy)
|
||||
.filter(handler -> tryPlaceFluid(player, world, hand, pos, handler, resource))
|
||||
.filter(handler -> tryPlaceFluid(player, level, hand, pos, handler, resource))
|
||||
.map(IFluidHandlerItem::getContainer)
|
||||
.map(FluidActionResult::new)
|
||||
.orElse(FluidActionResult.FAILURE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to place a fluid resource into the world as a block and drains the fluidSource.
|
||||
* Tries to place a fluid resource into the level as a block and drains the fluidSource.
|
||||
* Makes a fluid emptying or vaporization sound when successful.
|
||||
* Honors the amount of fluid contained by the used container.
|
||||
* Checks if water-like fluids should vaporize like in the nether.
|
||||
@@ -532,22 +532,22 @@ public class FluidUtil
|
||||
* Modeled after {@link BucketItem#emptyContents(Player, Level, BlockPos, BlockHitResult)}
|
||||
*
|
||||
* @param player Player who places the fluid. May be null for blocks like dispensers.
|
||||
* @param world Level to place the fluid in
|
||||
* @param hand
|
||||
* @param pos The position in the world to place the fluid block
|
||||
* @param level Level to place the fluid in
|
||||
* @param hand hand of the player to place the fluid with
|
||||
* @param pos The position in the level to place the fluid block
|
||||
* @param fluidSource The fluid source holding the fluidStack to place
|
||||
* @param resource The fluidStack to place.
|
||||
* @return true if the placement was successful, false otherwise
|
||||
*/
|
||||
public static boolean tryPlaceFluid(@Nullable Player player, Level world, InteractionHand hand, BlockPos pos, IFluidHandler fluidSource, FluidStack resource)
|
||||
public static boolean tryPlaceFluid(@Nullable Player player, Level level, InteractionHand hand, BlockPos pos, IFluidHandler fluidSource, FluidStack resource)
|
||||
{
|
||||
if (world == null || pos == null)
|
||||
if (level == null || pos == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Fluid fluid = resource.getFluid();
|
||||
if (fluid == Fluids.EMPTY || !fluid.getAttributes().canBePlacedInWorld(world, pos, resource))
|
||||
if (fluid == Fluids.EMPTY || !fluid.getAttributes().canBePlacedInWorld(level, pos, resource))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -557,25 +557,25 @@ public class FluidUtil
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockPlaceContext context = new BlockPlaceContext(world, player, hand, player == null ? ItemStack.EMPTY : player.getItemInHand(hand), new BlockHitResult(Vec3.ZERO, Direction.UP, pos, false));
|
||||
BlockPlaceContext context = new BlockPlaceContext(level, player, hand, player == null ? ItemStack.EMPTY : player.getItemInHand(hand), new BlockHitResult(Vec3.ZERO, Direction.UP, pos, false));
|
||||
|
||||
// check that we can place the fluid at the destination
|
||||
BlockState destBlockState = world.getBlockState(pos);
|
||||
BlockState destBlockState = level.getBlockState(pos);
|
||||
Material destMaterial = destBlockState.getMaterial();
|
||||
boolean isDestNonSolid = !destMaterial.isSolid();
|
||||
boolean isDestReplaceable = destBlockState.canBeReplaced(context);
|
||||
boolean canDestContainFluid = destBlockState.getBlock() instanceof LiquidBlockContainer && ((LiquidBlockContainer) destBlockState.getBlock()).canPlaceLiquid(world, pos, destBlockState, fluid);
|
||||
if (!world.isEmptyBlock(pos) && !isDestNonSolid && !isDestReplaceable && !canDestContainFluid)
|
||||
boolean canDestContainFluid = destBlockState.getBlock() instanceof LiquidBlockContainer && ((LiquidBlockContainer) destBlockState.getBlock()).canPlaceLiquid(level, pos, destBlockState, fluid);
|
||||
if (!level.isEmptyBlock(pos) && !isDestNonSolid && !isDestReplaceable && !canDestContainFluid)
|
||||
{
|
||||
return false; // Non-air, solid, unreplacable block. We can't put fluid here.
|
||||
}
|
||||
|
||||
if (world.dimensionType().ultraWarm() && fluid.getAttributes().doesVaporize(world, pos, resource))
|
||||
if (level.dimensionType().ultraWarm() && fluid.getAttributes().doesVaporize(level, pos, resource))
|
||||
{
|
||||
FluidStack result = fluidSource.drain(resource, IFluidHandler.FluidAction.EXECUTE);
|
||||
if (!result.isEmpty())
|
||||
{
|
||||
result.getFluid().getAttributes().vaporize(player, world, pos, result);
|
||||
result.getFluid().getAttributes().vaporize(player, level, pos, result);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -585,17 +585,17 @@ public class FluidUtil
|
||||
IFluidHandler handler;
|
||||
if (canDestContainFluid)
|
||||
{
|
||||
handler = new BlockWrapper.LiquidContainerBlockWrapper((LiquidBlockContainer) destBlockState.getBlock(), world, pos);
|
||||
handler = new BlockWrapper.LiquidContainerBlockWrapper((LiquidBlockContainer) destBlockState.getBlock(), level, pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
handler = getFluidBlockHandler(fluid, world, pos);
|
||||
handler = getFluidBlockHandler(fluid, level, pos);
|
||||
}
|
||||
FluidStack result = tryFluidTransfer(handler, fluidSource, resource, true);
|
||||
if (!result.isEmpty())
|
||||
{
|
||||
SoundEvent soundevent = resource.getFluid().getAttributes().getEmptySound(resource);
|
||||
world.playSound(player, pos, soundevent, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
level.playSound(player, pos, soundevent, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -608,10 +608,10 @@ public class FluidUtil
|
||||
* Modders: Instead of this method, use {@link #tryPlaceFluid(Player, Level, InteractionHand, BlockPos, ItemStack, FluidStack)}
|
||||
* or {@link #tryPlaceFluid(Player, Level, InteractionHand, BlockPos, IFluidHandler, FluidStack)}
|
||||
*/
|
||||
private static IFluidHandler getFluidBlockHandler(Fluid fluid, Level world, BlockPos pos)
|
||||
private static IFluidHandler getFluidBlockHandler(Fluid fluid, Level level, BlockPos pos)
|
||||
{
|
||||
BlockState state = fluid.getAttributes().getBlock(world, pos, fluid.defaultFluidState());
|
||||
return new BlockWrapper(state, world, pos);
|
||||
BlockState state = fluid.getAttributes().getBlock(level, pos, fluid.defaultFluidState());
|
||||
return new BlockWrapper(state, level, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -620,20 +620,20 @@ public class FluidUtil
|
||||
*
|
||||
* This is a helper method for implementing {@link IFluidBlock#place(Level, BlockPos, FluidStack, IFluidHandler.FluidAction)}.
|
||||
*
|
||||
* @param world the world that the fluid will be placed in
|
||||
* @param level the level that the fluid will be placed in
|
||||
* @param pos the location that the fluid will be placed
|
||||
*/
|
||||
public static void destroyBlockOnFluidPlacement(Level world, BlockPos pos)
|
||||
public static void destroyBlockOnFluidPlacement(Level level, BlockPos pos)
|
||||
{
|
||||
if (!world.isClientSide)
|
||||
if (!level.isClientSide)
|
||||
{
|
||||
BlockState destBlockState = world.getBlockState(pos);
|
||||
BlockState destBlockState = level.getBlockState(pos);
|
||||
Material destMaterial = destBlockState.getMaterial();
|
||||
boolean isDestNonSolid = !destMaterial.isSolid();
|
||||
boolean isDestReplaceable = false; //TODO: Needs BlockItemUseContext destBlockState.getBlock().isReplaceable(world, pos);
|
||||
boolean isDestReplaceable = false; //TODO: Needs BlockItemUseContext destBlockState.getBlock().isReplaceable(level, pos);
|
||||
if ((isDestNonSolid || isDestReplaceable) && !destMaterial.isLiquid())
|
||||
{
|
||||
world.destroyBlock(pos, true);
|
||||
level.destroyBlock(pos, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,14 +101,14 @@ public abstract class ForgeFlowingFluid extends FlowingFluid
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canBeReplacedWith(FluidState state, BlockGetter world, BlockPos pos, Fluid fluidIn, Direction direction)
|
||||
protected boolean canBeReplacedWith(FluidState state, BlockGetter level, BlockPos pos, Fluid fluidIn, Direction direction)
|
||||
{
|
||||
// Based on the water implementation, may need to be overriden for mod fluids that shouldn't behave like water.
|
||||
return direction == Direction.DOWN && !isSame(fluidIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTickDelay(LevelReader world)
|
||||
public int getTickDelay(LevelReader level)
|
||||
{
|
||||
return tickRate;
|
||||
}
|
||||
|
||||
@@ -29,13 +29,13 @@ public interface IFluidBlock
|
||||
* This method should be called by fluid containers such as buckets, but it is recommended
|
||||
* to use {@link FluidUtil}.
|
||||
*
|
||||
* @param world the world to place the block in
|
||||
* @param level the level to place the block in
|
||||
* @param pos the position to place the block at
|
||||
* @param fluidStack the fluid stack to get the required data from
|
||||
* @param action If SIMULATE, the placement will only be simulated
|
||||
* @return the amount of fluid extracted from the provided stack to achieve some fluid level
|
||||
*/
|
||||
int place(Level world, BlockPos pos, @Nonnull FluidStack fluidStack, IFluidHandler.FluidAction action);
|
||||
int place(Level level, BlockPos pos, @Nonnull FluidStack fluidStack, IFluidHandler.FluidAction action);
|
||||
|
||||
/**
|
||||
* Attempt to drain the block. This method should be called by devices such as pumps.
|
||||
@@ -44,18 +44,16 @@ public interface IFluidBlock
|
||||
*
|
||||
* @param action
|
||||
* If SIMULATE, the drain will only be simulated.
|
||||
* @return
|
||||
* @return the fluid stack after draining the block
|
||||
*/
|
||||
@Nonnull
|
||||
FluidStack drain(Level world, BlockPos pos, IFluidHandler.FluidAction action);
|
||||
FluidStack drain(Level level, BlockPos pos, IFluidHandler.FluidAction action);
|
||||
|
||||
/**
|
||||
* Check to see if a block can be drained. This method should be called by devices such as
|
||||
* pumps.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean canDrain(Level world, BlockPos pos);
|
||||
boolean canDrain(Level level, BlockPos pos);
|
||||
|
||||
/**
|
||||
* Returns the amount of a single block is filled. Value between 0 and 1.
|
||||
@@ -63,8 +61,6 @@ public interface IFluidBlock
|
||||
*
|
||||
* If the return value is negative. It will be treated as filling the block
|
||||
* from the top down instead of bottom up.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
float getFilledPercentage(Level world, BlockPos pos);
|
||||
float getFilledPercentage(Level level, BlockPos pos);
|
||||
}
|
||||
@@ -151,7 +151,7 @@ public class ItemHandlerHelper
|
||||
if (stack.isEmpty()) return;
|
||||
|
||||
IItemHandler inventory = new PlayerMainInvWrapper(player.getInventory());
|
||||
Level world = player.level;
|
||||
Level level = player.level;
|
||||
|
||||
// try adding it into the inventory
|
||||
ItemStack remainder = stack;
|
||||
@@ -169,18 +169,18 @@ public class ItemHandlerHelper
|
||||
// play sound if something got picked up
|
||||
if (remainder.isEmpty() || remainder.getCount() != stack.getCount())
|
||||
{
|
||||
world.playSound(null, player.getX(), player.getY() + 0.5, player.getZ(),
|
||||
SoundEvents.ITEM_PICKUP, SoundSource.PLAYERS, 0.2F, ((world.random.nextFloat() - world.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
level.playSound(null, player.getX(), player.getY() + 0.5, player.getZ(),
|
||||
SoundEvents.ITEM_PICKUP, SoundSource.PLAYERS, 0.2F, ((level.random.nextFloat() - level.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
}
|
||||
|
||||
// drop remaining itemstack into the world
|
||||
if (!remainder.isEmpty() && !world.isClientSide)
|
||||
// drop remaining itemstack into the level
|
||||
if (!remainder.isEmpty() && !level.isClientSide)
|
||||
{
|
||||
ItemEntity entityitem = new ItemEntity(world, player.getX(), player.getY() + 0.5, player.getZ(), remainder);
|
||||
ItemEntity entityitem = new ItemEntity(level, player.getX(), player.getY() + 0.5, player.getZ(), remainder);
|
||||
entityitem.setPickUpDelay(40);
|
||||
entityitem.setDeltaMovement(entityitem.getDeltaMovement().multiply(0, 1, 0));
|
||||
|
||||
world.addFreshEntity(entityitem);
|
||||
level.addFreshEntity(entityitem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,11 +70,11 @@ public class VanillaInventoryCodeHooks
|
||||
/**
|
||||
* Copied from BlockDropper#dispense and added capability support
|
||||
*/
|
||||
public static boolean dropperInsertHook(Level world, BlockPos pos, DispenserBlockEntity dropper, int slot, @Nonnull ItemStack stack)
|
||||
public static boolean dropperInsertHook(Level level, BlockPos pos, DispenserBlockEntity dropper, int slot, @Nonnull ItemStack stack)
|
||||
{
|
||||
Direction enumfacing = world.getBlockState(pos).getValue(DropperBlock.FACING);
|
||||
Direction enumfacing = level.getBlockState(pos).getValue(DropperBlock.FACING);
|
||||
BlockPos blockpos = pos.relative(enumfacing);
|
||||
return getItemHandler(world, (double) blockpos.getX(), (double) blockpos.getY(), (double) blockpos.getZ(), enumfacing.getOpposite())
|
||||
return getItemHandler(level, (double) blockpos.getX(), (double) blockpos.getY(), (double) blockpos.getZ(), enumfacing.getOpposite())
|
||||
.map(destinationResult -> {
|
||||
IItemHandler itemHandler = destinationResult.getKey();
|
||||
Object destination = destinationResult.getValue();
|
||||
|
||||
@@ -45,11 +45,11 @@ import net.minecraftforge.common.world.ForgeWorldPreset;
|
||||
/**
|
||||
* A class that exposes static references to all vanilla and Forge registries.
|
||||
* Created to have a central place to access the registries directly if modders need.
|
||||
* It is still advised that if you are registering things to go through {@link GameRegistry} register methods, but queries and iterations can use this.
|
||||
* It is still advised that if you are registering things to use {@link net.minecraftforge.event.RegistryEvent.Register} or {@link net.minecraftforge.registries.DeferredRegister}, but queries and iterations can use this.
|
||||
*/
|
||||
public class ForgeRegistries
|
||||
{
|
||||
static { init(); } // This must be above the fields so we guarantee it's run before findRegistry is called. Yay static inializers
|
||||
static { init(); } // This must be above the fields so we guarantee it's run before getRegistry is called. Yay static inializers
|
||||
|
||||
// Game objects
|
||||
public static final IForgeRegistry<Block> BLOCKS = RegistryManager.ACTIVE.getRegistry(Block.class);
|
||||
|
||||
@@ -172,14 +172,14 @@ public class ForgeRegistry<V extends IForgeRegistryEntry<V>> implements IForgeRe
|
||||
return tagFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Codec<V> getCodec()
|
||||
{
|
||||
return this.codec;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void registerAll(@SuppressWarnings("unchecked") V... values)
|
||||
public void registerAll(V... values)
|
||||
{
|
||||
for (V value : values)
|
||||
register(value);
|
||||
|
||||
@@ -322,7 +322,6 @@ public class GameData
|
||||
LOGGER.debug(REGISTRIES, "Reverting complete");
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes") //Eclipse compiler generics issue.
|
||||
public static Stream<IModStateTransition.EventGenerator<?>> generateRegistryEvents() {
|
||||
List<ResourceLocation> keys = Lists.newArrayList(RegistryManager.ACTIVE.registries.keySet());
|
||||
keys.sort((o1, o2) -> String.valueOf(o1).compareToIgnoreCase(String.valueOf(o2)));
|
||||
|
||||
@@ -28,7 +28,8 @@ public interface IForgeRegistry<V extends IForgeRegistryEntry<V>> extends Iterab
|
||||
|
||||
void register(V value);
|
||||
|
||||
void registerAll(@SuppressWarnings("unchecked") V... values);
|
||||
@SuppressWarnings("unchecked")
|
||||
void registerAll(V... values);
|
||||
|
||||
boolean containsKey(ResourceLocation key);
|
||||
boolean containsValue(V value);
|
||||
|
||||
@@ -71,12 +71,12 @@ class EntityCommand
|
||||
if (names.isEmpty())
|
||||
throw INVALID_FILTER.create();
|
||||
|
||||
ServerLevel world = sender.getServer().getLevel(dim); //TODO: DimensionManager so we can hotload? DimensionManager.getWorld(sender.getServer(), dim, false, false);
|
||||
if (world == null)
|
||||
ServerLevel level = sender.getServer().getLevel(dim); //TODO: DimensionManager so we can hotload? DimensionManager.getWorld(sender.getServer(), dim, false, false);
|
||||
if (level == null)
|
||||
throw INVALID_DIMENSION.create(dim);
|
||||
|
||||
Map<ResourceLocation, MutablePair<Integer, Map<ChunkPos, Integer>>> list = Maps.newHashMap();
|
||||
world.getEntities().getAll().forEach(e -> {
|
||||
level.getEntities().getAll().forEach(e -> {
|
||||
MutablePair<Integer, Map<ChunkPos, Integer>> info = list.computeIfAbsent(e.getType().getRegistryName(), k -> MutablePair.of(0, Maps.newHashMap()));
|
||||
ChunkPos chunk = new ChunkPos(e.blockPosition());
|
||||
info.left++;
|
||||
|
||||
Reference in new issue
Block a user