mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 03:15:07 +00:00
Another pass
This commit is contained in:
1 parent
fc1dd61c53
commit
d0acd5fdb0
51 files changed
+332
-312
No files matched your search
@@ -218,7 +218,11 @@ public class TileEntityFunctionalFlower extends TileEntitySpecialFlower {
|
||||
}
|
||||
|
||||
public boolean isValidBinding() {
|
||||
return linkedPool != null && linkedPool.hasWorld() && !linkedPool.isRemoved() && getWorld().isBlockLoaded(linkedPool.getPos(), false) && getWorld().getTileEntity(linkedPool.getPos()) == linkedPool;
|
||||
return linkedPool != null
|
||||
&& linkedPool.hasWorld()
|
||||
&& !linkedPool.isRemoved()
|
||||
&& getWorld().isBlockLoaded(linkedPool.getPos())
|
||||
&& getWorld().getTileEntity(linkedPool.getPos()) == linkedPool;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.api.wiki;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -24,16 +25,16 @@ public interface IWikiProvider {
|
||||
/**
|
||||
* Gets the name of the block being looked at for display.
|
||||
*/
|
||||
public String getBlockName(World world, RayTraceResult pos, PlayerEntity player);
|
||||
public String getBlockName(World world, BlockRayTraceResult pos, PlayerEntity player);
|
||||
|
||||
/**
|
||||
* Gets the URL to open when the block is clicked.
|
||||
*/
|
||||
public String getWikiURL(World world, RayTraceResult pos, PlayerEntity player);
|
||||
public String getWikiURL(World world, BlockRayTraceResult pos, PlayerEntity player);
|
||||
|
||||
/**
|
||||
* Gets the name of the wiki for display.
|
||||
*/
|
||||
public String getWikiName(World world, RayTraceResult pos, PlayerEntity player);
|
||||
public String getWikiName(World world, BlockRayTraceResult pos, PlayerEntity player);
|
||||
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
@@ -46,8 +47,8 @@ public class SimpleWikiProvider implements IWikiProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(World world, RayTraceResult pos, PlayerEntity player) {
|
||||
BlockPos bPos = pos.getBlockPos();
|
||||
public String getBlockName(World world, BlockRayTraceResult pos, PlayerEntity player) {
|
||||
BlockPos bPos = pos.getPos();
|
||||
BlockState state = world.getBlockState(bPos);
|
||||
|
||||
ItemStack stack = state.getBlock().getPickBlock(state, pos, world, bPos, player);
|
||||
@@ -62,7 +63,7 @@ public class SimpleWikiProvider implements IWikiProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWikiURL(World world, RayTraceResult pos, PlayerEntity player) {
|
||||
public String getWikiURL(World world, BlockRayTraceResult pos, PlayerEntity player) {
|
||||
String name = getBlockName(world, pos, player);
|
||||
if(name == null)
|
||||
return null;
|
||||
@@ -75,7 +76,7 @@ public class SimpleWikiProvider implements IWikiProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWikiName(World world, RayTraceResult pos, PlayerEntity player) {
|
||||
public String getWikiName(World world, BlockRayTraceResult pos, PlayerEntity player) {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,11 @@ package vazkii.botania.client.core.handler;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.IEntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||
import net.minecraft.client.renderer.entity.model.PlayerModel;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
@@ -40,13 +43,17 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
public final class ContributorFancinessHandler implements LayerRenderer<PlayerEntity> {
|
||||
public final class ContributorFancinessHandler extends LayerRenderer<AbstractClientPlayerEntity, PlayerModel<AbstractClientPlayerEntity>> {
|
||||
|
||||
public static final Map<String, ItemStack> flowerMap = new HashMap<>();
|
||||
private static boolean startedLoading = false;
|
||||
|
||||
public ContributorFancinessHandler(IEntityRenderer<AbstractClientPlayerEntity, PlayerModel<AbstractClientPlayerEntity>> renderer) {
|
||||
super(renderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(@Nonnull PlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
public void render(@Nonnull AbstractClientPlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
String name = player.getDisplayName().getString();
|
||||
|
||||
float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks;
|
||||
|
||||
@@ -27,6 +27,9 @@ import net.minecraft.profiler.Profiler;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.EntityRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -86,7 +89,7 @@ public final class HUDHandler {
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||
public static void onDrawScreenPre(RenderGameOverlayEvent.Pre event) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Profiler profiler = mc.profiler;
|
||||
IProfiler profiler = mc.getProfiler();
|
||||
|
||||
if(event.getType() == ElementType.HEALTH) {
|
||||
profiler.startSection("botania-hud");
|
||||
@@ -112,7 +115,7 @@ public final class HUDHandler {
|
||||
@SubscribeEvent
|
||||
public static void onDrawScreenPost(RenderGameOverlayEvent.Post event) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Profiler profiler = mc.profiler;
|
||||
IProfiler profiler = mc.getProfiler();
|
||||
ItemStack main = mc.player.getHeldItemMainhand();
|
||||
ItemStack offhand = mc.player.getHeldItemOffhand();
|
||||
|
||||
@@ -121,21 +124,22 @@ public final class HUDHandler {
|
||||
RayTraceResult pos = mc.objectMouseOver;
|
||||
|
||||
if(pos != null) {
|
||||
BlockState state = pos.type == RayTraceResult.Type.BLOCK ? mc.world.getBlockState(pos.getBlockPos()) : null;
|
||||
BlockPos bpos = pos.getType() == RayTraceResult.Type.BLOCK ? ((BlockRayTraceResult) pos).getPos() : null;
|
||||
BlockState state = bpos != null ? mc.world.getBlockState(bpos) : null;
|
||||
Block block = state == null ? null : state.getBlock();
|
||||
TileEntity tile = pos.type == RayTraceResult.Type.BLOCK ? mc.world.getTileEntity(pos.getBlockPos()) : null;
|
||||
TileEntity tile = bpos != null ? mc.world.getTileEntity(bpos) : null;
|
||||
|
||||
if(PlayerHelper.hasAnyHeldItem(mc.player)) {
|
||||
if(pos != null && PlayerHelper.hasHeldItem(mc.player, ModItems.twigWand)) {
|
||||
if(PlayerHelper.hasHeldItem(mc.player, ModItems.twigWand)) {
|
||||
renderWandModeDisplay(PlayerHelper.getFirstHeldItem(mc.player, ModItems.twigWand));
|
||||
|
||||
if(block instanceof IWandHUD) {
|
||||
profiler.startSection("wandItem");
|
||||
((IWandHUD) block).renderHUD(mc, mc.world, pos.getBlockPos());
|
||||
((IWandHUD) block).renderHUD(mc, mc.world, bpos);
|
||||
profiler.endSection();
|
||||
}
|
||||
} else if(block != null && PlayerHelper.hasHeldItemClass(mc.player, ILexicon.class))
|
||||
drawLexiconHUD(PlayerHelper.getFirstHeldItemClass(mc.player, ILexicon.class), state, pos);
|
||||
drawLexiconHUD(PlayerHelper.getFirstHeldItemClass(mc.player, ILexicon.class), state, (BlockRayTraceResult) pos);
|
||||
if(tile instanceof TilePool && !mc.player.getHeldItemMainhand().isEmpty())
|
||||
renderPoolRecipeHUD((TilePool) tile, mc.player.getHeldItemMainhand());
|
||||
}
|
||||
@@ -258,7 +262,7 @@ public final class HUDHandler {
|
||||
|
||||
private static void renderWandModeDisplay(ItemStack stack) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Profiler profiler = mc.profiler;
|
||||
IProfiler profiler = mc.getProfiler();
|
||||
|
||||
profiler.startSection("wandMode");
|
||||
int ticks = mc.ingameGUI.remainingHighlightTicks;
|
||||
@@ -310,7 +314,7 @@ public final class HUDHandler {
|
||||
|
||||
private static void renderPoolRecipeHUD(TilePool tile, ItemStack stack) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Profiler profiler = mc.profiler;
|
||||
IProfiler profiler = mc.getProfiler();
|
||||
|
||||
profiler.startSection("poolRecipe");
|
||||
RecipeManaInfusion recipe = TilePool.getMatchingRecipe(stack, tile.getWorld().getBlockState(tile.getPos().down()));
|
||||
@@ -342,7 +346,7 @@ public final class HUDHandler {
|
||||
|
||||
private static void renderCrystalCubeHUD(TileCorporeaCrystalCube tile) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Profiler profiler = mc.profiler;
|
||||
IProfiler profiler = mc.getProfiler();
|
||||
|
||||
profiler.startSection("crystalCube");
|
||||
ItemStack target = tile.getRequestTarget();
|
||||
@@ -353,8 +357,8 @@ public final class HUDHandler {
|
||||
int w = mc.mainWindow.getScaledWidth();
|
||||
int h = mc.mainWindow.getScaledHeight();
|
||||
int boxH = h / 2 + (tile.locked ? 20 : 10);
|
||||
AbstractGui.drawRect(w / 2 + 8, h / 2 - 12, w / 2 + strlen + 32, boxH, 0x44000000);
|
||||
AbstractGui.drawRect(w / 2 + 6, h / 2 - 14, w / 2 + strlen + 34, boxH + 2, 0x44000000);
|
||||
AbstractGui.fill(w / 2 + 8, h / 2 - 12, w / 2 + strlen + 32, boxH, 0x44000000);
|
||||
AbstractGui.fill(w / 2 + 6, h / 2 - 14, w / 2 + strlen + 34, boxH + 2, 0x44000000);
|
||||
|
||||
mc.fontRenderer.drawStringWithShadow(s1, w / 2 + 30, h / 2 - 10, 0x6666FF);
|
||||
mc.fontRenderer.drawStringWithShadow(tile.getItemCount() + "x", w / 2 + 30, h / 2, 0xFFFFFF);
|
||||
@@ -369,7 +373,7 @@ public final class HUDHandler {
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
private static void drawLexiconHUD(ItemStack stack, BlockState state, RayTraceResult pos) {
|
||||
private static void drawLexiconHUD(ItemStack stack, BlockState state, BlockRayTraceResult pos) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Block block = state.getBlock();
|
||||
IProfiler profiler = mc.getProfiler();
|
||||
@@ -386,7 +390,7 @@ public final class HUDHandler {
|
||||
int sy = mc.mainWindow.getScaledHeight() / 2 + 2;
|
||||
|
||||
if(block instanceof ILexiconable) {
|
||||
LexiconEntry entry = ((ILexiconable) block).getEntry(mc.world, pos.getBlockPos(), mc.player, stack);
|
||||
LexiconEntry entry = ((ILexiconable) block).getEntry(mc.world, pos.getPos(), mc.player, stack);
|
||||
if(entry != null) {
|
||||
if(!((ILexicon) stack.getItem()).isKnowledgeUnlocked(stack, entry.getKnowledgeType()))
|
||||
font = mc.getFontResourceManager().getFontRenderer(Minecraft.standardGalacticFontRenderer);
|
||||
@@ -397,9 +401,9 @@ public final class HUDHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if(!ConfigHandler.CLIENT.lexicaOfflineMode.get() && !draw && pos.entity == null) {
|
||||
if(!ConfigHandler.CLIENT.lexicaOfflineMode.get() && !draw) {
|
||||
profiler.startSection("wikiLookup");
|
||||
if(!block.isAir(state, mc.world, pos.getBlockPos()) && !(block instanceof FlowingFluidBlock)) {
|
||||
if(!block.isAir(state, mc.world, pos.getPos()) && !(block instanceof FlowingFluidBlock)) {
|
||||
IWikiProvider provider = WikiHooks.getWikiFor(block);
|
||||
String url = provider.getWikiURL(mc.world, pos, mc.player);
|
||||
if(url != null && !url.isEmpty()) {
|
||||
@@ -426,7 +430,7 @@ public final class HUDHandler {
|
||||
|
||||
if(!mc.player.isSneaking()) {
|
||||
GlStateManager.scalef(0.5F, 0.5F, 1F);
|
||||
mc.fontRenderer.drawStringWithShadow(TextFormatting.BOLD + mc.gameSettings.keyBindSneak.func_197978_k(), (sx + 10) * 2 - 16, (sy + 8) * 2 + 20, 0xFFFFFFFF);
|
||||
mc.fontRenderer.drawStringWithShadow(TextFormatting.BOLD + mc.gameSettings.keyBindSneak.getLocalizedName(), (sx + 10) * 2 - 16, (sy + 8) * 2 + 20, 0xFFFFFFFF);
|
||||
GlStateManager.scalef(2F, 2F, 1F);
|
||||
}
|
||||
}
|
||||
@@ -446,8 +450,8 @@ public final class HUDHandler {
|
||||
int x = mc.mainWindow.getScaledWidth() - l - 20;
|
||||
int y = mc.mainWindow.getScaledHeight() - 60;
|
||||
|
||||
AbstractGui.drawRect(x - 6, y - 6, x + l + 6, y + 37, 0x44000000);
|
||||
AbstractGui.drawRect(x - 4, y - 4, x + l + 4, y + 35, 0x44000000);
|
||||
AbstractGui.fill(x - 6, y - 6, x + l + 6, y + 37, 0x44000000);
|
||||
AbstractGui.fill(x - 4, y - 4, x + l + 4, y + 35, 0x44000000);
|
||||
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
mc.getItemRenderer().renderItemAndEffectIntoGUI(new ItemStack(ModBlocks.corporeaIndex), x, y + 10);
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.renderer.entity.IEntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||
import net.minecraft.client.renderer.entity.model.PlayerModel;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.common.item.equipment.armor.terrasteel.ItemTerrasteelHelm;
|
||||
|
||||
public class LayerTerraHelmet implements LayerRenderer<PlayerEntity> {
|
||||
public class LayerTerraHelmet extends LayerRenderer<AbstractClientPlayerEntity, PlayerModel<AbstractClientPlayerEntity>> {
|
||||
public LayerTerraHelmet(IEntityRenderer<AbstractClientPlayerEntity, PlayerModel<AbstractClientPlayerEntity>> renderer) {
|
||||
super(renderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
public void render(AbstractClientPlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks;
|
||||
float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks;
|
||||
float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks;
|
||||
|
||||
@@ -16,6 +16,7 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.profiler.IProfiler;
|
||||
import net.minecraft.profiler.Profiler;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
@@ -43,7 +44,7 @@ public class LightningHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRenderWorldLast(RenderWorldLastEvent event) {
|
||||
Profiler profiler = Minecraft.getInstance().profiler;
|
||||
IProfiler profiler = Minecraft.getInstance().getProfiler();
|
||||
|
||||
profiler.startSection("botania-particles");
|
||||
ParticleRenderDispatcher.dispatch();
|
||||
|
||||
@@ -116,7 +116,7 @@ public class RenderLexicon {
|
||||
GlStateManager.scalef(0.0030F, 0.0030F, -0.0030F);
|
||||
|
||||
|
||||
String title = ItemLexicon.getTitle(stack);
|
||||
String title = ItemLexicon.getTitle(stack).getFormattedText();
|
||||
|
||||
font.drawString(font.trimStringToWidth(title, 80), 0, 0, 0xD69700);
|
||||
|
||||
|
||||
@@ -17,12 +17,14 @@ import net.minecraft.client.renderer.entity.model.BipedModel;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.client.settings.ParticleStatus;
|
||||
import net.minecraft.client.util.InputMappings;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.settings.KeyConflictContext;
|
||||
@@ -151,18 +153,18 @@ public class ClientProxy implements IProxy {
|
||||
Map<String, PlayerRenderer> skinMap = Minecraft.getInstance().getRenderManager().getSkinMap();
|
||||
PlayerRenderer render;
|
||||
render = skinMap.get("default");
|
||||
render.addLayer(new ContributorFancinessHandler());
|
||||
render.addLayer(new ContributorFancinessHandler(render));
|
||||
if(Botania.curiosLoaded)
|
||||
render.addLayer(new BaubleRenderHandler());
|
||||
render.addLayer(new LayerTerraHelmet());
|
||||
render.addLayer(new LayerGaiaHead(render.getMainModel().bipedHead));
|
||||
render.addLayer(new LayerTerraHelmet(render));
|
||||
render.addLayer(new LayerGaiaHead(render, render.getEntityModel().bipedHead));
|
||||
|
||||
render = skinMap.get("slim");
|
||||
render.addLayer(new ContributorFancinessHandler());
|
||||
render.addLayer(new ContributorFancinessHandler(render));
|
||||
if(Botania.curiosLoaded)
|
||||
render.addLayer(new BaubleRenderHandler());
|
||||
render.addLayer(new LayerTerraHelmet());
|
||||
render.addLayer(new LayerGaiaHead(render.getMainModel().bipedHead));
|
||||
render.addLayer(new LayerTerraHelmet(render));
|
||||
render.addLayer(new LayerGaiaHead(render, render.getEntityModel().bipedHead));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -197,7 +199,7 @@ public class ClientProxy implements IProxy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean openWikiPage(World world, Block block, RayTraceResult pos) {
|
||||
public boolean openWikiPage(World world, Block block, BlockRayTraceResult pos) {
|
||||
if(ConfigHandler.CLIENT.lexicaOfflineMode.get())
|
||||
return false;
|
||||
IWikiProvider wiki = WikiHooks.getWikiFor(block);
|
||||
@@ -319,9 +321,9 @@ public class ClientProxy implements IProxy {
|
||||
return true;
|
||||
|
||||
float chance = 1F;
|
||||
if(Minecraft.getInstance().gameSettings.particleSetting == 1)
|
||||
if(Minecraft.getInstance().gameSettings.particles == ParticleStatus.DECREASED)
|
||||
chance = 0.6F;
|
||||
else if(Minecraft.getInstance().gameSettings.particleSetting == 2)
|
||||
else if(Minecraft.getInstance().gameSettings.particles == ParticleStatus.MINIMAL)
|
||||
chance = 0.2F;
|
||||
|
||||
return chance == 1F || Math.random() < chance;
|
||||
|
||||
@@ -2,15 +2,21 @@ package vazkii.botania.client.fx;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.IParticleRenderType;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceContext;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.client.core.handler.LightningHandler;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@@ -59,10 +65,16 @@ public class FXLightning extends Particle {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(BufferBuilder wr, Entity entity, float partialTicks, float rotX, float rotZ, float rotYZ, float rotXY, float rotXZ) {
|
||||
public void renderParticle(BufferBuilder buffer, ActiveRenderInfo info, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
|
||||
LightningHandler.queuedLightningBolts.offer(this);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IParticleRenderType getRenderType() {
|
||||
return IParticleRenderType.NO_RENDER;
|
||||
}
|
||||
|
||||
public void renderBolt(int pass, boolean inner) {
|
||||
ParticleRenderDispatcher.lightningCount++;
|
||||
BufferBuilder wr = Tessellator.getInstance().getBuffer();
|
||||
@@ -180,15 +192,18 @@ public class FXLightning extends Particle {
|
||||
}
|
||||
|
||||
private float rayTraceResistance(Vector3 start, Vector3 end, float prevresistance) {
|
||||
RayTraceResult mop = world.rayTraceBlocks(start.toVec3D(), end.toVec3D());
|
||||
// todo 1.14 entity?
|
||||
RayTraceContext ctx = new RayTraceContext(start.toVec3D(), end.toVec3D(), RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, null);
|
||||
RayTraceResult mop = world.rayTraceBlocks(ctx);
|
||||
|
||||
if(mop == null)
|
||||
return prevresistance;
|
||||
|
||||
if(mop.type == RayTraceResult.Type.BLOCK) {
|
||||
Block block = world.getBlockState(mop.getBlockPos()).getBlock();
|
||||
if(mop.getType() == RayTraceResult.Type.BLOCK) {
|
||||
BlockPos pos = ((BlockRayTraceResult) mop).getPos();
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
|
||||
if(world.isAirBlock(mop.getBlockPos()))
|
||||
if(world.isAirBlock(pos))
|
||||
return prevresistance;
|
||||
|
||||
return prevresistance + block.getExplosionResistance() + 0.3F;
|
||||
|
||||
@@ -14,6 +14,7 @@ package vazkii.botania.client.fx;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.profiler.IProfiler;
|
||||
import net.minecraft.profiler.Profiler;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -30,7 +31,7 @@ public final class ParticleRenderDispatcher {
|
||||
public static void dispatch() {
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
|
||||
Profiler profiler = Minecraft.getInstance().profiler;
|
||||
IProfiler profiler = Minecraft.getInstance().getProfiler();
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||
GlStateManager.depthMask(false);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.client.gui.bag;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
|
||||
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
@@ -38,7 +39,7 @@ public class GuiFlowerBag extends ContainerScreen {
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
this.drawDefaultBackground();
|
||||
this.renderBackground();
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
this.renderHoveredToolTip(mouseX, mouseY);
|
||||
}
|
||||
@@ -46,20 +47,20 @@ public class GuiFlowerBag extends ContainerScreen {
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
String s = I18n.format("item.botania:flowerBag.name");
|
||||
fontRenderer.drawString(s, xSize / 2 - fontRenderer.getStringWidth(s) / 2, 6, 4210752);
|
||||
fontRenderer.drawString(I18n.format("container.inventory"), 8, ySize - 96 + 2, 4210752);
|
||||
font.drawString(s, xSize / 2 - font.getStringWidth(s) / 2, 6, 4210752);
|
||||
font.drawString(I18n.format("container.inventory"), 8, ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.getTextureManager().bindTexture(texture);
|
||||
int k = (width - xSize) / 2;
|
||||
int l = (height - ySize) / 2;
|
||||
drawTexturedModalRect(k, l, 0, 0, xSize, ySize);
|
||||
blit(k, l, 0, 0, xSize, ySize);
|
||||
|
||||
List<Slot> slotList = inventorySlots.inventorySlots;
|
||||
for(Slot slot : slotList)
|
||||
for(Slot slot : container.inventorySlots)
|
||||
if(slot instanceof SlotItemHandler) {
|
||||
SlotItemHandler slotf = (SlotItemHandler) slot;
|
||||
if(!slotf.getHasStack()) {
|
||||
|
||||
@@ -22,10 +22,15 @@ import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/* We don't need to register a new ContainerType and can just piggyback off vanilla's,
|
||||
* because all we want to change is canInteractWith, which is only checked serverside.
|
||||
* So on the server we have this container while the client will think it's just interacting
|
||||
* with a normal WorkbenchContainer.
|
||||
*/
|
||||
public class ContainerCraftingHalo extends WorkbenchContainer {
|
||||
|
||||
public ContainerCraftingHalo(PlayerInventory playerInv, World world) {
|
||||
super(playerInv, world, BlockPos.ORIGIN);
|
||||
public ContainerCraftingHalo(int windowId, PlayerInventory playerInv) {
|
||||
super(windowId, playerInv);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,6 +25,7 @@ import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SharedConstants;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
@@ -111,14 +112,14 @@ public class GuiLexicon extends Screen {
|
||||
public String note = "";
|
||||
public String categoryHighlight = "";
|
||||
|
||||
String title;
|
||||
final int guiWidth = 146;
|
||||
final int guiHeight = 180;
|
||||
protected final Minecraft mc = Minecraft.getInstance();
|
||||
int left, top;
|
||||
|
||||
@Override
|
||||
public final void initGui() {
|
||||
super.initGui();
|
||||
public final void init() {
|
||||
super.init();
|
||||
|
||||
if(PersistentVariableHelper.firstLoad) {
|
||||
PersistentVariableHelper.firstLoad = false;
|
||||
@@ -242,14 +243,14 @@ public class GuiLexicon extends Screen {
|
||||
if(konamiTime > 0) {
|
||||
String meme = I18n.format("botania.subtitle.way");
|
||||
GlStateManager.pushMatrix();
|
||||
int fullWidth = fontRenderer.getStringWidth(meme);
|
||||
int fullWidth = font.getStringWidth(meme);
|
||||
int left = width;
|
||||
double widthPerTick = (fullWidth + width) / 240;
|
||||
double currWidth = left - widthPerTick * (240 - (konamiTime - partialTicks)) * 3.2;
|
||||
|
||||
GlStateManager.translated(currWidth, height / 2 - 10, 0);
|
||||
GlStateManager.scalef(4, 4, 4);
|
||||
mc.fontRenderer.drawStringWithShadow(meme, 0, 0, 0xFFFFFF);
|
||||
mc.font.drawStringWithShadow(meme, 0, 0, 0xFFFFFF);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
@@ -266,10 +267,10 @@ public class GuiLexicon extends Screen {
|
||||
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
mc.textureManager.bindTexture(texture);
|
||||
drawTexturedModalRect(left, top, 0, 0, guiWidth, guiHeight);
|
||||
blit(left, top, 0, 0, guiWidth, guiHeight);
|
||||
|
||||
if(ClientProxy.jingleTheBells)
|
||||
drawTexturedModalRect(left + 3, top + 1, 0, 212, 138, 6);
|
||||
blit(left + 3, top + 1, 0, 212, 138, 6);
|
||||
|
||||
String subtitle = getSubtitle();
|
||||
|
||||
@@ -288,7 +289,7 @@ public class GuiLexicon extends Screen {
|
||||
if(mc.player.getGameProfile().getName().equals("haighyorkie")) {
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
mc.textureManager.bindTexture(texture);
|
||||
drawTexturedModalRect(left - 19, top + 42, 67, 180, 19, 26);
|
||||
blit(left - 19, top + 42, 67, 180, 19, 26);
|
||||
if(xCoord >= left - 19 && xCoord < left && yCoord >= top + 62 && yCoord < top + 88) {
|
||||
mc.textureManager.bindTexture(textureToff);
|
||||
GlStateManager.pushMatrix();
|
||||
@@ -302,7 +303,7 @@ public class GuiLexicon extends Screen {
|
||||
int x = (int) ((ClientTickHandler.ticksInGame + newPartialTicks) * 6) % (width + w) - w;
|
||||
int y = (int) (top + guiHeight / 2 - h / 4 + Math.sin((ClientTickHandler.ticksInGame + newPartialTicks) / 6.0) * 40);
|
||||
|
||||
drawTexturedModalRect(x * 2, y * 2, 0, 0, w, h);
|
||||
blit(x * 2, y * 2, 0, 0, w, h);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
@@ -317,7 +318,7 @@ public class GuiLexicon extends Screen {
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 0.7F + (float) (Math.sin((ClientTickHandler.ticksInGame + newPartialTicks) * 0.3F) + 1) * 0.15F);
|
||||
drawTexturedModalRect(tutorialArrowX, tutorialArrowY, 20, 200, TUTORIAL_ARROW_WIDTH, TUTORIAL_ARROW_HEIGHT);
|
||||
blit(tutorialArrowX, tutorialArrowY, 20, 200, TUTORIAL_ARROW_WIDTH, TUTORIAL_ARROW_HEIGHT);
|
||||
GlStateManager.disableBlend();
|
||||
}
|
||||
}
|
||||
@@ -335,13 +336,13 @@ public class GuiLexicon extends Screen {
|
||||
int x = left - drawSize;
|
||||
int y = top + 10;
|
||||
|
||||
drawTexturedModalRect(x, y, 146, 0, drawSize, 125);
|
||||
blit(x, y, 146, 0, drawSize, 125);
|
||||
|
||||
String noteDisplay = note;
|
||||
if(notesEnabled && ClientTickHandler.ticksInGame % 20 < 10)
|
||||
noteDisplay += "&r_";
|
||||
|
||||
fontRenderer.drawString(I18n.format("botaniamisc.notes"), x + 5, y - 7, 0x666666);
|
||||
font.drawString(I18n.format("botaniamisc.notes"), x + 5, y - 7, 0x666666);
|
||||
PageText.renderText(x + 5, y - 3, 92, 120, 0, true, 0, TextFormatting.RESET + noteDisplay);
|
||||
}
|
||||
|
||||
@@ -354,8 +355,8 @@ public class GuiLexicon extends Screen {
|
||||
}
|
||||
|
||||
public void drawBookmark(int x, int y, String s, boolean drawLeft, int color, int v) {
|
||||
// This function is called from the buttons so I can't use fontRenderer
|
||||
FontRenderer font = Minecraft.getInstance().fontRenderer;
|
||||
// This function is called from the buttons so I can't use font
|
||||
FontRenderer font = Minecraft.getInstance().font;
|
||||
int l = font.getStringWidth(s);
|
||||
int fontOff = 0;
|
||||
|
||||
@@ -367,12 +368,12 @@ public class GuiLexicon extends Screen {
|
||||
Minecraft.getInstance().textureManager.bindTexture(texture);
|
||||
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(x + l / 2 + 3, y - 1, 54, v, 6, 11);
|
||||
blit(x + l / 2 + 3, y - 1, 54, v, 6, 11);
|
||||
|
||||
if(drawLeft)
|
||||
drawTexturedModalRect(x - l / 2 - 9, y - 1, 61, v, 6, 11);
|
||||
blit(x - l / 2 - 9, y - 1, 61, v, 6, 11);
|
||||
for(int i = 0; i < l + 6; i++)
|
||||
drawTexturedModalRect(x - l / 2 - 3 + i, y - 1, 60, v, 1, 11);
|
||||
blit(x - l / 2 - 3 + i, y - 1, 60, v, 1, 11);
|
||||
|
||||
font.drawString(s, x - l / 2 + fontOff, y, color);
|
||||
}
|
||||
@@ -381,14 +382,14 @@ public class GuiLexicon extends Screen {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
Minecraft.getInstance().textureManager.bindTexture(texture);
|
||||
drawTexturedModalRect(left - 8, top + 9, 0, 224, 140, 31);
|
||||
blit(left - 8, top + 9, 0, 224, 140, 31);
|
||||
|
||||
int color = 0xffd200;
|
||||
fontRenderer.drawString(title, left + 18, top + 13, color);
|
||||
fontRenderer.drawString(I18n.format("botaniamisc.edition", ItemLexicon.getEdition()), left + 24, top + 22, color);
|
||||
font.drawString(title.getFormattedText(), left + 18, top + 13, color);
|
||||
font.drawString(I18n.format("botaniamisc.edition", ItemLexicon.getEdition()), left + 24, top + 22, color);
|
||||
|
||||
String s = TextFormatting.BOLD + categoryHighlight;
|
||||
fontRenderer.drawString(s, left + guiWidth / 2 - fontRenderer.getStringWidth(s) / 2, top + 36, 0);
|
||||
font.drawString(s, left + guiWidth / 2 - font.getStringWidth(s) / 2, top + 36, 0);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
@@ -405,13 +406,14 @@ public class GuiLexicon extends Screen {
|
||||
}
|
||||
|
||||
public int bookmarkWidth(String b) {
|
||||
if(fontRenderer == null)
|
||||
fontRenderer = Minecraft.getInstance().fontRenderer;
|
||||
if(font == null)
|
||||
font = Minecraft.getInstance().fontRenderer;
|
||||
|
||||
return fontRenderer.getStringWidth(b) + 15;
|
||||
return font.getStringWidth(b) + 15;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
@Override
|
||||
public ITextComponent getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
@@ -448,9 +450,9 @@ public class GuiLexicon extends Screen {
|
||||
GuiButtonInvisible button = (GuiButtonInvisible) buttons.get(i);
|
||||
LexiconCategory category = i_ >= categoryList.size() ? null : categoryList.get(i_);
|
||||
if(category != null)
|
||||
button.displayString = I18n.format(category.getUnlocalizedName());
|
||||
button.setMessage(I18n.format(category.getUnlocalizedName()));
|
||||
else {
|
||||
button.displayString = I18n.format("botaniamisc.lexiconIndex");
|
||||
button.setMessage(I18n.format("botaniamisc.lexiconIndex"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -560,7 +562,7 @@ public class GuiLexicon extends Screen {
|
||||
boolean changed = false;
|
||||
|
||||
if(codePoint == 8 && note.length() > 0) { // backspace
|
||||
if(isCtrlKeyDown())
|
||||
if(hasControlDown())
|
||||
note = "";
|
||||
else {
|
||||
if(note.endsWith("<br>"))
|
||||
|
||||
@@ -73,7 +73,7 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
|
||||
if(c.complete)
|
||||
complete++;
|
||||
|
||||
fontRenderer.drawString(TextFormatting.BOLD + I18n.format(level.getName()) + TextFormatting.RESET + " (" + complete + "/" + list.size() + ")", left + 20, top + 11 + level.ordinal() * 44, 0);
|
||||
font.drawString(TextFormatting.BOLD + I18n.format(level.getName()) + TextFormatting.RESET + " (" + complete + "/" + list.size() + ")", left + 20, top + 11 + level.ordinal() * 44, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
|
||||
|
||||
private void back() {
|
||||
if(backButton.enabled) {
|
||||
backButton.playPressSound(mc.getSoundHandler());
|
||||
backButton.playDownSound(mc.getSoundHandler());
|
||||
backButton.onClick(backButton.x, backButton.y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ import java.util.List;
|
||||
|
||||
public class GuiButtonBack extends GuiButtonLexicon {
|
||||
|
||||
public GuiButtonBack(int id, int x, int y) {
|
||||
super(id, x, y, 18, 9, "");
|
||||
public GuiButtonBack(int x, int y) {
|
||||
super(x, y, 18, 9, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -34,7 +34,7 @@ public class GuiButtonBack extends GuiButtonLexicon {
|
||||
|
||||
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(x, y, 36, k == 2 ? 180 : 189, 18, 9);
|
||||
blit(x, y, 36, k == 2 ? 180 : 189, 18, 9);
|
||||
|
||||
List<String> tooltip = getTooltip();
|
||||
int tooltipY = (tooltip.size() - 1) * 10;
|
||||
|
||||
@@ -26,8 +26,8 @@ public class GuiButtonHistory extends GuiButtonLexicon {
|
||||
|
||||
final GuiLexicon gui;
|
||||
|
||||
public GuiButtonHistory(int par1, int par2, int par3, String str, GuiLexicon gui) {
|
||||
super(par1, par2, par3, gui.bookmarkWidth(str) + 5, 11, str);
|
||||
public GuiButtonHistory(int x, int y, String str, GuiLexicon gui) {
|
||||
super(x, y, gui.bookmarkWidth(str) + 5, 11, str);
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,12 +18,12 @@ import vazkii.botania.common.core.handler.ModSounds;
|
||||
|
||||
public class GuiButtonLexicon extends Button {
|
||||
|
||||
public GuiButtonLexicon(int id, int x, int y, int width, int height, String text) {
|
||||
super(id, x, y, width, height, text);
|
||||
public GuiButtonLexicon(int x, int y, int width, int height, String text) {
|
||||
super(x, y, width, height, text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playPressSound(SoundHandler handler) {
|
||||
public void playDownSound(SoundHandler handler) {
|
||||
handler.play(SimpleSound.master(ModSounds.lexiconPage, 1.0F));
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public class GuiButtonOptions extends GuiButtonLexicon {
|
||||
|
||||
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(x, y, k == 2 ? 109 : 98, 180, 11, 11);
|
||||
blit(x, y, k == 2 ? 109 : 98, 180, 11, 11);
|
||||
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
for(int i = 0; i < 3; i++)
|
||||
|
||||
@@ -47,7 +47,7 @@ public class GuiButtonScaleChange extends GuiButtonLexicon {
|
||||
|
||||
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(x, y, k == 2 ? 152 : 141, 191, 11, 11);
|
||||
blit(x, y, k == 2 ? 152 : 141, 191, 11, 11);
|
||||
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
tooltip.add(TextFormatting.GREEN + I18n.format("botaniamisc.scaleChange"));
|
||||
|
||||
@@ -18,6 +18,7 @@ import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.model.ModelManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
@@ -30,6 +31,7 @@ import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.BasicState;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.client.model.data.IDynamicBakedModel;
|
||||
@@ -60,9 +62,13 @@ import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class FloatingFlowerModel implements IDynamicBakedModel {
|
||||
|
||||
private final ModelBakery bakery;
|
||||
private final Table<IFloatingFlower.IslandType, ResourceLocation, CompositeBakedModel> CACHE = HashBasedTable.create();
|
||||
|
||||
public FloatingFlowerModel(ModelBakery bakery) {
|
||||
this.bakery = bakery;
|
||||
}
|
||||
|
||||
protected static BakedQuad transform(BakedQuad quad, final TRSRTransformation transform) {
|
||||
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(DefaultVertexFormats.ITEM);
|
||||
final IVertexConsumer consumer = new VertexTransformer(builder) {
|
||||
@@ -111,7 +117,8 @@ public class FloatingFlowerModel implements IDynamicBakedModel {
|
||||
IBakedModel islandModel;
|
||||
try {
|
||||
islandModel = ModelLoaderRegistry.getModel(BotaniaAPIClient.getRegisteredIslandTypeModels().get(islandType))
|
||||
.bake(ModelLoader.defaultModelGetter(), ModelLoader.defaultTextureGetter(), TRSRTransformation.identity(), false, DefaultVertexFormats.ITEM);
|
||||
.bake(bakery, ModelLoader.defaultTextureGetter(),
|
||||
new BasicState(TRSRTransformation.identity(), false), DefaultVertexFormats.ITEM);
|
||||
} catch (Exception e) {
|
||||
islandModel = modelManager.getMissingModel();
|
||||
}
|
||||
|
||||
@@ -10,13 +10,15 @@
|
||||
*/
|
||||
package vazkii.botania.client.model;
|
||||
|
||||
import net.minecraft.client.renderer.entity.model.EntityModel;
|
||||
import net.minecraft.client.renderer.model.Model;
|
||||
import net.minecraft.client.renderer.entity.model.RendererModel;
|
||||
import net.minecraft.client.renderer.model.Model;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import vazkii.botania.common.entity.EntityPixie;
|
||||
|
||||
public class ModelPixie extends Model {
|
||||
public class ModelPixie extends EntityModel<EntityPixie> {
|
||||
|
||||
public RendererModel body;
|
||||
public RendererModel leftWingT;
|
||||
@@ -52,10 +54,10 @@ public class ModelPixie extends Model {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
public void render(EntityPixie entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
setRotationAngles(entity, f, f1, f2, f3, f4, f5);
|
||||
|
||||
body.render(f5);
|
||||
|
||||
@@ -72,8 +74,8 @@ public class ModelPixie extends Model {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) {
|
||||
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
public void setRotationAngles(EntityPixie entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
super.setRotationAngles(entity, f, f1, f2, f3, f4, f5);
|
||||
|
||||
rightWingT.rotateAngleY = -(MathHelper.cos(f2 * 1.7F) * (float)Math.PI * 0.5F);
|
||||
leftWingT.rotateAngleY = MathHelper.cos(f2 * 1.7F) * (float)Math.PI * 0.5F;
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package vazkii.botania.client.render.entity;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.renderer.entity.IEntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||
import net.minecraft.client.renderer.entity.model.PlayerModel;
|
||||
import net.minecraft.client.renderer.entity.model.RendererModel;
|
||||
import net.minecraft.client.renderer.entity.model.RendererModel;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
@@ -19,18 +22,20 @@ import vazkii.botania.common.item.ModItems;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class LayerGaiaHead implements LayerRenderer<PlayerEntity> {
|
||||
public class LayerGaiaHead extends LayerRenderer<AbstractClientPlayerEntity, PlayerModel<AbstractClientPlayerEntity>> {
|
||||
|
||||
private final RendererModel modelRenderer;
|
||||
|
||||
public LayerGaiaHead(RendererModel modelRenderer)
|
||||
public LayerGaiaHead(IEntityRenderer<AbstractClientPlayerEntity, PlayerModel<AbstractClientPlayerEntity>> renderer,
|
||||
RendererModel modelRenderer)
|
||||
{
|
||||
super(renderer);
|
||||
this.modelRenderer = modelRenderer;
|
||||
}
|
||||
|
||||
// Copied from LayerCustomHead, edits noted
|
||||
@Override
|
||||
public void render(@Nonnull PlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
public void render(@Nonnull AbstractClientPlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
ItemStack itemstack = player.getItemStackFromSlot(EquipmentSlotType.HEAD);
|
||||
|
||||
if (!itemstack.isEmpty() && itemstack.getItem() == ModBlocks.gaiaHead.asItem()) // Botania - check for head
|
||||
|
||||
@@ -16,6 +16,7 @@ import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.renderer.entity.BipedRenderer;
|
||||
import net.minecraft.client.renderer.entity.BipedRenderer;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
||||
import net.minecraft.client.renderer.entity.model.BipedModel;
|
||||
import net.minecraft.client.renderer.entity.model.PlayerModel;
|
||||
import net.minecraft.client.resources.DefaultPlayerSkin;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -26,7 +27,7 @@ import vazkii.botania.common.entity.EntityDoppleganger;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class RenderDoppleganger extends BipedRenderer<EntityDoppleganger> {
|
||||
public class RenderDoppleganger extends BipedRenderer<EntityDoppleganger, BipedModel<EntityDoppleganger>> {
|
||||
|
||||
private static final float DEFAULT_GRAIN_INTENSITY = 0.05F;
|
||||
private static final float DEFAULT_DISFIGURATION = 0.025F;
|
||||
@@ -55,7 +56,7 @@ public class RenderDoppleganger extends BipedRenderer<EntityDoppleganger> {
|
||||
};
|
||||
|
||||
public RenderDoppleganger(EntityRendererManager renderManager) {
|
||||
super(renderManager, new PlayerModel(0.0F, false), 0F);
|
||||
super(renderManager, new PlayerModel<>(0.0F, false), 0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,7 +26,7 @@ import vazkii.botania.common.entity.EntityPixie;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class RenderPixie extends MobRenderer<EntityPixie> {
|
||||
public class RenderPixie extends MobRenderer<EntityPixie, ModelPixie> {
|
||||
|
||||
private final ShaderCallback callback = shader -> {
|
||||
// Frag Uniforms
|
||||
|
||||
@@ -46,7 +46,7 @@ public class RenderTileAvatar extends TileEntityRenderer<TileAvatar> {
|
||||
@Override
|
||||
public void render(@Nullable TileAvatar avatar, double d0, double d1, double d2, float pticks, int digProgress) {
|
||||
if (avatar != null)
|
||||
if (!avatar.getWorld().isBlockLoaded(avatar.getPos(), false)
|
||||
if (!avatar.getWorld().isBlockLoaded(avatar.getPos())
|
||||
|| avatar.getWorld().getBlockState(avatar.getPos()).getBlock() != ModBlocks.avatar)
|
||||
return;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class RenderTileIncensePlate extends TileEntityRenderer<TileIncensePlate>
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void render(@Nonnull TileIncensePlate plate, double d0, double d1, double d2, float ticks, int digProgress) {
|
||||
if(!plate.getWorld().isBlockLoaded(plate.getPos(), false)
|
||||
if(!plate.getWorld().isBlockLoaded(plate.getPos())
|
||||
|| plate.getWorld().getBlockState(plate.getPos()).getBlock() != ModBlocks.incensePlate)
|
||||
return;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public class RenderTileLightRelay extends TileEntityRenderer<TileLightRelay> {
|
||||
|
||||
@Override
|
||||
public void render(@Nonnull TileLightRelay tile, double x, double y, double z, float pticks, int digProgress) {
|
||||
if(!tile.getWorld().isBlockLoaded(tile.getPos(), false))
|
||||
if(!tile.getWorld().isBlockLoaded(tile.getPos()))
|
||||
return;
|
||||
|
||||
BlockState state = tile.getWorld().getBlockState(tile.getPos());
|
||||
|
||||
@@ -41,8 +41,8 @@ public class RenderTileStarfield extends TileEntityRenderer<TileStarfield> {
|
||||
public void render(TileStarfield tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
GlStateManager.disableLighting();
|
||||
RANDOM.setSeed(31100L);
|
||||
GlStateManager.getFloatv(2982, MODELVIEW);
|
||||
GlStateManager.getFloatv(2983, PROJECTION);
|
||||
GlStateManager.getMatrix(2982, MODELVIEW);
|
||||
GlStateManager.getMatrix(2983, PROJECTION);
|
||||
double d0 = x * x + y * y + z * z;
|
||||
int i = this.getPasses(d0);
|
||||
float f = this.getOffset();
|
||||
@@ -88,8 +88,8 @@ public class RenderTileStarfield extends TileEntityRenderer<TileStarfield> {
|
||||
GlStateManager.translatef(17.0F / f2, (2.0F + f2 / 1.5F) * ((float) Util.milliTime() % 800000.0F / 800000.0F), 0.0F);
|
||||
GlStateManager.rotatef((f2 * f2 * 4321.0F + f2 * 9.0F) * 2.0F, 0.0F, 0.0F, 1.0F);
|
||||
GlStateManager.scalef(4.5F - f2 / 4.0F, 4.5F - f2 / 4.0F, 1.0F);
|
||||
GlStateManager.multMatrixf(PROJECTION);
|
||||
GlStateManager.multMatrixf(MODELVIEW);
|
||||
GlStateManager.multMatrix(PROJECTION);
|
||||
GlStateManager.multMatrix(MODELVIEW);
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder bufferbuilder = tessellator.getBuffer();
|
||||
bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR);
|
||||
|
||||
@@ -27,6 +27,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.EntityRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@@ -311,7 +313,8 @@ public class RenderTileTinyPotato extends TileEntityRenderer<TileTinyPotato> {
|
||||
GlStateManager.scalef(1F, -1F, -1F);
|
||||
|
||||
RayTraceResult pos = mc.objectMouseOver;
|
||||
if (!name.isEmpty() && pos != null && pos.getBlockPos() != null && potato.getPos().equals(pos.getBlockPos())) {
|
||||
if (!name.isEmpty() && pos != null && pos.getType() == RayTraceResult.Type.BLOCK
|
||||
&& potato.getPos().equals(((BlockRayTraceResult) pos).getPos())) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(0F, -0.6F, 0F);
|
||||
GlStateManager.rotatef(-mc.getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
@@ -24,7 +24,6 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -21,7 +21,6 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.FurnaceTileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.common.crafting.VanillaRecipeTypes;
|
||||
import net.minecraftforge.registries.ObjectHolder;
|
||||
import vazkii.botania.api.item.IExoflameHeatable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
|
||||
@@ -11,9 +11,11 @@
|
||||
package vazkii.botania.common.block.tile;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.MobEntity;
|
||||
import net.minecraft.entity.ILivingEntityData;
|
||||
import net.minecraft.entity.MobEntity;
|
||||
import net.minecraft.entity.SpawnReason;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
@@ -29,7 +31,6 @@ import net.minecraft.util.WeightedSpawnerEntity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.storage.AnvilChunkLoader;
|
||||
import net.minecraft.world.spawner.AbstractSpawner;
|
||||
import net.minecraftforge.registries.ObjectHolder;
|
||||
import vazkii.botania.api.mana.IManaReceiver;
|
||||
@@ -37,6 +38,8 @@ import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class TileSpawnerClaw extends TileMod implements IManaReceiver, ITickableTileEntity {
|
||||
@ObjectHolder(LibMisc.MOD_ID + ":" + LibBlockNames.SPAWNER_CLAW)
|
||||
public static TileEntityType<TileSpawnerClaw> TYPE;
|
||||
@@ -55,14 +58,16 @@ public class TileSpawnerClaw extends TileMod implements IManaReceiver, ITickable
|
||||
MobSpawnerTileEntity spawner = (MobSpawnerTileEntity) tileBelow;
|
||||
AbstractSpawner logic = spawner.getSpawnerBaseLogic();
|
||||
|
||||
// [VanillaCopy] MobSpawnBaseLogic.tick, edits noted
|
||||
if (!logic.isActivated()) { // Botania - invert activated check
|
||||
// [VanillaCopy] AbstractSpawner.tick, edits noted
|
||||
if (!logic.isActivated()) {
|
||||
logic.prevMobRotation = logic.mobRotation;
|
||||
} else {
|
||||
World world = this.getWorld();
|
||||
BlockPos blockpos = logic.getSpawnerPosition();
|
||||
if (this.getWorld().isRemote) {
|
||||
if (world.isRemote) {
|
||||
// Botania - use own particles
|
||||
if(Math.random() > 0.5)
|
||||
Botania.proxy.wispFX(getPos().getX() + 0.3 + Math.random() * 0.5, getPos().getY() - 0.3 + Math.random() * 0.25, getPos().getZ() + Math.random(), 0.6F - (float) Math.random() * 0.3F, 0.1F, 0.6F - (float) Math.random() * 0.3F, (float) Math.random() / 3F, -0.025F - 0.005F * (float) Math.random(), 2F);
|
||||
|
||||
if (logic.spawnDelay > 0) {
|
||||
--logic.spawnDelay;
|
||||
}
|
||||
@@ -85,37 +90,50 @@ public class TileSpawnerClaw extends TileMod implements IManaReceiver, ITickable
|
||||
boolean flag = false;
|
||||
|
||||
for(int i = 0; i < logic.spawnCount; ++i) {
|
||||
CompoundNBT nbttagcompound = logic.spawnData.getNbt();
|
||||
ListNBT nbttaglist = nbttagcompound.getList("Pos", 6);
|
||||
World world = logic.getWorld();
|
||||
int j = nbttaglist.size();
|
||||
double d0 = j >= 1 ? nbttaglist.getDouble(0) : (double)blockpos.getX() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)logic.spawnRange + 0.5D;
|
||||
double d1 = j >= 2 ? nbttaglist.getDouble(1) : (double)(blockpos.getY() + world.rand.nextInt(3) - 1);
|
||||
double d2 = j >= 3 ? nbttaglist.getDouble(2) : (double)blockpos.getZ() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)logic.spawnRange + 0.5D;
|
||||
Entity entity = AnvilChunkLoader.readWorldEntityPos(nbttagcompound, world, d0, d1, d2, false);
|
||||
if (entity == null) {
|
||||
CompoundNBT compoundnbt = logic.spawnData.getNbt();
|
||||
Optional<EntityType<?>> optional = EntityType.readEntityType(compoundnbt);
|
||||
if (!optional.isPresent()) {
|
||||
logic.resetTimer();
|
||||
return;
|
||||
}
|
||||
|
||||
int k = world.getEntitiesWithinAABB(entity.getClass(), (new AxisAlignedBB((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), (double)(blockpos.getX() + 1), (double)(blockpos.getY() + 1), (double)(blockpos.getZ() + 1))).grow((double)logic.spawnRange)).size();
|
||||
if (k >= logic.maxNearbyEntities) {
|
||||
logic.resetTimer();
|
||||
return;
|
||||
}
|
||||
|
||||
MobEntity entityliving = entity instanceof MobEntity ? (MobEntity)entity : null;
|
||||
entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, world.rand.nextFloat() * 360.0F, 0.0F);
|
||||
if (entityliving == null || net.minecraftforge.event.ForgeEventFactory.canEntitySpawnSpawner(entityliving, getWorld(), (float)entity.posX, (float)entity.posY, (float)entity.posZ, logic)) {
|
||||
if (logic.spawnData.getNbt().size() == 1 && logic.spawnData.getNbt().contains("id", 8) && entity instanceof MobEntity) {
|
||||
if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(entityliving, logic.getWorld(), (float)entity.posX, (float)entity.posY, (float)entity.posZ, logic))
|
||||
((MobEntity)entity).onInitialSpawn(world.getDifficultyForLocation(new BlockPos(entity)), (ILivingEntityData)null, (CompoundNBT)null);
|
||||
ListNBT listnbt = compoundnbt.getList("Pos", 6);
|
||||
int j = listnbt.size();
|
||||
double d0 = j >= 1 ? listnbt.getDouble(0) : (double)blockpos.getX() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)logic.spawnRange + 0.5D;
|
||||
double d1 = j >= 2 ? listnbt.getDouble(1) : (double)(blockpos.getY() + world.rand.nextInt(3) - 1);
|
||||
double d2 = j >= 3 ? listnbt.getDouble(2) : (double)blockpos.getZ() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)logic.spawnRange + 0.5D;
|
||||
if (world.areCollisionShapesEmpty(optional.get().func_220328_a(d0, d1, d2))) {
|
||||
Entity entity = EntityType.func_220335_a(compoundnbt, world, (p_221408_6_) -> {
|
||||
p_221408_6_.setLocationAndAngles(d0, d1, d2, p_221408_6_.rotationYaw, p_221408_6_.rotationPitch);
|
||||
return p_221408_6_;
|
||||
});
|
||||
if (entity == null) {
|
||||
logic.resetTimer();
|
||||
return;
|
||||
}
|
||||
|
||||
AnvilChunkLoader.addEntity(entity, world);
|
||||
int k = world.getEntitiesWithinAABB(entity.getClass(), (new AxisAlignedBB((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), (double)(blockpos.getX() + 1), (double)(blockpos.getY() + 1), (double)(blockpos.getZ() + 1))).grow((double)logic.spawnRange)).size();
|
||||
if (k >= logic.maxNearbyEntities) {
|
||||
logic.resetTimer();
|
||||
return;
|
||||
}
|
||||
|
||||
entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, world.rand.nextFloat() * 360.0F, 0.0F);
|
||||
if (entity instanceof MobEntity) {
|
||||
MobEntity mobentity = (MobEntity)entity;
|
||||
if (!net.minecraftforge.event.ForgeEventFactory.canEntitySpawnSpawner(mobentity, world, (float)entity.posX, (float)entity.posY, (float)entity.posZ, logic)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (logic.spawnData.getNbt().size() == 1 && logic.spawnData.getNbt().contains("id", 8)) {
|
||||
((MobEntity)entity).onInitialSpawn(world, world.getDifficultyForLocation(new BlockPos(entity)), SpawnReason.SPAWNER, (ILivingEntityData)null, (CompoundNBT)null);
|
||||
}
|
||||
}
|
||||
|
||||
func_221409_a(entity);
|
||||
world.playEvent(2004, blockpos, 0);
|
||||
if (entityliving != null) {
|
||||
entityliving.spawnExplosionParticle();
|
||||
if (entity instanceof MobEntity) {
|
||||
((MobEntity)entity).spawnExplosionParticle();
|
||||
}
|
||||
|
||||
flag = true;
|
||||
@@ -130,6 +148,16 @@ public class TileSpawnerClaw extends TileMod implements IManaReceiver, ITickable
|
||||
}
|
||||
}
|
||||
|
||||
// [VanillaCopy] AbstractSpawner
|
||||
private void func_221409_a(Entity p_221409_1_) {
|
||||
if (this.getWorld().addEntity(p_221409_1_)) {
|
||||
for(Entity entity : p_221409_1_.getPassengers()) {
|
||||
this.func_221409_a(entity);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writePacketNBT(CompoundNBT cmp) {
|
||||
cmp.putInt(TAG_MANA, mana);
|
||||
|
||||
@@ -549,26 +549,6 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
|
||||
return null;
|
||||
}
|
||||
|
||||
// [VanillaCopy] Item.rayTrace
|
||||
@Nullable
|
||||
protected static RayTraceResult rayTraceFromEntity(World worldIn, PlayerEntity playerIn, boolean useLiquids) {
|
||||
float f = playerIn.rotationPitch;
|
||||
float f1 = playerIn.rotationYaw;
|
||||
double d0 = playerIn.posX;
|
||||
double d1 = playerIn.posY + (double)playerIn.getEyeHeight();
|
||||
double d2 = playerIn.posZ;
|
||||
Vec3d vec3d = new Vec3d(d0, d1, d2);
|
||||
float f2 = MathHelper.cos(-f1 * ((float)Math.PI / 180F) - (float)Math.PI);
|
||||
float f3 = MathHelper.sin(-f1 * ((float)Math.PI / 180F) - (float)Math.PI);
|
||||
float f4 = -MathHelper.cos(-f * ((float)Math.PI / 180F));
|
||||
float f5 = MathHelper.sin(-f * ((float)Math.PI / 180F));
|
||||
float f6 = f3 * f4;
|
||||
float f7 = f2 * f4;
|
||||
double d3 = playerIn.getAttribute(PlayerEntity.REACH_DISTANCE).getValue();
|
||||
Vec3d vec3d1 = vec3d.add((double)f6 * d3, (double)f5 * d3, (double)f7 * d3);
|
||||
return worldIn.rayTraceBlocks(vec3d, vec3d1, useLiquids ? RayTraceFluidMode.SOURCE_ONLY : RayTraceFluidMode.NEVER, false, false);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void renderHUD(Minecraft mc) {
|
||||
String name = new ItemStack(getBlockState().getBlock()).getDisplayName().getString();
|
||||
|
||||
@@ -2,6 +2,7 @@ package vazkii.botania.common.core.loot;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.storage.loot.ILootGenerator;
|
||||
import net.minecraft.world.storage.loot.LootEntry;
|
||||
import net.minecraft.world.storage.loot.TableLootEntry;
|
||||
import net.minecraft.world.storage.loot.LootPool;
|
||||
import net.minecraftforge.event.LootTableLoadEvent;
|
||||
@@ -39,7 +40,7 @@ public final class LootHandler {
|
||||
.build();
|
||||
}
|
||||
|
||||
private static ILootGenerator.Builder getInjectEntry(String name, int weight) {
|
||||
private static LootEntry.Builder getInjectEntry(String name, int weight) {
|
||||
ResourceLocation table = new ResourceLocation(LibMisc.MOD_ID, "inject/" + name);
|
||||
return TableLootEntry.func_216171_a(table)
|
||||
.weight(weight);
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.boss.IBotaniaBoss;
|
||||
@@ -27,7 +28,7 @@ public interface IProxy {
|
||||
|
||||
String getLastVersion();
|
||||
|
||||
boolean openWikiPage(World world, Block block, RayTraceResult pos);
|
||||
boolean openWikiPage(World world, Block block, BlockRayTraceResult pos);
|
||||
|
||||
void setMultiblock(World world, int x, int y, int z, double radius, Block block);
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import net.minecraft.entity.monster.WitherSkeletonEntity;
|
||||
import net.minecraft.entity.monster.ZombieEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.init.*;
|
||||
import net.minecraft.inventory.EquipmentSlotType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
|
||||
@@ -28,6 +28,7 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.projectile.ProjectileHelper;
|
||||
import net.minecraft.entity.projectile.ThrowableEntity;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
@@ -42,6 +43,7 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RayTraceContext;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
@@ -94,7 +96,7 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
|
||||
private static final DataParameter<Float> MANA_LOSS_PER_TICK = EntityDataManager.createKey(EntityManaBurst.class, DataSerializers.FLOAT);
|
||||
private static final DataParameter<Float> GRAVITY = EntityDataManager.createKey(EntityManaBurst.class, DataSerializers.FLOAT);
|
||||
private static final DataParameter<BlockPos> SOURCE_COORDS = EntityDataManager.createKey(EntityManaBurst.class, DataSerializers.BLOCK_POS);
|
||||
private static final DataParameter<ItemStack> SOURCE_LENS = EntityDataManager.createKey(EntityManaBurst.class, DataSerializers.ITEM_STACK);
|
||||
private static final DataParameter<ItemStack> SOURCE_LENS = EntityDataManager.createKey(EntityManaBurst.class, DataSerializers.ITEMSTACK);
|
||||
|
||||
float accumulatedManaLoss = 0;
|
||||
boolean fake = false;
|
||||
@@ -180,79 +182,54 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
|
||||
|
||||
if (this.inGround) {
|
||||
this.inGround = false;
|
||||
this.motionX *= (double)(this.rand.nextFloat() * 0.2F);
|
||||
this.motionY *= (double)(this.rand.nextFloat() * 0.2F);
|
||||
this.motionZ *= (double)(this.rand.nextFloat() * 0.2F);
|
||||
this.setMotion(this.getMotion().mul((double)(this.rand.nextFloat() * 0.2F), (double)(this.rand.nextFloat() * 0.2F), (double)(this.rand.nextFloat() * 0.2F)));
|
||||
}
|
||||
|
||||
Vec3d vec3d = new Vec3d(this.posX, this.posY, this.posZ);
|
||||
Vec3d vec3d1 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||
RayTraceResult raytraceresult = this.world.rayTraceBlocks(vec3d, vec3d1);
|
||||
vec3d = new Vec3d(this.posX, this.posY, this.posZ);
|
||||
vec3d1 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||
if (raytraceresult != null) {
|
||||
vec3d1 = new Vec3d(raytraceresult.hitVec.x, raytraceresult.hitVec.y, raytraceresult.hitVec.z);
|
||||
}
|
||||
AxisAlignedBB axisalignedbb = this.getBoundingBox().expand(this.getMotion()).grow(1.0D);
|
||||
|
||||
if (!scanBeam && !world.isRemote) { // Botania - collide only on server and non-scanbeam
|
||||
Entity entity = null;
|
||||
List<Entity> list = this.world.getEntitiesWithinAABBExcludingEntity(this, this.getBoundingBox().expand(this.motionX, this.motionY, this.motionZ).grow(1.0D));
|
||||
double d0 = 0.0D;
|
||||
boolean flag = false;
|
||||
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
Entity entity1 = list.get(i);
|
||||
if (entity1.canBeCollidedWith()) {
|
||||
if (entity1 == this.ignoreEntity) {
|
||||
flag = true;
|
||||
} else if (this.thrower != null && this.ticksExisted < 2 && this.ignoreEntity == null) {
|
||||
this.ignoreEntity = entity1;
|
||||
flag = true;
|
||||
} else {
|
||||
flag = false;
|
||||
AxisAlignedBB axisalignedbb = entity1.getBoundingBox().grow((double) 0.3F);
|
||||
RayTraceResult raytraceresult1 = axisalignedbb.calculateIntercept(vec3d, vec3d1);
|
||||
if (raytraceresult1 != null) {
|
||||
double d1 = vec3d.squareDistanceTo(raytraceresult1.hitVec);
|
||||
if (d1 < d0 || d0 == 0.0D) {
|
||||
entity = entity1;
|
||||
d0 = d1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Botania - no ignoreEntity stuff at all
|
||||
for(Entity entity : this.world.getEntitiesInAABBexcluding(this, axisalignedbb, (p_213881_0_) -> {
|
||||
return !p_213881_0_.isSpectator() && p_213881_0_.canBeCollidedWith();
|
||||
})) {
|
||||
if (entity == this.ignoreEntity) {
|
||||
++this.ignoreTime;
|
||||
break;
|
||||
}
|
||||
|
||||
if (this.ignoreEntity != null) {
|
||||
/*
|
||||
if (flag) {
|
||||
this.ignoreTime = 2;
|
||||
} else if (this.ignoreTime-- <= 0) {
|
||||
this.ignoreEntity = null;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
if (entity != null) {
|
||||
raytraceresult = new RayTraceResult(entity);
|
||||
if (this.owner != null && this.ticksExisted < 2 && this.ignoreEntity == null) {
|
||||
this.ignoreEntity = entity;
|
||||
this.ignoreTime = 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (raytraceresult != null) {
|
||||
if (raytraceresult.type == RayTraceResult.Type.BLOCK && this.world.getBlockState(raytraceresult.getBlockPos()).getBlock() == Blocks.NETHER_PORTAL) {
|
||||
this.setPortal(raytraceresult.getBlockPos());
|
||||
RayTraceResult raytraceresult = ProjectileHelper.func_221267_a(this, axisalignedbb, (p_213880_1_) -> {
|
||||
return !p_213880_1_.isSpectator() && p_213880_1_.canBeCollidedWith(); // && p_213880_1_ != this.ignoreEntity;
|
||||
}, RayTraceContext.BlockMode.OUTLINE, true);
|
||||
/*
|
||||
if (this.ignoreEntity != null && this.ignoreTime-- <= 0) {
|
||||
this.ignoreEntity = null;
|
||||
}
|
||||
*/
|
||||
|
||||
if (!scanBeam && !world.isRemote() && // Botania - collide only on server and non scanbeam
|
||||
raytraceresult.getType() != RayTraceResult.Type.MISS) {
|
||||
if (raytraceresult.getType() == RayTraceResult.Type.BLOCK && this.world.getBlockState(((BlockRayTraceResult)raytraceresult).getPos()).getBlock() == Blocks.NETHER_PORTAL) {
|
||||
this.setPortal(((BlockRayTraceResult)raytraceresult).getPos());
|
||||
} else if (!net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)){
|
||||
this.onImpact(raytraceresult);
|
||||
}
|
||||
}
|
||||
|
||||
this.posX += this.motionX;
|
||||
this.posY += this.motionY;
|
||||
this.posZ += this.motionZ;
|
||||
float f = MathHelper.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
this.rotationYaw = (float)(MathHelper.atan2(this.motionX, this.motionZ) * (double)(180F / (float)Math.PI));
|
||||
Vec3d vec3d = this.getMotion();
|
||||
this.posX += vec3d.x;
|
||||
this.posY += vec3d.y;
|
||||
this.posZ += vec3d.z;
|
||||
float f = MathHelper.sqrt(func_213296_b(vec3d));
|
||||
this.rotationYaw = (float)(MathHelper.atan2(vec3d.x, vec3d.z) * (double)(180F / (float)Math.PI));
|
||||
|
||||
for(this.rotationPitch = (float)(MathHelper.atan2(this.motionY, (double)f) * (double)(180F / (float)Math.PI)); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) {
|
||||
for(this.rotationPitch = (float)(MathHelper.atan2(vec3d.y, (double)f) * (double)(180F / (float)Math.PI)); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) {
|
||||
;
|
||||
}
|
||||
|
||||
@@ -268,26 +245,24 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
|
||||
this.prevRotationYaw += 360.0F;
|
||||
}
|
||||
|
||||
this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
|
||||
this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
|
||||
float f1 = 0.99F;
|
||||
float f2 = this.getGravityVelocity();
|
||||
this.rotationPitch = MathHelper.lerp(0.2F, this.prevRotationPitch, this.rotationPitch);
|
||||
this.rotationYaw = MathHelper.lerp(0.2F, this.prevRotationYaw, this.rotationYaw);
|
||||
float f1;
|
||||
if (this.isInWater()) {
|
||||
for(int j = 0; j < 4; ++j) {
|
||||
float f3 = 0.25F;
|
||||
this.world.addParticle(ParticleTypes.BUBBLE, this.posX - this.motionX * 0.25D, this.posY - this.motionY * 0.25D, this.posZ - this.motionZ * 0.25D, this.motionX, this.motionY, this.motionZ);
|
||||
for(int i = 0; i < 4; ++i) {
|
||||
float f2 = 0.25F;
|
||||
this.world.addParticle(ParticleTypes.BUBBLE, this.posX - vec3d.x * 0.25D, this.posY - vec3d.y * 0.25D, this.posZ - vec3d.z * 0.25D, vec3d.x, vec3d.y, vec3d.z);
|
||||
}
|
||||
|
||||
f1 = 0.8F;
|
||||
} else {
|
||||
f1 = 0.99F;
|
||||
}
|
||||
|
||||
/* Botania - no drag
|
||||
this.motionX *= (double)f1;
|
||||
this.motionY *= (double)f1;
|
||||
this.motionZ *= (double)f1;
|
||||
*/
|
||||
// Botania - no drag this.setMotion(vec3d.scale((double)f1));
|
||||
if (!this.hasNoGravity()) {
|
||||
this.motionY -= (double)f2;
|
||||
Vec3d vec3d1 = this.getMotion();
|
||||
this.setMotion(vec3d1.x, vec3d1.y - (double)this.getGravityVelocity(), vec3d1.z);
|
||||
}
|
||||
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
|
||||
@@ -26,6 +26,7 @@ import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceContext;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
@@ -184,16 +185,16 @@ public class ItemAstrolabe extends ItemMod {
|
||||
|
||||
public static List<BlockPos> getBlocksToPlace(ItemStack stack, PlayerEntity player) {
|
||||
List<BlockPos> coords = new ArrayList<>();
|
||||
RayTraceResult rtr = ToolCommons.raytraceFromEntity(player.world, player, RayTraceContext.FluidMode.SOURCE_ONLY, 5);
|
||||
if(rtr != null) {
|
||||
BlockPos pos = rtr.getBlockPos();
|
||||
BlockRayTraceResult rtr = ToolCommons.raytraceFromEntity(player.world, player, RayTraceContext.FluidMode.SOURCE_ONLY, 5);
|
||||
if(rtr.getType() == RayTraceResult.Type.BLOCK) {
|
||||
BlockPos pos = rtr.getPos();
|
||||
BlockState state = player.world.getBlockState(pos);
|
||||
if(state.getMaterial().isReplaceable())
|
||||
pos = pos.down();
|
||||
|
||||
int range = (getSize(stack) ^ 1) / 2;
|
||||
|
||||
Direction dir = rtr.sideHit;
|
||||
Direction dir = rtr.getFace();
|
||||
Direction rotationDir = Direction.fromAngle(player.rotationYaw);
|
||||
|
||||
boolean pitchedVertically = player.rotationPitch > 70 || player.rotationPitch < -70;
|
||||
|
||||
@@ -34,6 +34,7 @@ import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.container.SimpleNamedContainerProvider;
|
||||
import net.minecraft.inventory.container.WorkbenchContainer;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
@@ -117,9 +118,9 @@ public class ItemCraftingHalo extends ItemMod {
|
||||
|
||||
if(!world.isRemote) {
|
||||
if(segment == 0) {
|
||||
NetworkHooks.openGui((ServerPlayerEntity) player, new ContainerProvider(world), buf -> {
|
||||
buf.writeBoolean(hand == Hand.OFF_HAND);
|
||||
});
|
||||
player.openContainer(new SimpleNamedContainerProvider(
|
||||
(windowId, playerInv, p) -> new ContainerCraftingHalo(windowId, playerInv),
|
||||
stack.getDisplayName()));
|
||||
} else {
|
||||
if(itemForPos.isEmpty())
|
||||
assignRecipe(stack, itemForPos, segment);
|
||||
@@ -607,41 +608,4 @@ public class ItemCraftingHalo extends ItemMod {
|
||||
|
||||
mc.fontRenderer.drawStringWithShadow(label.getFormattedText(), mc.mainWindow.getScaledWidth() / 2.0F - mc.fontRenderer.getStringWidth(label.getString()) / 2.0F, mc.mainWindow.getScaledHeight() / 2.0F - yoff, 0xFFFFFF);
|
||||
}
|
||||
|
||||
public static class ContainerProvider implements IInteractionObject {
|
||||
private final World world;
|
||||
|
||||
public ContainerProvider(World world) {
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Container createContainer(@Nonnull PlayerInventory inv, @Nonnull PlayerEntity player) {
|
||||
return new ContainerCraftingHalo(inv, world);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getGuiID() {
|
||||
return "botania:crafting_halo";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ITextComponent getName() {
|
||||
return new StringTextComponent(getGuiID());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ITextComponent getCustomName() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -247,13 +247,13 @@ public class ItemLexicon extends ItemMod implements ILexicon, IElvenItem {
|
||||
ItemNBTHelper.setInt(stack, TAG_QUEUE_TICKS, ticks);
|
||||
}
|
||||
|
||||
public static String getTitle(ItemStack stack) {
|
||||
String title = ModItems.lexicon.getDisplayName(ItemStack.EMPTY).getString();
|
||||
if(!stack.isEmpty())
|
||||
title = stack.getDisplayName().getString();
|
||||
|
||||
public static ITextComponent getTitle(ItemStack stack) {
|
||||
ITextComponent title = stack.getDisplayName();
|
||||
|
||||
String akashicTomeNBT = "akashictome:displayName";
|
||||
title = ItemNBTHelper.getString(stack, akashicTomeNBT, title);
|
||||
if(stack.hasTag() && stack.getTag().contains(akashicTomeNBT)) {
|
||||
title = new StringTextComponent(stack.getTag().getString(akashicTomeNBT));
|
||||
}
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
@@ -56,9 +56,8 @@ public class ItemGlassPick extends ItemManasteelPick {
|
||||
};
|
||||
|
||||
public ItemGlassPick(Properties props) {
|
||||
super(MATERIAL, props);
|
||||
super(MATERIAL, props, -1);
|
||||
MinecraftForge.EVENT_BUS.addListener(this::onBlockDrops);
|
||||
attackSpeed = -1;
|
||||
}
|
||||
|
||||
private void onBlockDrops(HarvestDropsEvent event) {
|
||||
|
||||
@@ -25,6 +25,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ToolItem;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RayTraceContext;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
@@ -138,7 +139,7 @@ public final class ToolCommons {
|
||||
}
|
||||
|
||||
// [VanillaCopy] of Item.rayTrace, edits noted
|
||||
public static RayTraceResult raytraceFromEntity(World worldIn, PlayerEntity player, RayTraceContext.FluidMode fluidMode, double range) {
|
||||
public static BlockRayTraceResult raytraceFromEntity(World worldIn, PlayerEntity player, RayTraceContext.FluidMode fluidMode, double range) {
|
||||
float f = player.rotationPitch;
|
||||
float f1 = player.rotationYaw;
|
||||
Vec3d vec3d = player.getEyePosition(1.0F);
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import vazkii.botania.common.lib.LibMisc;
|
||||
public class ItemElementiumPick extends ItemManasteelPick {
|
||||
|
||||
public ItemElementiumPick(Properties props) {
|
||||
super(BotaniaAPI.ELEMENTIUM_ITEM_TIER, props);
|
||||
super(BotaniaAPI.ELEMENTIUM_ITEM_TIER, props, -2.8F);
|
||||
MinecraftForge.EVENT_BUS.addListener(this::onHarvestDrops);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -43,11 +43,11 @@ public class ItemManasteelPick extends PickaxeItem implements IManaUsingItem, IS
|
||||
private static final int MANA_PER_DAMAGE = 60;
|
||||
|
||||
public ItemManasteelPick(Properties props) {
|
||||
this(BotaniaAPI.MANASTEEL_ITEM_TIER, props);
|
||||
this(BotaniaAPI.MANASTEEL_ITEM_TIER, props, -2.8F);
|
||||
}
|
||||
|
||||
public ItemManasteelPick(IItemTier mat, Properties props) {
|
||||
super(mat, 1, -2.8F, props);
|
||||
public ItemManasteelPick(IItemTier mat, Properties props, float attackSpeed) {
|
||||
super(mat, 1, attackSpeed, props);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ public class ItemTerraPick extends ItemManasteelPick implements IManaItem, ISequ
|
||||
};
|
||||
|
||||
public ItemTerraPick(Properties props) {
|
||||
super(BotaniaAPI.TERRASTEEL_ITEM_TIER, props);
|
||||
super(BotaniaAPI.TERRASTEEL_ITEM_TIER, props, -2.8F);
|
||||
addPropertyOverride(new ResourceLocation("botania", "tipped"), (itemStack, world, entityLivingBase) -> isTipped(itemStack) ? 1 : 0);
|
||||
addPropertyOverride(new ResourceLocation("botania", "enabled"), (itemStack, world, entityLivingBase) -> isEnabled(itemStack) ? 1 : 0);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public class PageCraftingRecipe extends PageRecipe {
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
((Screen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
|
||||
((Screen) gui).blit(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
|
||||
|
||||
int iconX = gui.getLeft() + 115;
|
||||
int iconY = gui.getTop() + 12;
|
||||
@@ -95,7 +95,7 @@ public class PageCraftingRecipe extends PageRecipe {
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
if(shapelessRecipe) {
|
||||
((Screen) gui).drawTexturedModalRect(iconX, iconY, 240, 0, 16, 16);
|
||||
((Screen) gui).blit(iconX, iconY, 240, 0, 16, 16);
|
||||
|
||||
if(mx >= iconX && my >= iconY && mx < iconX + 16 && my < iconY + 16)
|
||||
RenderHelper.renderTooltip(mx, my, Collections.singletonList(I18n.format("botaniamisc.shapeless")));
|
||||
@@ -109,7 +109,7 @@ public class PageCraftingRecipe extends PageRecipe {
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void updateScreen() {
|
||||
if(Screen.isShiftKeyDown())
|
||||
if(Screen.hasShiftDown())
|
||||
return;
|
||||
|
||||
if(ticksElapsed % 20 == 0) {
|
||||
@@ -133,7 +133,7 @@ public class PageCraftingRecipe extends PageRecipe {
|
||||
|
||||
for(int y = 0; y < height; y++)
|
||||
for(int x = 0; x < width; x++) {
|
||||
Ingredient input = recipe.getIngredients().get(y * width + x);
|
||||
Ingredient input = (Ingredient) recipe.getIngredients().get(y * width + x);
|
||||
ItemStack[] stacks = input.getMatchingStacks();
|
||||
if(stacks.length > 0) {
|
||||
renderItemAtGridPos(gui, 1 + x, 1 + y, stacks[(ticksElapsed / 40) % stacks.length], true);
|
||||
@@ -150,7 +150,7 @@ public class PageCraftingRecipe extends PageRecipe {
|
||||
if(index >= recipe.getIngredients().size())
|
||||
break drawGrid;
|
||||
|
||||
Ingredient input = recipe.getIngredients().get(index);
|
||||
Ingredient input = (Ingredient) recipe.getIngredients().get(index);
|
||||
if(input != Ingredient.EMPTY) {
|
||||
ItemStack[] stacks = input.getMatchingStacks();
|
||||
renderItemAtGridPos(gui, 1 + x, 1 + y, stacks[(ticksElapsed / 40) % stacks.length], true);
|
||||
|
||||
@@ -33,7 +33,7 @@ public class PageLoreText extends PageText {
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
((Screen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
|
||||
((Screen) gui).blit(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
|
||||
GlStateManager.disableBlend();
|
||||
super.renderScreen(gui, mx, my);
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public class PageManaInfusionRecipe extends PageRecipe {
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
((Screen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
|
||||
((Screen) gui).blit(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
|
||||
GlStateManager.disableBlend();
|
||||
|
||||
if(hoveringOverDrop) {
|
||||
@@ -139,7 +139,7 @@ public class PageManaInfusionRecipe extends PageRecipe {
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void updateScreen() {
|
||||
if(Screen.isShiftKeyDown())
|
||||
if(Screen.hasShiftDown())
|
||||
return;
|
||||
|
||||
if(ticksElapsed % 20 == 0) {
|
||||
|
||||
@@ -172,7 +172,7 @@ public class PageRecipe extends LexiconPage {
|
||||
if(data != null && (data.entry != gui.getEntry() || data.page != gui.getPageOn()) && book != null && ((ILexicon) book.getItem()).isKnowledgeUnlocked(book, data.entry.getKnowledgeType())) {
|
||||
tooltipEntry = true;
|
||||
|
||||
if(!mouseDownLastTick && mouseDown && Screen.isShiftKeyDown()) {
|
||||
if(!mouseDownLastTick && mouseDown && Screen.hasShiftDown()) {
|
||||
GuiLexiconEntry newGui = new GuiLexiconEntry(data.entry, (Screen) gui);
|
||||
newGui.page = data.page;
|
||||
Minecraft.getInstance().displayGuiScreen(newGui);
|
||||
|
||||
Reference in new issue
Block a user