mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 10:55:17 +00:00
Almost there
This commit is contained in:
1 parent
233ab271f7
commit
7cdc5c9ce0
28 files changed
+215
-184
No files matched your search
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
import net.minecraft.client.gui.widget.Widget;
|
||||
import net.minecraft.client.gui.widget.button.Button;
|
||||
import net.minecraft.client.gui.widget.button.Button;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
@@ -61,7 +62,7 @@ public interface IGuiLexiconEntry {
|
||||
/**
|
||||
* Gets the list of buttons in this gui.
|
||||
*/
|
||||
public List<Button> getButtonList();
|
||||
public List<Widget> getButtonList();
|
||||
|
||||
/**
|
||||
* Gets the total amount of ticks (+ partial ticks) the player
|
||||
|
||||
@@ -11,23 +11,24 @@
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
|
||||
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
|
||||
import net.minecraft.server.management.PlayerChunkMapEntry;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.ServerWorld;
|
||||
import net.minecraft.world.chunk.ServerChunkProvider;
|
||||
|
||||
public final class VanillaPacketDispatcher {
|
||||
|
||||
public static void dispatchTEToNearbyPlayers(TileEntity tile) {
|
||||
SUpdateTileEntityPacket packet = tile.getUpdatePacket();
|
||||
BlockPos pos = tile.getPos();
|
||||
|
||||
if(packet != null && tile.getWorld() instanceof ServerWorld) {
|
||||
PlayerChunkMapEntry chunk = ((ServerWorld) tile.getWorld()).getPlayerChunkMap().getEntry(tile.getPos().getX() >> 4, tile.getPos().getZ() >> 4);
|
||||
if(chunk != null) {
|
||||
chunk.sendPacket(packet);
|
||||
}
|
||||
((ServerChunkProvider)tile.getWorld().getChunkProvider()).chunkManager
|
||||
.getTrackingPlayers(new ChunkPos(pos), false)
|
||||
.filter(p -> p.getDistanceSq(pos.getX(), pos.getY(), pos.getZ()) < 64 * 64)
|
||||
.forEach(e -> e.connection.sendPacket(packet));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,9 @@ import net.minecraft.client.Minecraft;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.platform.GLX;
|
||||
|
||||
import net.minecraft.resources.IReloadableResourceManager;
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraft.resources.IResourceManagerReloadListener;
|
||||
import net.minecraft.resources.SimpleReloadableResourceManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
@@ -32,6 +34,7 @@ import vazkii.botania.common.lib.LibMisc;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public final class ShaderHelper {
|
||||
@@ -62,22 +65,34 @@ public final class ShaderHelper {
|
||||
}
|
||||
|
||||
public static void initShaders() {
|
||||
if (Minecraft.getInstance().getResourceManager() instanceof SimpleReloadableResourceManager) {
|
||||
((SimpleReloadableResourceManager) Minecraft.getInstance().getResourceManager()).addReloadListener(manager -> {
|
||||
deleteShader(pylonGlow); pylonGlow = 0;
|
||||
deleteShader(enchanterRune); enchanterRune = 0;
|
||||
deleteShader(manaPool); manaPool = 0;
|
||||
deleteShader(doppleganger); doppleganger = 0;
|
||||
deleteShader(halo); halo = 0;
|
||||
deleteShader(dopplegangerBar); dopplegangerBar = 0;
|
||||
deleteShader(terraPlateRune); terraPlateRune = 0;
|
||||
deleteShader(filmGrain); filmGrain = 0;
|
||||
deleteShader(gold); gold = 0;
|
||||
deleteShader(categoryButton); categoryButton = 0;
|
||||
deleteShader(alpha); alpha = 0;
|
||||
if (Minecraft.getInstance().getResourceManager() instanceof IReloadableResourceManager) {
|
||||
((IReloadableResourceManager) Minecraft.getInstance().getResourceManager()).addReloadListener(
|
||||
(IResourceManagerReloadListener) manager -> {
|
||||
deleteShader(pylonGlow);
|
||||
pylonGlow = 0;
|
||||
deleteShader(enchanterRune);
|
||||
enchanterRune = 0;
|
||||
deleteShader(manaPool);
|
||||
manaPool = 0;
|
||||
deleteShader(doppleganger);
|
||||
doppleganger = 0;
|
||||
deleteShader(halo);
|
||||
halo = 0;
|
||||
deleteShader(dopplegangerBar);
|
||||
dopplegangerBar = 0;
|
||||
deleteShader(terraPlateRune);
|
||||
terraPlateRune = 0;
|
||||
deleteShader(filmGrain);
|
||||
filmGrain = 0;
|
||||
deleteShader(gold);
|
||||
gold = 0;
|
||||
deleteShader(categoryButton);
|
||||
categoryButton = 0;
|
||||
deleteShader(alpha);
|
||||
alpha = 0;
|
||||
|
||||
loadShaders(manager);
|
||||
});
|
||||
loadShaders(manager);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +142,8 @@ public final class ShaderHelper {
|
||||
}
|
||||
|
||||
public static boolean useShaders() {
|
||||
return ConfigHandler.CLIENT.useShaders.get() && GLX.hasShaders && checkIncompatibleMods();
|
||||
// usePostProcess equivalent to hasShaders
|
||||
return ConfigHandler.CLIENT.useShaders.get() && GLX.usePostProcess && checkIncompatibleMods();
|
||||
}
|
||||
|
||||
private static boolean checkIncompatibleMods() {
|
||||
@@ -203,7 +219,7 @@ public final class ShaderHelper {
|
||||
private static String readFileAsString(IResourceManager manager, String filename) throws Exception {
|
||||
InputStream in = manager.getResource(new ResourceLocation(LibMisc.MOD_ID, filename)).getInputStream();
|
||||
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8"))) {
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8))) {
|
||||
return reader.lines().collect(Collectors.joining("\n"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,9 +10,11 @@
|
||||
*/
|
||||
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.particle.SpriteTexturedParticle;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
@@ -22,6 +24,7 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
@@ -32,7 +35,7 @@ import javax.annotation.Nonnull;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Queue;
|
||||
|
||||
public class FXSparkle extends Particle {
|
||||
public class FXSparkle extends SpriteTexturedParticle {
|
||||
|
||||
private static final ResourceLocation vanillaParticles = new ResourceLocation("textures/particle/particles.png");
|
||||
public static final ResourceLocation particles = new ResourceLocation(LibResources.MISC_PARTICLES);
|
||||
@@ -173,78 +176,48 @@ public class FXSparkle extends Particle {
|
||||
particleGravity = value;
|
||||
}
|
||||
|
||||
// Copy of Entity.pushOutOfBlocks with several important changes
|
||||
private boolean wiggleAround(double x, double y, double z)
|
||||
|
||||
|
||||
// [VanillaCopy] Entity.pushOutOfBlocks with tweaks
|
||||
private void wiggleAround(double x, double y, double z)
|
||||
{
|
||||
BlockPos blockpos = new BlockPos(x, y, z);
|
||||
double d0 = x - blockpos.getX();
|
||||
double d1 = y - blockpos.getY();
|
||||
double d2 = z - blockpos.getZ();
|
||||
Vec3d vec3d = new Vec3d(x - (double)blockpos.getX(), y - (double)blockpos.getY(), z - (double)blockpos.getZ());
|
||||
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
|
||||
Direction direction = Direction.UP;
|
||||
double d0 = Double.MAX_VALUE;
|
||||
|
||||
// Botania - change collision box list check to !airblock check
|
||||
if (!world.isAirBlock(blockpos))
|
||||
{
|
||||
Direction enumfacing = Direction.UP;
|
||||
double d3 = Double.MAX_VALUE;
|
||||
|
||||
if (!world.isBlockFullCube(blockpos.west()) && d0 < d3)
|
||||
{
|
||||
d3 = d0;
|
||||
enumfacing = Direction.WEST;
|
||||
for(Direction direction1 : new Direction[]{Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST, Direction.UP}) {
|
||||
blockpos$mutableblockpos.setPos(blockpos).move(direction1);
|
||||
if (!Block.isOpaque(this.world.getBlockState(blockpos$mutableblockpos).getCollisionShape(this.world, blockpos$mutableblockpos))) {
|
||||
double d1 = vec3d.getCoordinate(direction1.getAxis());
|
||||
double d2 = direction1.getAxisDirection() == Direction.AxisDirection.POSITIVE ? 1.0D - d1 : d1;
|
||||
if (d2 < d0) {
|
||||
d0 = d2;
|
||||
direction = direction1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!world.isBlockFullCube(blockpos.east()) && 1.0D - d0 < d3)
|
||||
{
|
||||
d3 = 1.0D - d0;
|
||||
enumfacing = Direction.EAST;
|
||||
}
|
||||
|
||||
if (!world.isBlockFullCube(blockpos.north()) && d2 < d3)
|
||||
{
|
||||
d3 = d2;
|
||||
enumfacing = Direction.NORTH;
|
||||
}
|
||||
|
||||
if (!world.isBlockFullCube(blockpos.south()) && 1.0D - d2 < d3)
|
||||
{
|
||||
d3 = 1.0D - d2;
|
||||
enumfacing = Direction.SOUTH;
|
||||
}
|
||||
|
||||
if (!world.isBlockFullCube(blockpos.up()) && 1.0D - d1 < d3)
|
||||
{
|
||||
d3 = 1.0D - d1;
|
||||
enumfacing = Direction.UP;
|
||||
}
|
||||
|
||||
float f = rand.nextFloat() * 0.05F + 0.025F; // Botania - made multiplier and add both smaller
|
||||
float f1 = enumfacing.getAxisDirection().getOffset();
|
||||
float secondary = (rand.nextFloat() - rand.nextFloat()) * 0.1F; // Botania - Make and use secondary movement variables below
|
||||
float secondary2 = (rand.nextFloat() - rand.nextFloat()) * 0.1F;
|
||||
|
||||
if (enumfacing.getAxis() == Direction.Axis.X)
|
||||
{
|
||||
motionX = f1 * f;
|
||||
motionY = secondary;
|
||||
motionZ = secondary2;
|
||||
}
|
||||
else if (enumfacing.getAxis() == Direction.Axis.Y)
|
||||
{
|
||||
motionY = f1 * f;
|
||||
motionX = secondary;
|
||||
motionZ = secondary2;
|
||||
}
|
||||
else if (enumfacing.getAxis() == Direction.Axis.Z)
|
||||
{
|
||||
motionZ = f1 * f;
|
||||
motionX = secondary;
|
||||
motionY = secondary2;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
// Botania - made multiplier and add both smaller
|
||||
float f = this.rand.nextFloat() * 0.05F + 0.025F;
|
||||
float f1 = (float)direction.getAxisDirection().getOffset();
|
||||
// Botania - Randomness in other axes as well
|
||||
float secondary = (rand.nextFloat() - rand.nextFloat()) * 0.1F;
|
||||
float secondary2 = (rand.nextFloat() - rand.nextFloat()) * 0.1F;
|
||||
if (direction.getAxis() == Direction.Axis.X) {
|
||||
motionX = (double)(f1 * f);
|
||||
motionY = secondary;
|
||||
motionZ = secondary2;
|
||||
} else if (direction.getAxis() == Direction.Axis.Y) {
|
||||
motionX = secondary;
|
||||
motionY = (double)(f1 * f);
|
||||
motionZ = secondary2;
|
||||
} else if (direction.getAxis() == Direction.Axis.Z) {
|
||||
motionX = secondary;
|
||||
motionY = secondary2;
|
||||
motionZ = (double)(f1 * f);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean corrupt = false;
|
||||
|
||||
@@ -13,6 +13,7 @@ package vazkii.botania.client.fx;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.IParticleRenderType;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.particle.SpriteTexturedParticle;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
@@ -29,7 +30,7 @@ import javax.annotation.Nonnull;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Queue;
|
||||
|
||||
public class FXWisp extends Particle {
|
||||
public class FXWisp extends SpriteTexturedParticle {
|
||||
|
||||
private static final ResourceLocation vanillaParticles = new ResourceLocation("textures/particle/particles.png");
|
||||
public static final ResourceLocation particles = new ResourceLocation(LibResources.MISC_WISP_LARGE);
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.SimpleSound;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.Widget;
|
||||
import net.minecraft.client.gui.widget.button.Button;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.button.Button;
|
||||
@@ -150,12 +151,17 @@ public class GuiLexicon extends Screen {
|
||||
int persistentScale = Math.min(PersistentVariableHelper.lexiconGuiScale, getMaxAllowedScale());
|
||||
|
||||
if(persistentScale > 0 && persistentScale != guiScale) {
|
||||
// Fake the scale temporarily so we can get the scaled width from mainWindow
|
||||
mc.gameSettings.guiScale = persistentScale;
|
||||
mc.mainWindow.updateSize();
|
||||
mc.updateWindowSize();
|
||||
|
||||
// Get the info
|
||||
width = mc.mainWindow.getScaledWidth();
|
||||
height = mc.mainWindow.getScaledHeight();
|
||||
|
||||
// Change it back
|
||||
mc.gameSettings.guiScale = guiScale;
|
||||
mc.mainWindow.updateSize();
|
||||
mc.updateWindowSize();
|
||||
}
|
||||
|
||||
List<LexiconCategory> allCategories = new ArrayList<>(BotaniaAPI.getAllCategories());
|
||||
@@ -174,7 +180,7 @@ public class GuiLexicon extends Screen {
|
||||
int x = 18;
|
||||
for(int i = 0; i < 12; i++) {
|
||||
int y = 16 + i * 12;
|
||||
buttons.add(new GuiButtonInvisible((GuiLexiconIndex) this, left + x, top + y, 110, 10, ""));
|
||||
buttons.add(new GuiButtonInvisible((GuiLexiconIndex) this, i, left + x, top + y, 110, 10, ""));
|
||||
}
|
||||
populateIndex();
|
||||
} else if(isCategoryIndex()) {
|
||||
@@ -260,7 +266,7 @@ public class GuiLexicon extends Screen {
|
||||
|
||||
GlStateManager.translated(currWidth, height / 2 - 10, 0);
|
||||
GlStateManager.scalef(4, 4, 4);
|
||||
mc.font.drawStringWithShadow(meme, 0, 0, 0xFFFFFF);
|
||||
mc.fontRenderer.drawStringWithShadow(meme, 0, 0, 0xFFFFFF);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
@@ -286,7 +292,7 @@ public class GuiLexicon extends Screen {
|
||||
|
||||
if(subtitle != null)
|
||||
drawBookmark(left + guiWidth / 2, top - getTitleHeight() + 10, subtitle, true, 191);
|
||||
drawBookmark(left + guiWidth / 2, top - getTitleHeight(), getTitle(), true);
|
||||
drawBookmark(left + guiWidth / 2, top - getTitleHeight(), getTitle().getFormattedText(), true);
|
||||
|
||||
if(isMainPage())
|
||||
drawHeader();
|
||||
@@ -411,7 +417,7 @@ public class GuiLexicon extends Screen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesGuiPauseGame() {
|
||||
public boolean isPauseScreen() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -469,7 +475,9 @@ public class GuiLexicon extends Screen {
|
||||
}
|
||||
|
||||
private void populateBookmarks() {
|
||||
buttons.removeIf(b -> b.id >= BOOKMARK_START);
|
||||
buttons.removeIf(b -> b instanceof GuiButtonBookmark
|
||||
|| b instanceof GuiButtonHistory
|
||||
|| b instanceof GuiButtonChallengeInfo);
|
||||
|
||||
int len = bookmarks.size();
|
||||
boolean thisExists = false;
|
||||
@@ -480,8 +488,8 @@ public class GuiLexicon extends Screen {
|
||||
boolean addEnabled = len < MAX_BOOKMARK_COUNT && this instanceof IParented && !thisExists;
|
||||
for(int i = 0; i < len + (addEnabled ? 1 : 0); i++) {
|
||||
boolean isAdd = i == bookmarks.size();
|
||||
GuiLexicon gui = isAdd ? null : bookmarks.get(i);
|
||||
buttons.add(new GuiButtonBookmark(left + 138, top + 18 + 14 * i, gui == null ? this : gui, gui == null ? "+" : gui.getTitle()));
|
||||
GuiLexicon destination = isAdd ? null : bookmarks.get(i);
|
||||
buttons.add(new GuiButtonBookmark(i, left + 138, top + 18 + 14 * i, destination == null ? this : destination, destination == null ? "+" : destination.getTitle().getFormattedText()));
|
||||
}
|
||||
|
||||
if(isMainPage())
|
||||
@@ -521,11 +529,11 @@ public class GuiLexicon extends Screen {
|
||||
LexiconEntry entry = tutorial.peek();
|
||||
LexiconCategory category = entry.category;
|
||||
|
||||
for(Button button : buttons)
|
||||
for(Widget button : buttons)
|
||||
if(button instanceof GuiButtonCategory) {
|
||||
GuiButtonCategory catButton = (GuiButtonCategory) button;
|
||||
if(catButton.getCategory() == category) {
|
||||
orientTutorialArrowWithButton(button);
|
||||
orientTutorialArrowWithButton(catButton);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.client.gui.lexicon;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.widget.Widget;
|
||||
import net.minecraft.client.gui.widget.button.Button;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.button.Button;
|
||||
@@ -235,7 +236,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
|
||||
@Override
|
||||
public float getZLevel() {
|
||||
return zLevel;
|
||||
return blitOffset;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -282,7 +283,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled(double w) {
|
||||
public boolean mouseScrolled(double mouseX, double mouseY, double w) {
|
||||
if(w < 0)
|
||||
nextPage();
|
||||
else if(w > 0)
|
||||
@@ -343,7 +344,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Button> getButtonList() {
|
||||
public List<Widget> getButtonList() {
|
||||
return buttons;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,15 +16,14 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiButtonBookmark extends GuiButtonLexicon {
|
||||
|
||||
private final int ordinal;
|
||||
final GuiLexicon gui;
|
||||
|
||||
public GuiButtonBookmark(int x, int y, GuiLexicon gui, String str) {
|
||||
public GuiButtonBookmark(int ordinal, int x, int y, GuiLexicon gui, String str) {
|
||||
super(x, y, gui.bookmarkWidth(str) + 5, 11, str, b -> {
|
||||
boolean modified = false;
|
||||
int i = id - GuiLexicon.BOOKMARK_START;
|
||||
String key = gui.getNotesKey();
|
||||
if(i == GuiLexicon.bookmarks.size()) {
|
||||
if(ordinal == GuiLexicon.bookmarks.size()) {
|
||||
if(!GuiLexicon.bookmarkKeys.contains(key)) {
|
||||
GuiLexicon.bookmarks.add(gui.copy());
|
||||
GuiLexicon.bookmarkKeys.add(key);
|
||||
@@ -32,12 +31,12 @@ public class GuiButtonBookmark extends GuiButtonLexicon {
|
||||
}
|
||||
} else {
|
||||
if(Screen.hasShiftDown()) {
|
||||
GuiLexicon.bookmarks.remove(i);
|
||||
GuiLexicon.bookmarkKeys.remove(i);
|
||||
GuiLexicon.bookmarks.remove(ordinal);
|
||||
GuiLexicon.bookmarkKeys.remove(ordinal);
|
||||
|
||||
modified = true;
|
||||
} else {
|
||||
GuiLexicon bookmark = GuiLexicon.bookmarks.get(i).copy();
|
||||
GuiLexicon bookmark = GuiLexicon.bookmarks.get(ordinal).copy();
|
||||
if(!bookmark.getTitle().equals(gui.getTitle())) {
|
||||
Minecraft.getInstance().displayGuiScreen(bookmark);
|
||||
if(bookmark instanceof IParented)
|
||||
@@ -51,6 +50,7 @@ public class GuiButtonBookmark extends GuiButtonLexicon {
|
||||
if(modified)
|
||||
PersistentVariableHelper.saveSafe();
|
||||
});
|
||||
this.ordinal = ordinal;
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class GuiButtonBookmark extends GuiButtonLexicon {
|
||||
if(getMessage().equals("+"))
|
||||
tooltip.add(I18n.format("botaniamisc.clickToAdd"));
|
||||
else {
|
||||
tooltip.add(I18n.format("botaniamisc.bookmark", id - GuiLexicon.BOOKMARK_START + 1));
|
||||
tooltip.add(I18n.format("botaniamisc.bookmark", ordinal));
|
||||
tooltip.add(TextFormatting.GRAY + I18n.format("botaniamisc.clickToSee"));
|
||||
tooltip.add(TextFormatting.GRAY + I18n.format("botaniamisc.shiftToRemove"));
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public class GuiButtonCategory extends GuiButtonLexicon {
|
||||
}
|
||||
|
||||
ShaderHelper.useShader(ShaderHelper.categoryButton, shaderCallback);
|
||||
RenderHelper.drawTexturedModalRect(x * 2, y * 2, zLevel * 2, 0, 0, 32, 32, s, s);
|
||||
RenderHelper.drawTexturedModalRect(x * 2, y * 2, blitOffset * 2, 0, 0, 32, 32, s, s);
|
||||
ShaderHelper.releaseShader();
|
||||
|
||||
if(shaders) {
|
||||
|
||||
@@ -36,12 +36,12 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
|
||||
PersistentVariableHelper.dog = true;
|
||||
PersistentVariableHelper.saveSafe();
|
||||
} else {
|
||||
// todo 1.13 is this the right place? moved from GuiLexiconIndex.actionPerformed
|
||||
int index = id + button.gui.page * 12;
|
||||
int index = button.ordinal + button.gui.page * 12;
|
||||
button.gui.openEntry(index);
|
||||
}
|
||||
};
|
||||
|
||||
private final int ordinal;
|
||||
private final GuiLexiconIndex gui;
|
||||
public ItemStack displayStack = ItemStack.EMPTY;
|
||||
public boolean dog = false;
|
||||
@@ -50,8 +50,9 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
|
||||
private boolean enableDog = false;
|
||||
private double dogPos = 0;
|
||||
|
||||
public GuiButtonInvisible(GuiLexiconIndex gui, int x, int y, int width, int height, String text) {
|
||||
public GuiButtonInvisible(GuiLexiconIndex gui, int ordinal, int x, int y, int width, int height, String text) {
|
||||
super(x, y, width, height, text, ON_PRESS);
|
||||
this.ordinal = ordinal;
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
@@ -64,7 +65,7 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
|
||||
float f = 1F / 64F;
|
||||
GlStateManager.translated(dogPos, 0, 0);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
vazkii.botania.client.core.helper.RenderHelper.drawTexturedModalRect(0, y, zLevel + 10, dogPos % 100 < 50 ? 23 : 0, 0, 23, 19, f, f);
|
||||
vazkii.botania.client.core.helper.RenderHelper.drawTexturedModalRect(0, y, blitOffset + 10, dogPos % 100 < 50 ? 23 : 0, 0, 23, 19, f, f);
|
||||
x = (int) Math.max(x, dogPos + 10);
|
||||
|
||||
GlStateManager.translated(-dogPos, 0, 0);
|
||||
|
||||
@@ -19,6 +19,7 @@ import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.DyeColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Effects;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
@@ -53,7 +54,7 @@ public class BlockSpecialFlower extends FlowerBlock implements ISpecialFlower, I
|
||||
private final Supplier<? extends TileEntitySpecialFlower> teProvider;
|
||||
|
||||
protected BlockSpecialFlower(Properties props, Supplier<? extends TileEntitySpecialFlower> teProvider) {
|
||||
super(props);
|
||||
super(Effects.REGENERATION, 1, props); // todo 1.14 choose potion effects
|
||||
this.teProvider = teProvider;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,9 +19,12 @@ import net.minecraft.dispenser.DefaultDispenseItemBehavior;
|
||||
import net.minecraft.dispenser.IBlockSource;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.item.DirectionalPlaceContext;
|
||||
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.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -34,8 +37,8 @@ public class BehaviourCocoaBeans extends DefaultDispenseItemBehavior {
|
||||
Direction facing = source.getBlockState().get(DispenserBlock.FACING);
|
||||
BlockPos pos = source.getBlockPos().offset(facing);
|
||||
World world = source.getWorld();
|
||||
|
||||
BlockState cocoa = block.getStateForPlacement(new BlockItemUseContext(world, null, stack, pos, facing.getOpposite(), 0, 0, 0));
|
||||
BlockItemUseContext ctx = new DirectionalPlaceContext(source.getWorld(), source.getBlockPos(), facing, new ItemStack(block), facing.getOpposite());
|
||||
BlockState cocoa = block.getStateForPlacement(ctx);
|
||||
if(cocoa != null && world.isAirBlock(pos)) {
|
||||
world.setBlockState(pos, cocoa);
|
||||
stack.shrink(1);
|
||||
|
||||
@@ -79,7 +79,6 @@ public abstract class EquipmentHandler {
|
||||
static class InventoryEquipmentHandler extends EquipmentHandler {
|
||||
private final Map<PlayerEntity, ItemStack[]> map = new WeakHashMap<>();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerTick(TickEvent.PlayerTickEvent event) {
|
||||
if(event.phase != TickEvent.Phase.START || event.player.world.isRemote)
|
||||
return;
|
||||
|
||||
@@ -8,9 +8,12 @@ import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.ServerWorld;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
@@ -115,5 +118,34 @@ public final class PlayerHelper {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Temporarily swap <code>toUse</code> into the hand of the player, use it, then swap it back out.
|
||||
* This is to ensure that any code in mods' onItemUse that relies on player.getHeldItem(ctx.hand) == ctx.stack
|
||||
* will work as intended.
|
||||
*
|
||||
* Properly handles null players, as long as the Item's onItemUse also handles them.
|
||||
*/
|
||||
public static ActionResultType substituteUse(ItemUseContext ctx, ItemStack toUse) {
|
||||
ItemStack save = ItemStack.EMPTY;
|
||||
BlockRayTraceResult hit = new BlockRayTraceResult(ctx.getHitVec(), ctx.getFace(), ctx.getPos(), ctx.func_221533_k());
|
||||
ItemUseContext newCtx;
|
||||
|
||||
if(ctx.getPlayer() != null) {
|
||||
save = ctx.getPlayer().getHeldItem(ctx.getHand());
|
||||
ctx.getPlayer().setHeldItem(ctx.getHand(), toUse);
|
||||
newCtx = new ItemUseContext(ctx.getPlayer(), ctx.getHand(), hit);
|
||||
} else {
|
||||
newCtx = new ItemUseContext(ctx.getWorld(), null, ctx.getHand(), toUse, hit);
|
||||
}
|
||||
|
||||
ActionResultType result = toUse.onItemUse(newCtx);
|
||||
|
||||
if(ctx.getPlayer() != null) {
|
||||
ctx.getPlayer().setHeldItem(ctx.getHand(), save);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private PlayerHelper() {}
|
||||
}
|
||||
@@ -600,8 +600,9 @@ public final class ModCraftingRecipes {
|
||||
String jsonGroup = group.toString();
|
||||
|
||||
return server.getRecipeManager().getRecipes(IRecipeType.CRAFTING)
|
||||
.values()
|
||||
.stream()
|
||||
.filter((ICraftingRecipe r) -> jsonGroup.equals(r.getGroup()))
|
||||
.filter(r -> jsonGroup.equals(r.getGroup()))
|
||||
.map(IRecipe::getId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.minecraftforge.fml.InterModComms;
|
||||
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
|
||||
import org.apache.commons.lang3.tuple.ImmutableTriple;
|
||||
import top.theillusivec4.curios.api.CuriosAPI;
|
||||
import top.theillusivec4.curios.api.capability.CuriosCapability;
|
||||
import top.theillusivec4.curios.api.capability.ICurio;
|
||||
@@ -65,14 +66,16 @@ public class CurioIntegration extends EquipmentHandler {
|
||||
|
||||
@Override
|
||||
protected ItemStack findItem(Item item, LivingEntity living) {
|
||||
CuriosAPI.FinderData result = CuriosAPI.getCurioEquipped(item, living);
|
||||
return result == null ? ItemStack.EMPTY : result.getStack();
|
||||
return CuriosAPI.getCurioEquipped(item, living)
|
||||
.map(ImmutableTriple::getRight)
|
||||
.orElse(ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack findItem(Predicate<ItemStack> pred, LivingEntity living) {
|
||||
CuriosAPI.FinderData result = CuriosAPI.getCurioEquipped(pred, living);
|
||||
return result == null ? ItemStack.EMPTY : result.getStack();
|
||||
return CuriosAPI.getCurioEquipped(pred, living)
|
||||
.map(ImmutableTriple::getRight)
|
||||
.orElse(ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -33,6 +33,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.ResourceLocationException;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
@@ -50,6 +51,7 @@ import vazkii.botania.api.item.IBlockProvider;
|
||||
import vazkii.botania.client.core.handler.ItemsRemainingRenderHandler;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.core.helper.PlayerHelper;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
@@ -115,8 +117,7 @@ public class ItemBlackHoleTalisman extends ItemMod implements IBlockProvider {
|
||||
} else {
|
||||
if(player == null || player.abilities.isCreativeMode || getBlockCount(stack) > 0) {
|
||||
ItemStack toUse = new ItemStack(bBlock);
|
||||
ItemUseContext newCtx = new ItemUseContext(world, ctx.getPlayer(), stack, pos, side, ctx.getHitX(), ctx.getHitY(), ctx.getHitZ());
|
||||
ActionResultType result = toUse.getItem().onItemUse(newCtx);
|
||||
ActionResultType result = PlayerHelper.substituteUse(ctx, toUse);
|
||||
|
||||
if (result == ActionResultType.SUCCESS) {
|
||||
remove(stack, 1);
|
||||
|
||||
@@ -10,9 +10,12 @@
|
||||
*/
|
||||
package vazkii.botania.common.item;
|
||||
|
||||
import net.minecraft.advancements.CriteriaTriggers;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.IBucketPickupHandler;
|
||||
import net.minecraft.block.ILiquidContainer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
@@ -24,6 +27,8 @@ import net.minecraft.stats.Stats;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.util.ActionResult;
|
||||
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;
|
||||
|
||||
@@ -35,33 +40,38 @@ public class ItemOpenBucket extends ItemMod {
|
||||
super(props);
|
||||
}
|
||||
|
||||
// [VanillaCopy] ItemBucket, only the empty cases
|
||||
// [VanillaCopy] BucketItem, only the empty cases
|
||||
@Nonnull
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, @Nonnull Hand handIn) {
|
||||
ItemStack itemstack = playerIn.getHeldItem(handIn);
|
||||
RayTraceResult raytraceresult = this.rayTrace(worldIn, playerIn, true);
|
||||
|
||||
RayTraceResult raytraceresult = rayTrace(worldIn, playerIn, RayTraceContext.FluidMode.SOURCE_ONLY);
|
||||
ActionResult<ItemStack> ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(playerIn, worldIn, itemstack, raytraceresult);
|
||||
if (ret != null) return ret;
|
||||
|
||||
if (raytraceresult == null) {
|
||||
if (raytraceresult.getType() == RayTraceResult.Type.MISS) {
|
||||
return new ActionResult<>(ActionResultType.PASS, itemstack);
|
||||
} else if (raytraceresult.type == RayTraceResult.Type.BLOCK) {
|
||||
BlockPos blockpos = raytraceresult.getBlockPos();
|
||||
if (worldIn.isBlockModifiable(playerIn, blockpos) && playerIn.canPlayerEdit(blockpos, raytraceresult.sideHit, itemstack)) {
|
||||
BlockState iblockstate1 = worldIn.getBlockState(blockpos);
|
||||
if (iblockstate1.getBlock() instanceof IBucketPickupHandler) {
|
||||
Fluid fluid = ((IBucketPickupHandler)iblockstate1.getBlock()).pickupFluid(worldIn, blockpos, iblockstate1);
|
||||
} else if (raytraceresult.getType() != RayTraceResult.Type.BLOCK) {
|
||||
return new ActionResult<>(ActionResultType.PASS, itemstack);
|
||||
} else {
|
||||
BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)raytraceresult;
|
||||
BlockPos blockpos = blockraytraceresult.getPos();
|
||||
if (worldIn.isBlockModifiable(playerIn, blockpos) && playerIn.canPlayerEdit(blockpos, blockraytraceresult.getFace(), itemstack)) {
|
||||
BlockState blockstate1 = worldIn.getBlockState(blockpos);
|
||||
if (blockstate1.getBlock() instanceof IBucketPickupHandler) {
|
||||
Fluid fluid = ((IBucketPickupHandler)blockstate1.getBlock()).pickupFluid(worldIn, blockpos, blockstate1);
|
||||
if (fluid != Fluids.EMPTY) {
|
||||
playerIn.addStat(Stats.ITEM_USED.get(this));
|
||||
playerIn.playSound(fluid.isIn(FluidTags.LAVA) ? SoundEvents.ITEM_BUCKET_FILL_LAVA : SoundEvents.ITEM_BUCKET_FILL, 1.0F, 1.0F);
|
||||
|
||||
// Botania: some particles
|
||||
for(int x = 0; x < 5; x++)
|
||||
worldIn.addParticle(ParticleTypes.POOF, blockpos.getX() + Math.random(), blockpos.getY() + Math.random(), blockpos.getZ() + Math.random(), 0, 0, 0);
|
||||
|
||||
return new ActionResult<>(ActionResultType.SUCCESS, itemstack);
|
||||
ItemStack itemstack1 = itemstack; // this.fillBucket(itemstack, playerIn, fluid.getFilledBucket());
|
||||
if (!worldIn.isRemote) {
|
||||
CriteriaTriggers.FILLED_BUCKET.trigger((ServerPlayerEntity)playerIn, new ItemStack(fluid.getFilledBucket()));
|
||||
}
|
||||
|
||||
return new ActionResult<>(ActionResultType.SUCCESS, itemstack1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,8 +79,6 @@ public class ItemOpenBucket extends ItemMod {
|
||||
} else {
|
||||
return new ActionResult<>(ActionResultType.FAIL, itemstack);
|
||||
}
|
||||
} else {
|
||||
return new ActionResult<>(ActionResultType.PASS, itemstack);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ import net.minecraftforge.registries.ForgeRegistries;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.advancements.UseItemSuccessTrigger;
|
||||
import vazkii.botania.common.core.helper.PlayerHelper;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -113,9 +114,7 @@ public class ItemSpawnerMover extends ItemMod {
|
||||
}
|
||||
|
||||
private ActionResultType placeSpawner(ItemUseContext ctx) {
|
||||
ItemStack spawner = new ItemStack(Blocks.SPAWNER);
|
||||
ItemUseContext placeCtx = new BlockItemUseContext(ctx.getWorld(), ctx.getPlayer(), spawner, ctx.getPos(), ctx.getFace(), ctx.getHitX(), ctx.getHitY(), ctx.getHitZ());
|
||||
ActionResultType res = spawner.onItemUse(placeCtx);
|
||||
ActionResultType res = PlayerHelper.substituteUse(ctx, new ItemStack(Blocks.SPAWNER));
|
||||
|
||||
if(res == ActionResultType.SUCCESS) {
|
||||
World world = ctx.getWorld();
|
||||
|
||||
@@ -34,7 +34,6 @@ import vazkii.botania.common.core.handler.EquipmentHandler;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.core.helper.MathHelper;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.integration.curios.CurioIntegration;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -61,11 +61,11 @@ public class ItemGlassPick extends ItemManasteelPick {
|
||||
}
|
||||
|
||||
private void onBlockDrops(HarvestDropsEvent event) {
|
||||
// todo 1.14 need to change to fake a silk touch tool in the loot context
|
||||
if(event.getHarvester() != null && event.getState() != null && event.getDrops() != null && event.getDrops().isEmpty()
|
||||
&& !event.getHarvester().getHeldItemMainhand().isEmpty()
|
||||
&& event.getHarvester().getHeldItemMainhand().getItem() == this
|
||||
&& event.getState().getMaterial() == Material.GLASS
|
||||
&& event.getState().canSilkHarvest(event.getWorld().getWorld(), event.getPos(), event.getHarvester()))
|
||||
&& event.getState().getMaterial() == Material.GLASS)
|
||||
event.getDrops().add(new ItemStack(event.getState().getBlock()));
|
||||
}
|
||||
|
||||
|
||||
+2
-8
@@ -40,6 +40,7 @@ import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.client.core.handler.ItemsRemainingRenderHandler;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.core.BotaniaCreativeTab;
|
||||
import vazkii.botania.common.core.helper.PlayerHelper;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.equipment.tool.ToolCommons;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
@@ -88,14 +89,7 @@ public class ItemManasteelAxe extends AxeItem implements IManaUsingItem, ISortab
|
||||
for(int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
ItemStack stackAt = player.inventory.getStackInSlot(i);
|
||||
if(!stackAt.isEmpty() && SAPLING_PATTERN.matcher(stackAt.getItem().getTranslationKey()).find()) {
|
||||
ItemStack save = player.getHeldItem(ctx.getHand());
|
||||
|
||||
player.setHeldItem(ctx.getHand(), stackAt);
|
||||
BlockRayTraceResult hit = new BlockRayTraceResult(ctx.getHitVec(), ctx.getFace(),
|
||||
ctx.getPos(), ctx.func_221533_k());
|
||||
ActionResultType did = stackAt.getItem().onItemUse(new ItemUseContext(player, ctx.getHand(), hit));
|
||||
player.setHeldItem(ctx.getHand(), save);
|
||||
|
||||
ActionResultType did = PlayerHelper.substituteUse(ctx, stackAt);
|
||||
ItemsRemainingRenderHandler.set(player, new ItemStack(Blocks.OAK_SAPLING), SAPLING_PATTERN);
|
||||
return did;
|
||||
}
|
||||
|
||||
+2
-8
@@ -31,6 +31,7 @@ import vazkii.botania.api.item.ISortableTool;
|
||||
import vazkii.botania.api.mana.IManaUsingItem;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.client.core.handler.ItemsRemainingRenderHandler;
|
||||
import vazkii.botania.common.core.helper.PlayerHelper;
|
||||
import vazkii.botania.common.item.equipment.tool.ToolCommons;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -73,14 +74,7 @@ public class ItemManasteelPick extends PickaxeItem implements IManaUsingItem, IS
|
||||
for(int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
ItemStack stackAt = player.inventory.getStackInSlot(i);
|
||||
if(!stackAt.isEmpty() && TORCH_PATTERN.matcher(stackAt.getItem().getTranslationKey()).find()) {
|
||||
ItemStack save = player.getHeldItem(ctx.getHand());
|
||||
|
||||
player.setHeldItem(ctx.getHand(), stackAt);
|
||||
BlockRayTraceResult hit = new BlockRayTraceResult(ctx.getHitVec(), ctx.getFace(),
|
||||
ctx.getPos(), ctx.func_221533_k());
|
||||
ActionResultType did = stackAt.getItem().onItemUse(new ItemUseContext(player, ctx.getHand(), hit));
|
||||
player.setHeldItem(ctx.getHand(), save);
|
||||
|
||||
ActionResultType did = PlayerHelper.substituteUse(ctx, stackAt);
|
||||
ItemsRemainingRenderHandler.set(player, new ItemStack(Blocks.TORCH), TORCH_PATTERN);
|
||||
return did;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import vazkii.botania.api.mana.IManaUsingItem;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.helper.PlayerHelper;
|
||||
import vazkii.botania.common.item.ItemMod;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
@@ -69,13 +70,8 @@ public class ItemDirtRod extends ItemMod implements IManaUsingItem, IBlockProvid
|
||||
new AxisAlignedBB(pos.offset(side), pos.offset(side).add(1, 1, 1))).size();
|
||||
|
||||
if(entities == 0) {
|
||||
ItemStack save = player.getHeldItem(ctx.getHand());
|
||||
ItemStack stackToPlace = new ItemStack(block);
|
||||
player.setHeldItem(ctx.getHand(), stackToPlace);
|
||||
ItemUseContext newCtx = new ItemUseContext(player, ctx.getHand(),
|
||||
new BlockRayTraceResult(ctx.getHitVec(), side, pos, ctx.func_221533_k()));
|
||||
stackToPlace.onItemUse(newCtx);
|
||||
player.setHeldItem(ctx.getHand(), save);
|
||||
PlayerHelper.substituteUse(ctx, stackToPlace);
|
||||
|
||||
if(stackToPlace.isEmpty()) {
|
||||
ManaItemHandler.requestManaExactForTool(stack, player, cost, true);
|
||||
|
||||
@@ -29,6 +29,7 @@ import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.helper.PlayerHelper;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
@@ -56,13 +57,9 @@ public class ItemSkyDirtRod extends ItemDirtRod {
|
||||
int entities = world.getEntitiesWithinAABB(LivingEntity.class, new AxisAlignedBB(x, y, z, x + 1, y + 1, z + 1)).size();
|
||||
|
||||
if(entities == 0) {
|
||||
ItemStack save = player.getHeldItem(hand);
|
||||
ItemStack stackToPlace = new ItemStack(Blocks.DIRT);
|
||||
player.setHeldItem(hand, stackToPlace);
|
||||
BlockRayTraceResult hit = new BlockRayTraceResult(Vec3d.ZERO, Direction.DOWN, new BlockPos(x, y, z), false);
|
||||
ItemUseContext ctx = new ItemUseContext(player, hand, hit);
|
||||
stackToPlace.onItemUse(ctx);
|
||||
player.setHeldItem(hand, save);
|
||||
PlayerHelper.substituteUse(new ItemUseContext(player, hand, hit), stackToPlace);
|
||||
|
||||
if(stackToPlace.isEmpty()) {
|
||||
ManaItemHandler.requestManaExactForTool(stack, player, COST * 2, true);
|
||||
|
||||
@@ -56,7 +56,7 @@ public class WorldTypeSkyblock extends WorldType {
|
||||
@Nonnull
|
||||
@Override
|
||||
public ChunkGenerator<?> createChunkGenerator(@Nonnull World world) {
|
||||
world.setSeaLevel(64);
|
||||
// todo 1.14 world.setSeaLevel(64);
|
||||
|
||||
FlatGenerationSettings settings = new FlatGenerationSettings();
|
||||
settings.setBiome(Biomes.PLAINS);
|
||||
|
||||
Reference in new issue
Block a user