Fix most non rendering issues

This commit is contained in:
Vincent Lee committed 2020-01-09 21:49:02 -06:00
1 parent bafd2bfa6d
commit 24e777cab5
88 files changed
+397 -454

No files matched your search

@@ -61,10 +61,10 @@ public final class AstrolabePreviewHandler {
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
ShaderHelper.useShader(ShaderHelper.alpha, shader -> {
int alpha = GLX.glGetUniformLocation(shader, "alpha");
int alpha = GlStateManager.getUniformLocation(shader, "alpha");
ShaderHelper.FLOAT_BUF.position(0);
ShaderHelper.FLOAT_BUF.put(0, 0.4F);
GLX.glUniform1(alpha, ShaderHelper.FLOAT_BUF);
GlStateManager.uniform1(alpha, ShaderHelper.FLOAT_BUF);
});
for(BlockPos coord : coords)
@@ -97,12 +97,12 @@ public final class BossBarHandler {
@Override
public void call(int shader) {
int startXUniform = GLX.glGetUniformLocation(shader, "startX");
int startYUniform = GLX.glGetUniformLocation(shader, "startY");
int startXUniform = GlStateManager.getUniformLocation(shader, "startX");
int startYUniform = GlStateManager.getUniformLocation(shader, "startY");
GLX.glUniform1i(startXUniform, x);
GLX.glUniform1i(startYUniform, y);
GlStateManager.uniform1(startXUniform, x);
GlStateManager.uniform1(startYUniform, y);
if(callback != null)
callback.call(shader);
@@ -317,11 +317,9 @@ public final class HUDHandler {
RenderHelper.drawTexturedModalRect(x, y, 0, u, v, 22, 15);
GlStateManager.color4f(1F, 1F, 1F, 1F);
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
mc.getItemRenderer().renderItemAndEffectIntoGUI(stack, x - 20, y);
mc.getItemRenderer().renderItemAndEffectIntoGUI(recipe.getOutput(), x + 26, y);
mc.getItemRenderer().renderItemOverlays(mc.fontRenderer, recipe.getOutput(), x + 26, y);
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
GlStateManager.disableLighting();
GlStateManager.disableBlend();
@@ -349,10 +347,8 @@ public final class HUDHandler {
mc.fontRenderer.drawStringWithShadow(tile.getItemCount() + "x", w / 2 + 30, h / 2, 0xFFFFFF);
if(tile.locked)
mc.fontRenderer.drawStringWithShadow(I18n.format("botaniamisc.locked"), w / 2 + 30, h / 2 + 10, 0xFFAA00);
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
GlStateManager.enableRescaleNormal();
mc.getItemRenderer().renderItemAndEffectIntoGUI(target, w / 2 + 10, h / 2 - 10);
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
}
profiler.endSection();
@@ -370,10 +366,8 @@ public final class HUDHandler {
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);
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
mc.fontRenderer.drawStringWithShadow(txt0, x + 20, y, 0xFFFFFF);
mc.fontRenderer.drawStringWithShadow(txt1, x + 20, y + 14, 0xFFFFFF);
@@ -412,10 +406,8 @@ public final class HUDHandler {
int x = mc.getWindow().getScaledWidth() / 2 + 55;
int y = mc.getWindow().getScaledHeight() / 2 + 12;
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
GlStateManager.enableRescaleNormal();
mc.getItemRenderer().renderItemAndEffectIntoGUI(bindDisplay, x, y);
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
GlStateManager.disableDepthTest();
if(properlyBound) {
@@ -48,14 +48,12 @@ public final class ItemsRemainingRenderHandler {
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.color4f(1F, 1F, 1F, alpha);
RenderHelper.enableGUIStandardItemLighting();
int xp = x + (int) (16F * (1F - alpha));
GlStateManager.translatef(xp, y, 0F);
GlStateManager.scalef(alpha, 1F, 1F);
mc.getItemRenderer().renderItemAndEffectIntoGUI(stack, 0, 0);
GlStateManager.scalef(1F / alpha,1F, 1F);
GlStateManager.translatef(-xp, -y, 0F);
RenderHelper.disableStandardItemLighting();
GlStateManager.color4f(1F, 1F, 1F, 1F);
GlStateManager.enableBlend();
@@ -90,35 +90,35 @@ public final class ModelHandler {
RenderTileFloatingFlower renderTileFloatingFlower = new RenderTileFloatingFlower();
RenderTilePylon renderTilePylon = new RenderTilePylon();
ClientRegistry.bindTileEntitySpecialRenderer(TileAltar.class, new RenderTileAltar());
ClientRegistry.bindTileEntitySpecialRenderer(TileSpreader.class, new RenderTileSpreader());
ClientRegistry.bindTileEntitySpecialRenderer(TilePool.class, new RenderTilePool());
ClientRegistry.bindTileEntitySpecialRenderer(TileRuneAltar.class, new RenderTileRuneAltar());
ClientRegistry.bindTileEntitySpecialRenderer(TilePylon.class, renderTilePylon);
ClientRegistry.bindTileEntitySpecialRenderer(TileEnchanter.class, new RenderTileEnchanter());
ClientRegistry.bindTileEntitySpecialRenderer(TileAlfPortal.class, new RenderTileAlfPortal());
ClientRegistry.bindTileEntitySpecialRenderer(TileFloatingFlower.class, renderTileFloatingFlower);
ClientRegistry.bindTileEntityRenderer(TileAltar.TYPE, new RenderTileAltar());
ClientRegistry.bindTileEntityRenderer(TileSpreader.TYPE, new RenderTileSpreader());
ClientRegistry.bindTileEntityRenderer(TilePool.TYPE, new RenderTilePool());
ClientRegistry.bindTileEntityRenderer(TileRuneAltar.TYPE, new RenderTileRuneAltar());
ClientRegistry.bindTileEntityRenderer(TilePylon.TYPE, renderTilePylon);
ClientRegistry.bindTileEntityRenderer(TileEnchanter.TYPE, new RenderTileEnchanter());
ClientRegistry.bindTileEntityRenderer(TileAlfPortal.TYPE, new RenderTileAlfPortal());
ClientRegistry.bindTileEntityRenderer(TileFloatingFlower.TYPE, renderTileFloatingFlower);
// TODO 1.14 this seems highly questionable.
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySpecialFlower.class, renderTileFloatingFlower);
ClientRegistry.bindTileEntitySpecialRenderer(TileTinyPotato.class, new RenderTileTinyPotato());
ClientRegistry.bindTileEntitySpecialRenderer(TileStarfield.class, new RenderTileStarfield());
ClientRegistry.bindTileEntitySpecialRenderer(TileBrewery.class, new RenderTileBrewery());
ClientRegistry.bindTileEntitySpecialRenderer(TileTerraPlate.class, new RenderTileTerraPlate());
ClientRegistry.bindTileEntitySpecialRenderer(TileRedString.class, new RenderTileRedString());
ClientRegistry.bindTileEntitySpecialRenderer(TilePrism.class, new RenderTilePrism());
ClientRegistry.bindTileEntitySpecialRenderer(TileCorporeaIndex.class, new RenderTileCorporeaIndex());
ClientRegistry.bindTileEntitySpecialRenderer(TilePump.class, new RenderTilePump());
ClientRegistry.bindTileEntitySpecialRenderer(TileCorporeaCrystalCube.class, new RenderTileCorporeaCrystalCube());
ClientRegistry.bindTileEntitySpecialRenderer(TileIncensePlate.class, new RenderTileIncensePlate());
ClientRegistry.bindTileEntitySpecialRenderer(TileHourglass.class, new RenderTileHourglass());
ClientRegistry.bindTileEntitySpecialRenderer(TileSparkChanger.class, new RenderTileSparkChanger());
ClientRegistry.bindTileEntitySpecialRenderer(TileCocoon.class, new RenderTileCocoon());
ClientRegistry.bindTileEntitySpecialRenderer(TileLightRelay.class, new RenderTileLightRelay());
ClientRegistry.bindTileEntitySpecialRenderer(TileBellows.class, new RenderTileBellows());
ClientRegistry.bindTileEntitySpecialRenderer(TileGaiaHead.class, new RenderTileGaiaHead());
ClientRegistry.bindTileEntitySpecialRenderer(TileTeruTeruBozu.class, new RenderTileTeruTeruBozu());
ClientRegistry.bindTileEntitySpecialRenderer(TileAvatar.class, new RenderTileAvatar());
ClientRegistry.bindTileEntitySpecialRenderer(TileAnimatedTorch.class, new RenderTileAnimatedTorch());
ClientRegistry.bindTileEntityRenderer(TileEntitySpecialFlower.class, renderTileFloatingFlower);
ClientRegistry.bindTileEntityRenderer(TileTinyPotato.TYPE, new RenderTileTinyPotato());
ClientRegistry.bindTileEntityRenderer(TileStarfield.TYPE, new RenderTileStarfield());
ClientRegistry.bindTileEntityRenderer(TileBrewery.TYPE, new RenderTileBrewery());
ClientRegistry.bindTileEntityRenderer(TileTerraPlate.TYPE, new RenderTileTerraPlate());
ClientRegistry.bindTileEntityRenderer(TileRedString.TYPE, new RenderTileRedString());
ClientRegistry.bindTileEntityRenderer(TilePrism.TYPE, new RenderTilePrism());
ClientRegistry.bindTileEntityRenderer(TileCorporeaIndex.TYPE, new RenderTileCorporeaIndex());
ClientRegistry.bindTileEntityRenderer(TilePump.TYPE, new RenderTilePump());
ClientRegistry.bindTileEntityRenderer(TileCorporeaCrystalCube.TYPE, new RenderTileCorporeaCrystalCube());
ClientRegistry.bindTileEntityRenderer(TileIncensePlate.TYPE, new RenderTileIncensePlate());
ClientRegistry.bindTileEntityRenderer(TileHourglass.TYPE, new RenderTileHourglass());
ClientRegistry.bindTileEntityRenderer(TileSparkChanger.TYPE, new RenderTileSparkChanger());
ClientRegistry.bindTileEntityRenderer(TileCocoon.TYPE, new RenderTileCocoon());
ClientRegistry.bindTileEntityRenderer(TileLightRelay.TYPE, new RenderTileLightRelay());
ClientRegistry.bindTileEntityRenderer(TileBellows.TYPE, new RenderTileBellows());
ClientRegistry.bindTileEntityRenderer(TileGaiaHead.TYPE, new RenderTileGaiaHead());
ClientRegistry.bindTileEntityRenderer(TileTeruTeruBozu.TYPE, new RenderTileTeruTeruBozu());
ClientRegistry.bindTileEntityRenderer(TileAvatar.TYPE, new RenderTileAvatar());
ClientRegistry.bindTileEntityRenderer(TileAnimatedTorch.TYPE, new RenderTileAnimatedTorch());
RenderingRegistry.registerEntityRenderingHandler(EntityPixie.class, RenderPixie::new);
RenderingRegistry.registerEntityRenderingHandler(EntityDoppleganger.class, RenderDoppleganger::new);
@@ -112,10 +112,10 @@ public final class RenderHelper {
GlStateManager.shadeModel(GL11.GL_SMOOTH);
Tessellator var15 = Tessellator.getInstance();
var15.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
var15.getBuffer().pos(par3, par2, z).color(var8, var9, var10, var7).endVertex();
var15.getBuffer().pos(par1, par2, z).color(var8, var9, var10, var7).endVertex();
var15.getBuffer().pos(par1, par4, z).color(var12, var13, var14, var11).endVertex();
var15.getBuffer().pos(par3, par4, z).color(var12, var13, var14, var11).endVertex();
var15.getBuffer().vertex(par3, par2, z).color(var8, var9, var10, var7).endVertex();
var15.getBuffer().vertex(par1, par2, z).color(var8, var9, var10, var7).endVertex();
var15.getBuffer().vertex(par1, par4, z).color(var12, var13, var14, var11).endVertex();
var15.getBuffer().vertex(par3, par4, z).color(var12, var13, var14, var11).endVertex();
var15.draw();
GlStateManager.shadeModel(GL11.GL_FLAT);
GlStateManager.disableBlend();
@@ -130,10 +130,10 @@ public final class RenderHelper {
public static void drawTexturedModalRect(int par1, int par2, float z, int par3, int par4, int par5, int par6, float f, float f1) {
Tessellator tessellator = Tessellator.getInstance();
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
tessellator.getBuffer().pos(par1, par2 + par6, z).tex(par3 * f, (par4 + par6) * f1).endVertex();
tessellator.getBuffer().pos(par1 + par5, par2 + par6, z).tex((par3 + par5) * f, (par4 + par6) * f1).endVertex();
tessellator.getBuffer().pos(par1 + par5, par2, z).tex((par3 + par5) * f, par4 * f1).endVertex();
tessellator.getBuffer().pos(par1, par2, z).tex(par3 * f, par4 * f1).endVertex();
tessellator.getBuffer().vertex(par1, par2 + par6, z).texture(par3 * f, (par4 + par6) * f1).endVertex();
tessellator.getBuffer().vertex(par1 + par5, par2 + par6, z).texture((par3 + par5) * f, (par4 + par6) * f1).endVertex();
tessellator.getBuffer().vertex(par1 + par5, par2, z).texture((par3 + par5) * f, par4 * f1).endVertex();
tessellator.getBuffer().vertex(par1, par2, z).texture(par3 * f, par4 * f1).endVertex();
tessellator.draw();
}
@@ -173,11 +173,11 @@ public final class RenderHelper {
float r = ((color & 0xFF0000) >> 16) / 255F;
float g = ((color & 0xFF00) >> 8) / 255F;
float b = (color & 0xFF) / 255F;
tessellator.getBuffer().pos(0, 0, 0).color(r, g, b, 1F - f2).endVertex();
tessellator.getBuffer().pos(-0.866D * f4, f3, -0.5F * f4).color(0, 0, 0, 0).endVertex();
tessellator.getBuffer().pos(0.866D * f4, f3, -0.5F * f4).color(0, 0, 0, 0).endVertex();
tessellator.getBuffer().pos(0, f3, 1F * f4).color(0, 0, 0, 0).endVertex();
tessellator.getBuffer().pos(-0.866D * f4, f3, -0.5F * f4).color(0, 0, 0, 0).endVertex();
tessellator.getBuffer().vertex(0, 0, 0).color(r, g, b, 1F - f2).endVertex();
tessellator.getBuffer().vertex(-0.866D * f4, f3, -0.5F * f4).color(0, 0, 0, 0).endVertex();
tessellator.getBuffer().vertex(0.866D * f4, f3, -0.5F * f4).color(0, 0, 0, 0).endVertex();
tessellator.getBuffer().vertex(0, f3, 1F * f4).color(0, 0, 0, 0).endVertex();
tessellator.getBuffer().vertex(-0.866D * f4, f3, -0.5F * f4).color(0, 0, 0, 0).endVertex();
tessellator.draw();
}
@@ -223,14 +223,14 @@ public final class RenderHelper {
BufferBuilder buf = Tessellator.getInstance().getBuffer();
buf.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR);
buf.pos(centerX, centerY, 0).color(0, 0.5F, 0.5F, a).endVertex();
buf.vertex(centerX, centerY, 0).color(0, 0.5F, 0.5F, a).endVertex();
for(int i = degs; i > 0; i--) {
double rad = (i - 90) / 180F * Math.PI;
buf.pos(centerX + Math.cos(rad) * r, centerY + Math.sin(rad) * r, 0).color(0F, 1F, 0.5F, a).endVertex();
buf.vertex(centerX + Math.cos(rad) * r, centerY + Math.sin(rad) * r, 0).color(0F, 1F, 0.5F, a).endVertex();
}
buf.pos(centerX, centerY, 0).color(0F, 1F, 0.5F, a).endVertex();
buf.vertex(centerX, centerY, 0).color(0F, 1F, 0.5F, a).endVertex();
Tessellator.getInstance().draw();
GlStateManager.disableBlend();
@@ -143,7 +143,7 @@ public final class ShaderHelper {
public static boolean useShaders() {
// usePostProcess equivalent to hasShaders
return ConfigHandler.CLIENT.useShaders.get() && GLX.usePostProcess && checkIncompatibleMods();
return ConfigHandler.CLIENT.useShaders.get() && checkIncompatibleMods();
}
private static boolean checkIncompatibleMods() {
@@ -10,10 +10,14 @@
*/
package vazkii.botania.client.core.proxy;
import com.google.common.collect.ImmutableList;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.RenderTypeLookup;
import net.minecraft.client.renderer.entity.PlayerRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.client.util.InputMappings;
import net.minecraft.entity.LivingEntity;
@@ -21,6 +25,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.particles.IParticleData;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.World;
import net.minecraftforge.client.settings.KeyConflictContext;
import net.minecraftforge.common.MinecraftForge;
@@ -43,6 +48,10 @@ import vazkii.botania.client.core.handler.PersistentVariableHelper;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.client.fx.FXLightning;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.ModFluffBlocks;
import vazkii.botania.common.block.decor.BlockFloatingFlower;
import vazkii.botania.common.block.decor.panes.BlockModPane;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.core.proxy.IProxy;
@@ -61,16 +70,18 @@ import java.util.Map;
public class ClientProxy implements IProxy {
public static final VertexFormat POSITION_TEX_LMAP_NORMAL =
new VertexFormat()
.addElement(DefaultVertexFormats.POSITION_3F)
.addElement(DefaultVertexFormats.TEX_2F)
.addElement(DefaultVertexFormats.TEX_2S)
.addElement(DefaultVertexFormats.NORMAL_3B);
new VertexFormat(ImmutableList.<VertexFormatElement>builder()
.add(DefaultVertexFormats.POSITION_3F)
.add(DefaultVertexFormats.TEX_2F)
.add(DefaultVertexFormats.TEX_2S)
.add(DefaultVertexFormats.NORMAL_3B)
.build());
public static final VertexFormat POSITION_TEX_LMAP =
new VertexFormat()
.addElement(DefaultVertexFormats.POSITION_3F)
.addElement(DefaultVertexFormats.TEX_2F)
.addElement(DefaultVertexFormats.TEX_2S);
new VertexFormat(ImmutableList.<VertexFormatElement>builder()
.add(DefaultVertexFormats.POSITION_3F)
.add(DefaultVertexFormats.TEX_2F)
.add(DefaultVertexFormats.TEX_2S)
.build());
public static boolean jingleTheBells = false;
public static boolean dootDoot = false;
@@ -110,6 +121,41 @@ public class ClientProxy implements IProxy {
CORPOREA_REQUEST = new KeyBinding("key.botania_corporea_request", KeyConflictContext.GUI, InputMappings.getInputByCode(GLFW.GLFW_KEY_C, 0), LibMisc.MOD_NAME);
ClientRegistry.registerKeyBinding(ClientProxy.CORPOREA_REQUEST);
});
registerRenderTypes();
}
private static void registerRenderTypes() {
RenderTypeLookup.setRenderLayer(ModBlocks.defaultAltar, RenderType.getCutout());
RenderTypeLookup.setRenderLayer(ModBlocks.forestAltar, RenderType.getCutout());
RenderTypeLookup.setRenderLayer(ModBlocks.plainsAltar, RenderType.getCutout());
RenderTypeLookup.setRenderLayer(ModBlocks.mountainAltar, RenderType.getCutout());
RenderTypeLookup.setRenderLayer(ModBlocks.fungalAltar, RenderType.getCutout());
RenderTypeLookup.setRenderLayer(ModBlocks.swampAltar, RenderType.getCutout());
RenderTypeLookup.setRenderLayer(ModBlocks.desertAltar, RenderType.getCutout());
RenderTypeLookup.setRenderLayer(ModBlocks.taigaAltar, RenderType.getCutout());
RenderTypeLookup.setRenderLayer(ModBlocks.mesaAltar, RenderType.getCutout());
RenderTypeLookup.setRenderLayer(ModBlocks.mossyAltar, RenderType.getCutout());
RenderTypeLookup.setRenderLayer(ModBlocks.manaGlass, RenderType.getTranslucent());
RenderTypeLookup.setRenderLayer(ModFluffBlocks.managlassPane, RenderType.getTranslucent());
RenderTypeLookup.setRenderLayer(ModBlocks.elfGlass, RenderType.getTranslucent());
RenderTypeLookup.setRenderLayer(ModFluffBlocks.alfglassPane, RenderType.getTranslucent());
RenderTypeLookup.setRenderLayer(ModBlocks.bifrost, RenderType.getTranslucent());
RenderTypeLookup.setRenderLayer(ModFluffBlocks.bifrostPane, RenderType.getTranslucent());
RenderTypeLookup.setRenderLayer(ModBlocks.bifrostPerm, RenderType.getTranslucent());
RenderTypeLookup.setRenderLayer(ModBlocks.prism, RenderType.getTranslucent());
RenderTypeLookup.setRenderLayer(ModBlocks.starfield, RenderType.getCutoutMipped());
RenderTypeLookup.setRenderLayer(ModBlocks.abstrusePlatform, t -> true);
RenderTypeLookup.setRenderLayer(ModBlocks.infrangiblePlatform, t -> true);
RenderTypeLookup.setRenderLayer(ModBlocks.spectralPlatform, t -> true);
Registry.BLOCK.stream().filter(b -> b.getRegistryName().getNamespace().equals(LibMisc.MOD_ID))
.forEach(b -> {
if (b instanceof BlockFloatingFlower)
RenderTypeLookup.setRenderLayer(b, RenderType.getCutout());
});
}
private void loadComplete(FMLLoadCompleteEvent event) {
@@ -91,9 +91,9 @@ public class FXWisp extends Particle {
// [VanillaCopy] of super, without drag when onGround is true
@Override
public void tick() {
this.prevPosX = this.getX();
this.prevPosY = this.getY();
this.prevPosZ = this.getZ();
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.age++ >= this.maxAge)
{
@@ -63,9 +63,7 @@ public class GuiFlowerBag extends ContainerScreen<ContainerFlowerBag> {
ItemStack stack = new ItemStack(ModBlocks.getFlower(color));
int x = guiLeft + slot.xPos;
int y = guiTop + slot.yPos;
RenderHelper.enableGUIStandardItemLighting();
mc.getItemRenderer().renderItemIntoGUI(stack, x, y);
RenderHelper.disableStandardItemLighting();
mc.fontRenderer.drawStringWithShadow("0", x + 11, y + 9, 0xFF6666);
}
}
@@ -108,10 +108,10 @@ public class ElvenTradeRecipeCategory implements IRecipeCategory<RecipeElvenTrad
int startY = 25;
int stopX = 70;
int stopY = 73;
wr.pos(startX, startY, 0).tex(sprite.getMinU(), sprite.getMinV()).endVertex();
wr.pos(startX, stopY, 0).tex(sprite.getMinU(), sprite.getMaxV()).endVertex();
wr.pos(stopX, stopY, 0).tex(sprite.getMaxU(), sprite.getMaxV()).endVertex();
wr.pos(stopX, startY, 0).tex(sprite.getMaxU(), sprite.getMinV()).endVertex();
wr.vertex(startX, startY, 0).texture(sprite.getMinU(), sprite.getMinV()).endVertex();
wr.vertex(startX, stopY, 0).texture(sprite.getMinU(), sprite.getMaxV()).endVertex();
wr.vertex(stopX, stopY, 0).texture(sprite.getMaxU(), sprite.getMaxV()).endVertex();
wr.vertex(stopX, startY, 0).texture(sprite.getMaxU(), sprite.getMinV()).endVertex();
tess.draw();
}
@@ -11,12 +11,13 @@ package vazkii.botania.client.model;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.RenderTypeLookup;
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.texture.TextureAtlasSprite;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.client.MinecraftForgeClient;
@@ -47,9 +48,9 @@ public class PlatformModel implements IDynamicBakedModel {
if(!(state.getBlock() instanceof BlockPlatform))
return Minecraft.getInstance().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel().getQuads(state, side, rand);
BlockRenderLayer layer = MinecraftForgeClient.getRenderLayer();
RenderType layer = MinecraftForgeClient.getRenderLayer();
if(layer == null) {
layer = BlockRenderLayer.SOLID; // workaround for when this isn't set (digging, etc.)
layer = RenderType.getSolid(); // workaround for when this isn't set (digging, etc.)
}
BlockState heldState = data.getData(BotaniaStateProps.HELD_STATE);
@@ -60,7 +61,7 @@ public class PlatformModel implements IDynamicBakedModel {
}
Minecraft mc = Minecraft.getInstance();
if(heldState == null && layer == BlockRenderLayer.SOLID) {
if(heldState == null && layer == RenderType.getSolid()) {
// No camo
return original.getQuads(state, side, rand, data);
} else if(heldState != null) {
@@ -69,7 +70,7 @@ public class PlatformModel implements IDynamicBakedModel {
if(heldState.getBlock() == ModBlocks.manaGlass)
return ImmutableList.of();
if(heldState.getBlock().canRenderInLayer(heldState, layer)) {
if(RenderTypeLookup.canRenderInLayer(heldState, layer)) {
// Steal camo's model
IBakedModel model = mc.getBlockRendererDispatcher().getBlockModelShapes().getModel(heldState);
@@ -107,7 +107,7 @@ public class RenderBabylonWeapon extends EntityRenderer<EntityBabylonWeapon> {
@Nonnull
@Override
protected ResourceLocation getEntityTexture(@Nonnull EntityBabylonWeapon entity) {
public ResourceLocation getEntityTexture(@Nonnull EntityBabylonWeapon entity) {
return AtlasTexture.LOCATION_BLOCKS_TEXTURE;
}
@@ -40,7 +40,7 @@ public class RenderManaStorm extends EntityRenderer<EntityManaStorm> {
@Nonnull
@Override
protected ResourceLocation getEntityTexture(@Nonnull EntityManaStorm entity) {
public ResourceLocation getEntityTexture(@Nonnull EntityManaStorm entity) {
return AtlasTexture.LOCATION_BLOCKS_TEXTURE;
}
@@ -28,7 +28,7 @@ public class RenderPinkWither extends WitherRenderer {
@Nonnull
@Override
protected ResourceLocation getEntityTexture(WitherEntity entity) {
public ResourceLocation getEntityTexture(WitherEntity entity) {
return resource;
}
@@ -48,7 +48,7 @@ public class RenderPixie extends MobRenderer<EntityPixie, ModelPixie> {
@Nonnull
@Override
protected ResourceLocation getEntityTexture(@Nonnull EntityPixie entity) {
public ResourceLocation getEntityTexture(@Nonnull EntityPixie entity) {
return new ResourceLocation(LibResources.MODEL_PIXIE);
}
@@ -106,7 +106,7 @@ public abstract class RenderSparkBase<T extends EntitySparkBase> extends EntityR
@Nonnull
@Override
protected ResourceLocation getEntityTexture(@Nonnull EntitySparkBase entity) {
public ResourceLocation getEntityTexture(@Nonnull EntitySparkBase entity) {
return AtlasTexture.LOCATION_BLOCKS_TEXTURE;
}
@@ -17,6 +17,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.HoeItem;
import net.minecraft.item.ItemStack;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
@@ -57,15 +58,15 @@ public class BlockAltGrass extends BlockMod {
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
ItemStack held = player.getHeldItem(hand);
if(held.getItem() instanceof HoeItem && world.isAirBlock(pos.up())) {
held.damageItem(1, player, e -> e.sendBreakAnimation(hand));
world.setBlockState(pos, Blocks.FARMLAND.getDefaultState(), 1 | 2);
return true;
return ActionResultType.SUCCESS;
}
return false;
return ActionResultType.PASS;
}
@Override
@@ -20,7 +20,7 @@ import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -83,13 +83,6 @@ public class BlockAltar extends BlockMod {
return SHAPE;
}
@OnlyIn(Dist.CLIENT)
@Nonnull
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@Override
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) {
if(!world.isRemote && entity instanceof ItemEntity) {
@@ -108,16 +101,16 @@ public class BlockAltar extends BlockMod {
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
TileAltar tile = (TileAltar) world.getTileEntity(pos);
ItemStack stack = player.getHeldItem(hand);
if(player.isSneaking()) {
InventoryHelper.withdrawFromInventory(tile, player);
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(tile);
return true;
return ActionResultType.SUCCESS;
} else if(tile.isEmpty() && tile.getFluid() == Fluids.WATER && stack.isEmpty()) {
tile.trySetLastRecipe(player);
return true;
return ActionResultType.SUCCESS;
}
else {
if(!stack.isEmpty() && (isValidWaterContainer(stack) || stack.getItem() == ModItems.waterRod && ManaItemHandler.requestManaExact(stack, player, ItemWaterRod.COST, false))) {
@@ -132,7 +125,7 @@ public class BlockAltar extends BlockMod {
world.getChunkProvider().getLightManager().checkBlock(pos);
}
return true;
return ActionResultType.SUCCESS;
} else if(!stack.isEmpty() && stack.getItem() == Items.LAVA_BUCKET) {
if(!player.abilities.isCreativeMode)
player.setHeldItem(hand, drain(Fluids.LAVA, stack));
@@ -141,7 +134,7 @@ public class BlockAltar extends BlockMod {
world.updateComparatorOutputLevel(pos, this);
world.getChunkProvider().getLightManager().checkBlock(pos);
return true;
return ActionResultType.SUCCESS;
} else if(!stack.isEmpty() && stack.getItem() == Items.BUCKET && tile.getFluid() != Fluids.EMPTY && !Botania.gardenOfGlassLoaded) {
ItemStack bucket = new ItemStack(tile.getFluid().getFilledBucket());
if(stack.getCount() == 1)
@@ -155,11 +148,11 @@ public class BlockAltar extends BlockMod {
world.updateComparatorOutputLevel(pos, this);
world.getChunkProvider().getLightManager().checkBlock(pos);
return true;
return ActionResultType.SUCCESS;
}
}
return false;
return ActionResultType.PASS;
}
@Override
@@ -17,6 +17,7 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
@@ -46,13 +47,13 @@ public class BlockAnimatedTorch extends BlockMod implements IWandable, IManaTrig
}
@Override
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, BlockRayTraceResult hit) {
public ActionResultType onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, BlockRayTraceResult hit) {
if(hand == Hand.MAIN_HAND && playerIn.isSneaking() && playerIn.getHeldItem(hand).isEmpty()) {
((TileAnimatedTorch) worldIn.getTileEntity(pos)).handRotate();
return true;
return ActionResultType.SUCCESS;
}
return false;
return ActionResultType.PASS;
}
@Override
@@ -118,11 +119,6 @@ public class BlockAnimatedTorch extends BlockMod implements IWandable, IManaTrig
return SHAPE;
}
@Override
public boolean isSolid(BlockState state) {
return false;
}
@Override
public TileEntity createTileEntity(@Nonnull BlockState state, @Nonnull IBlockReader world) {
return new TileAnimatedTorch();
@@ -18,6 +18,7 @@ import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Mirror;
@@ -62,20 +63,20 @@ public class BlockAvatar extends BlockMod {
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
TileAvatar avatar = (TileAvatar) world.getTileEntity(pos);
ItemStack stackOnAvatar = avatar.getItemHandler().getStackInSlot(0);
ItemStack stackOnPlayer = player.getHeldItem(hand);
if(!stackOnAvatar.isEmpty()) {
avatar.getItemHandler().setStackInSlot(0, ItemStack.EMPTY);
ItemHandlerHelper.giveItemToPlayer(player, stackOnAvatar);
return true;
return ActionResultType.SUCCESS;
} else if(!stackOnPlayer.isEmpty() && stackOnPlayer.getItem() instanceof IAvatarWieldable) {
avatar.getItemHandler().setStackInSlot(0, stackOnPlayer.split(1));
return true;
return ActionResultType.SUCCESS;
}
return false;
return ActionResultType.PASS;
}
@Override
@@ -12,14 +12,12 @@ package vazkii.botania.common.block;
import net.minecraft.block.AbstractGlassBlock;
import net.minecraft.block.BlockState;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import vazkii.botania.client.fx.SparkleParticleData;
import javax.annotation.Nonnull;
import java.util.Random;
public class BlockBifrostPerm extends AbstractGlassBlock {
@@ -35,10 +33,4 @@ public class BlockBifrostPerm extends AbstractGlassBlock {
world.addParticle(data, pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), 0, 0, 0);
}
}
@Nonnull
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.TRANSLUCENT;
}
}
@@ -20,6 +20,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -65,12 +66,12 @@ public class BlockCocoon extends BlockMod {
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
ItemStack stack = player.getHeldItem(hand);
return addStack(world, pos, stack, player.abilities.isCreativeMode);
}
private boolean addStack(World world, BlockPos pos, ItemStack stack, boolean creative) {
private ActionResultType addStack(World world, BlockPos pos, ItemStack stack, boolean creative) {
TileCocoon cocoon = (TileCocoon) world.getTileEntity(pos);
Item item = stack.getItem();
@@ -89,10 +90,10 @@ public class BlockCocoon extends BlockMod {
}
}
return true;
return ActionResultType.SUCCESS;
}
return false;
return ActionResultType.PASS;
}
@Override
@@ -66,10 +66,8 @@ public class BlockCraftyCrate extends BlockOpenCrate implements IWandHUD {
AbstractGui.fill(xp, yp, xp + 16, yp + 16, enabled ? 0x22FFFFFF : 0x22FF0000);
ItemStack item = craft.getItemHandler().getStackInSlot(index);
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
GlStateManager.enableRescaleNormal();
mc.getItemRenderer().renderItemAndEffectIntoGUI(item, xp, yp);
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
}
}
}
@@ -20,6 +20,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import vazkii.botania.common.block.tile.TileFakeAir;
import javax.annotation.Nonnull;
@@ -27,8 +28,6 @@ import java.util.Random;
public class BlockFakeAir extends AirBlock {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
public BlockFakeAir(Properties builder) {
super(builder);
}
@@ -44,7 +43,7 @@ public class BlockFakeAir extends AirBlock {
}
@Override
public void tick(BlockState state, World world, BlockPos pos, Random rand) {
public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random rand) {
if(shouldRemove(world, pos))
world.setBlockState(pos, rand.nextInt(10) == 0 ? Blocks.WATER.getDefaultState() : Blocks.AIR.getDefaultState());
}
@@ -17,6 +17,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.DyeColor;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
@@ -111,9 +112,11 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
return super.onBlockActivated(state, world, pos, player, hand, hit)
|| ((TileEntitySpecialFlower) world.getTileEntity(pos)).onBlockActivated(world, pos, state, player, hand, hit) || super.onBlockActivated(state, world, pos, player, hand, hit);
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
ActionResultType tileResult = ((TileEntitySpecialFlower) world.getTileEntity(pos)).onBlockActivated(world, pos, state, player, hand, hit);
if (tileResult.isAccepted())
return tileResult;
else return super.onUse(state, world, pos, player, hand, hit);
}
@Override
@@ -18,6 +18,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
@@ -28,6 +29,7 @@ import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.items.ItemHandlerHelper;
@@ -66,32 +68,32 @@ public class BlockHourglass extends BlockMod implements IManaTrigger, IWandable,
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
TileHourglass hourglass = (TileHourglass) world.getTileEntity(pos);
ItemStack hgStack = hourglass.getItemHandler().getStackInSlot(0);
ItemStack stack = player.getHeldItem(hand);
if(!stack.isEmpty() && stack.getItem() == ModItems.twigWand)
return false;
return ActionResultType.PASS;
if(hourglass.lock) {
if(!player.world.isRemote)
player.sendMessage(new TranslationTextComponent("botaniamisc.hourglassLock"));
return true;
return ActionResultType.FAIL;
}
if(hgStack.isEmpty() && TileHourglass.getStackItemTime(stack) > 0) {
hourglass.getItemHandler().setStackInSlot(0, stack.copy());
hourglass.markDirty();
stack.setCount(0);
return true;
return ActionResultType.SUCCESS;
} else if(!hgStack.isEmpty()) {
ItemHandlerHelper.giveItemToPlayer(player, hgStack);
hourglass.getItemHandler().setStackInSlot(0, ItemStack.EMPTY);
hourglass.markDirty();
return true;
return ActionResultType.SUCCESS;
}
return false;
return ActionResultType.PASS;
}
@Override
@@ -110,7 +112,7 @@ public class BlockHourglass extends BlockMod implements IManaTrigger, IWandable,
}
@Override
public void tick(BlockState state, World world, BlockPos pos, Random rand) {
public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random rand) {
if(state.get(BotaniaStateProps.POWERED))
world.setBlockState(pos, state.with(BotaniaStateProps.POWERED, false), 1 | 2);
}
@@ -18,6 +18,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
@@ -49,14 +50,14 @@ public class BlockIncensePlate extends BlockMod {
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
TileIncensePlate plate = (TileIncensePlate) world.getTileEntity(pos);
ItemStack plateStack = plate.getItemHandler().getStackInSlot(0);
ItemStack stack = player.getHeldItem(hand);
boolean did = false;
if(world.isRemote)
return true;
return ActionResultType.SUCCESS;
if(plateStack.isEmpty() && plate.acceptsItem(stack)) {
plate.getItemHandler().setStackInSlot(0, stack.copy());
@@ -78,7 +79,7 @@ public class BlockIncensePlate extends BlockMod {
if(did)
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(plate);
return did;
return did ? ActionResultType.SUCCESS : ActionResultType.PASS;
}
@Override
@@ -17,6 +17,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
@@ -26,6 +27,7 @@ import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.api.state.enums.LuminizerVariant;
import vazkii.botania.api.wand.IWandable;
@@ -57,9 +59,9 @@ public class BlockLightRelay extends BlockMod implements IWandable {
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
((TileLightRelay) world.getTileEntity(pos)).mountEntity(player);
return true;
return ActionResultType.SUCCESS;
}
@Override
@@ -78,7 +80,7 @@ public class BlockLightRelay extends BlockMod implements IWandable {
}
@Override
public void tick(BlockState state, World world, BlockPos pos, Random rand) {
public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random rand) {
world.setBlockState(pos, state.with(BotaniaStateProps.POWERED, false), 1 | 2);
}
@@ -22,6 +22,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import vazkii.botania.client.fx.SparkleParticleData;
@@ -88,7 +89,7 @@ public class BlockModFlower extends FlowerBlock implements IGrowable {
}
@Override
public void grow(@Nonnull World world, @Nonnull Random rand, @Nonnull BlockPos pos, @Nonnull BlockState state) {
public void grow(@Nonnull ServerWorld world, @Nonnull Random rand, @Nonnull BlockPos pos, @Nonnull BlockState state) {
Block block = ModBlocks.getDoubleFlower(color);
if(block instanceof DoublePlantBlock) {
((DoublePlantBlock) block).placeAt(world, pos, 3);
@@ -67,11 +67,6 @@ public class BlockPlatform extends BlockMod implements IWandable, IManaCollision
}
}
@Override
public boolean canRenderInLayer(BlockState state, @Nonnull BlockRenderLayer layer) {
return true;
}
@Override
public boolean canEntityDestroy(BlockState state, IBlockReader world, BlockPos pos, Entity entity) {
return variant != Variant.INFRANGIBLE;
@@ -20,6 +20,7 @@ import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import javax.annotation.Nonnull;
import java.util.Random;
@@ -31,7 +32,7 @@ public class BlockSolidVines extends VineBlock {
}
@Override
public void tick(@Nonnull BlockState state, World world, @Nonnull BlockPos pos, @Nonnull Random rand) {}
public void scheduledTick(@Nonnull BlockState state, ServerWorld world, @Nonnull BlockPos pos, @Nonnull Random rand) {}
@Override
public boolean isShearable(ItemStack item, IWorldReader world, BlockPos pos) {
@@ -16,6 +16,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -65,7 +66,7 @@ public class BlockSparkChanger extends BlockMod {
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
TileSparkChanger changer = (TileSparkChanger) world.getTileEntity(pos);
ItemStack pstack = player.getHeldItem(hand);
ItemStack cstack = changer.getItemHandler().getStackInSlot(0);
@@ -74,16 +75,16 @@ public class BlockSparkChanger extends BlockMod {
world.updateComparatorOutputLevel(pos, this);
changer.markDirty();
ItemHandlerHelper.giveItemToPlayer(player, cstack);
return true;
return ActionResultType.SUCCESS;
} else if(!pstack.isEmpty() && pstack.getItem() instanceof ItemSparkUpgrade) {
changer.getItemHandler().setStackInSlot(0, pstack.split(1));
world.updateComparatorOutputLevel(pos, this);
changer.markDirty();
return true;
return ActionResultType.SUCCESS;
}
return false;
return ActionResultType.PASS;
}
@Override
@@ -18,6 +18,7 @@ import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -55,14 +56,14 @@ public class BlockTeruTeruBozu extends BlockMod {
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
ItemStack stack = player.getHeldItem(hand);
if(!stack.isEmpty() && (isSunflower(stack) && removeRain(world) || isBlueOrchid(stack) && startRain(world))) {
if(!player.abilities.isCreativeMode)
stack.shrink(1);
return true;
return ActionResultType.SUCCESS;
}
return false;
return ActionResultType.PASS;
}
private boolean isSunflower(ItemStack stack) {
@@ -13,6 +13,7 @@ package vazkii.botania.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.block.DispenserBlock;
import net.minecraft.block.GlassBlock;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.item.DyeColor;
@@ -40,7 +41,6 @@ import vazkii.botania.common.block.decor.BlockBuriedPetals;
import vazkii.botania.common.block.decor.BlockElfGlass;
import vazkii.botania.common.block.decor.BlockFloatingFlower;
import vazkii.botania.common.block.decor.BlockManaFlame;
import vazkii.botania.common.block.decor.BlockManaGlass;
import vazkii.botania.common.block.decor.BlockModMushroom;
import vazkii.botania.common.block.decor.BlockPetalBlock;
import vazkii.botania.common.block.decor.BlockShinyFlower;
@@ -502,7 +502,7 @@ public final class ModBlocks {
register(r, new BlockRFGenerator(Block.Properties.create(Material.ROCK).hardnessAndResistance(2, 10).sound(SoundType.STONE)), LibBlockNames.FLUXFIELD);
register(r, new BlockElfGlass(Block.Properties.create(Material.GLASS).hardnessAndResistance(0.3F).sound(SoundType.GLASS).lightValue(15)), LibBlockNames.ELF_GLASS);
register(r, new BlockBrewery(Block.Properties.create(Material.ROCK).hardnessAndResistance(2, 10).sound(SoundType.STONE)), LibBlockNames.BREWERY);
register(r, new BlockManaGlass(Block.Properties.create(Material.GLASS).hardnessAndResistance(0.3F).sound(SoundType.GLASS).lightValue(15)), LibBlockNames.MANA_GLASS);
register(r, new GlassBlock(Block.Properties.create(Material.GLASS).hardnessAndResistance(0.3F).sound(SoundType.GLASS).lightValue(15)), LibBlockNames.MANA_GLASS);
register(r, new BlockTerraPlate(Block.Properties.create(Material.IRON).hardnessAndResistance(3, 10).sound(SoundType.METAL)), LibBlockNames.TERRA_PLATE);
builder = Block.Properties.create(Material.ROCK).hardnessAndResistance(2, 10).sound(SoundType.STONE);
@@ -573,7 +573,7 @@ public final class ModBlocks {
register(r, new BlockAltGrass(v, builder), v.name().toLowerCase(Locale.ROOT) + LibBlockNames.ALT_GRASS_SUFFIX);
}
register(r, new BlockAnimatedTorch(Block.Properties.create(Material.MISCELLANEOUS).lightValue(7)), LibBlockNames.ANIMATED_TORCH);
register(r, new BlockAnimatedTorch(Block.Properties.create(Material.MISCELLANEOUS).lightValue(7).nonOpaque()), LibBlockNames.ANIMATED_TORCH);
}
@SubscribeEvent
@@ -14,6 +14,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
@@ -54,20 +55,20 @@ public class BlockCorporeaCrystalCube extends BlockCorporeaBase implements IWand
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
ItemStack stack = player.getHeldItem(hand);
if(!stack.isEmpty()) {
if(stack.getItem() == ModItems.twigWand && player.isSneaking())
return false;
return ActionResultType.PASS;
TileCorporeaCrystalCube cube = (TileCorporeaCrystalCube) world.getTileEntity(pos);
if(cube.locked) {
if(!world.isRemote)
player.sendStatusMessage(new TranslationTextComponent("botaniamisc.crystalCubeLocked"), false);
} else
cube.setRequestTarget(stack);
return true;
return ActionResultType.SUCCESS;
}
return false;
return ActionResultType.PASS;
}
@Override
@@ -10,10 +10,11 @@
*/
package vazkii.botania.common.block.decor;
import net.minecraft.block.AbstractGlassBlock;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.recipe.IElvenItem;
public class BlockElfGlass extends BlockManaGlass implements IElvenItem {
public class BlockElfGlass extends AbstractGlassBlock implements IElvenItem {
public BlockElfGlass(Properties builder) {
super(builder);
@@ -17,7 +17,7 @@ import net.minecraft.item.DyeColor;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -62,13 +62,6 @@ public class BlockFloatingFlower extends BlockMod {
return ConfigHandler.CLIENT.staticFloaters.get() ? BlockRenderType.MODEL : BlockRenderType.ENTITYBLOCK_ANIMATED;
}
@Nonnull
@OnlyIn(Dist.CLIENT)
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@OnlyIn(Dist.CLIENT)
@Override
public void animateTick(BlockState state, World world, BlockPos pos, Random rand) {
@@ -84,7 +77,7 @@ public class BlockFloatingFlower extends BlockMod {
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
ItemStack stack = player.getHeldItem(hand);
TileEntity te = world.getTileEntity(pos);
if(!stack.isEmpty() && te != null && te.getCapability(BotaniaAPI.FLOATING_FLOWER_CAP).isPresent()) {
@@ -106,10 +99,10 @@ public class BlockFloatingFlower extends BlockMod {
if(!player.abilities.isCreativeMode)
stack.shrink(1);
return true;
return ActionResultType.SUCCESS;
}
}
return false;
return ActionResultType.PASS;
}
@Override
@@ -1,30 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Nov 1, 2014, 6:09:29 PM (GMT)]
*/
package vazkii.botania.common.block.decor;
import net.minecraft.block.AbstractGlassBlock;
import net.minecraft.util.BlockRenderLayer;
import javax.annotation.Nonnull;
public class BlockManaGlass extends AbstractGlassBlock {
public BlockManaGlass(Properties builder) {
super(builder);
}
@Nonnull
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.TRANSLUCENT;
}
}
@@ -23,6 +23,7 @@ import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import vazkii.botania.api.item.IHornHarvestable;
@@ -50,7 +51,7 @@ public class BlockModMushroom extends MushroomBlock implements IHornHarvestable,
}
@Override
public void tick(@Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, Random rand) {} // Prevent spreading
public void scheduledTick(@Nonnull BlockState state, @Nonnull ServerWorld world, @Nonnull BlockPos pos, Random rand) {} // Prevent spreading
// [VanillaCopy] super, without light level requirement
@Override
@@ -12,7 +12,6 @@ package vazkii.botania.common.block.decor;
import net.minecraft.block.BlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
@@ -38,13 +37,6 @@ public class BlockStarfield extends BlockMod {
return SHAPE;
}
@OnlyIn(Dist.CLIENT)
@Nonnull
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT_MIPPED;
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
@@ -20,6 +20,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.AxisAlignedBB;
@@ -69,7 +70,7 @@ public class BlockTinyPotato extends BlockMod {
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof TileTinyPotato) {
((TileTinyPotato) tile).interact(player, hand, player.getHeldItem(hand), hit.getFace());
@@ -78,7 +79,7 @@ public class BlockTinyPotato extends BlockMod {
((ServerWorld) world).spawnParticle(ParticleTypes.HEART, pos.getX() + box.minX + Math.random() * (box.maxX - box.minX), pos.getY() + box.maxY, pos.getZ() + box.minZ + Math.random() * (box.maxZ - box.minZ), 1, 0 ,0, 0, 0);
}
}
return true;
return ActionResultType.SUCCESS;
}
@Override
@@ -13,7 +13,6 @@ package vazkii.botania.common.block.decor.panes;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.PaneBlock;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
@@ -35,11 +34,4 @@ public class BlockModPane extends PaneBlock {
return block == ModBlocks.elfGlass || block == ModBlocks.manaGlass || block == ModBlocks.bifrostPerm
|| super.canBeConnectedTo(state, world, pos, facing);
}
@OnlyIn(Dist.CLIENT)
@Nonnull
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.TRANSLUCENT;
}
}
@@ -17,6 +17,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
@@ -58,10 +59,10 @@ public class BlockBellows extends BlockMod {
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
if(EntityDoppleganger.isTruePlayer(player))
((TileBellows) world.getTileEntity(pos)).interact();
return true;
return ActionResultType.SUCCESS;
}
@Nonnull
@@ -18,6 +18,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -57,20 +58,20 @@ public class BlockBrewery extends BlockMod implements IWandHUD {
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
TileBrewery brew = (TileBrewery) world.getTileEntity(pos);
if(player.isSneaking()) {
if(brew.recipe == null && !state.get(BotaniaStateProps.POWERED)) {
InventoryHelper.withdrawFromInventory(brew, player);
return true;
return ActionResultType.SUCCESS;
}
} else {
ItemStack stack = player.getHeldItem(hand);
if(!stack.isEmpty())
return brew.addItem(player, stack, hand);
return brew.addItem(player, stack, hand) ? ActionResultType.SUCCESS : ActionResultType.PASS;
}
return false;
return ActionResultType.PASS;
}
@Override
@@ -19,6 +19,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
@@ -61,11 +62,11 @@ public class BlockEnchanter extends BlockMod implements IWandable, IWandHUD {
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
TileEnchanter enchanter = (TileEnchanter) world.getTileEntity(pos);
ItemStack stack = player.getHeldItem(hand);
if(!stack.isEmpty() && stack.getItem() == ModItems.twigWand)
return false;
return ActionResultType.PASS;
boolean stackEnchantable = !stack.isEmpty()
&& stack.getItem() != Items.BOOK
@@ -78,7 +79,7 @@ public class BlockEnchanter extends BlockMod implements IWandable, IWandHUD {
player.setHeldItem(hand, ItemStack.EMPTY);
enchanter.sync();
} else {
return false;
return ActionResultType.PASS;
}
} else if(enchanter.stage == TileEnchanter.State.IDLE) {
ItemHandlerHelper.giveItemToPlayer(player, enchanter.itemToEnchant.copy());
@@ -86,7 +87,7 @@ public class BlockEnchanter extends BlockMod implements IWandable, IWandHUD {
enchanter.sync();
}
return true;
return ActionResultType.SUCCESS;
}
@Override
@@ -16,7 +16,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -60,18 +60,11 @@ public class BlockPrism extends BlockMod implements IManaTrigger, IManaCollision
builder.add(BotaniaStateProps.POWERED, BotaniaStateProps.HAS_LENS);
}
@Nonnull
@Override
@OnlyIn(Dist.CLIENT)
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.TRANSLUCENT;
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
TileEntity tile = world.getTileEntity(pos);
if(!(tile instanceof TilePrism))
return false;
return ActionResultType.PASS;
TilePrism prism = (TilePrism) tile;
ItemStack lens = prism.getItemHandler().getStackInSlot(0);
@@ -88,7 +81,7 @@ public class BlockPrism extends BlockMod implements IManaTrigger, IManaCollision
prism.getItemHandler().setStackInSlot(0, ItemStack.EMPTY);
}
return true;
return ActionResultType.SUCCESS;
}
@Override
@@ -15,6 +15,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
@@ -51,9 +52,9 @@ public class BlockRuneAltar extends BlockMod implements IWandable {
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
if(world.isRemote)
return true;
return ActionResultType.SUCCESS;
TileRuneAltar altar = (TileRuneAltar) world.getTileEntity(pos);
ItemStack stack = player.getHeldItem(hand);
@@ -62,19 +63,19 @@ public class BlockRuneAltar extends BlockMod implements IWandable {
if(altar.manaToGet == 0) {
InventoryHelper.withdrawFromInventory(altar, player);
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(altar);
return true;
return ActionResultType.SUCCESS;
}
} else if(altar.isEmpty() && stack.isEmpty()) {
altar.trySetLastRecipe(player);
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(altar);
return true;
return ActionResultType.SUCCESS;
} else if(!stack.isEmpty()) {
boolean result = altar.addItem(player, stack, hand);
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(altar);
return result;
return result ? ActionResultType.SUCCESS : ActionResultType.PASS;
}
return false;
return ActionResultType.PASS;
}
@Override
@@ -21,6 +21,7 @@ import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.AxisAlignedBB;
@@ -106,10 +107,10 @@ public class BlockSpreader extends BlockMod implements IWandable, IWandHUD, IWir
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
TileEntity tile = world.getTileEntity(pos);
if(!(tile instanceof TileSpreader))
return false;
return ActionResultType.PASS;
TileSpreader spreader = (TileSpreader) tile;
ItemStack lens = spreader.getItemHandler().getStackInSlot(0);
@@ -119,7 +120,7 @@ public class BlockSpreader extends BlockMod implements IWandable, IWandHUD, IWir
if(!heldItem.isEmpty())
if(heldItem.getItem() == ModItems.twigWand)
return false;
return ActionResultType.PASS;
if(lens.isEmpty() && isHeldItemLens) {
if (!player.abilities.isCreativeMode)
@@ -146,7 +147,7 @@ public class BlockSpreader extends BlockMod implements IWandable, IWandHUD, IWir
spreader.markDirty();
}
return true;
return ActionResultType.SUCCESS;
}
@Override
@@ -16,6 +16,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.pathfinding.PathType;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -45,7 +46,7 @@ public class BlockTerraPlate extends BlockMod {
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
ItemStack stack = player.getHeldItem(hand);
if(!stack.isEmpty()
&& (stack.getItem() == ModItems.manaSteel || stack.getItem() == ModItems.manaPearl || stack.getItem() == ModItems.manaDiamond)) {
@@ -57,10 +58,10 @@ public class BlockTerraPlate extends BlockMod {
world.addEntity(item);
}
return true;
return ActionResultType.SUCCESS;
}
return false;
return ActionResultType.PASS;
}
@Override
@@ -17,6 +17,7 @@ import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.block.tile.string.TileRedString;
import vazkii.botania.common.block.tile.string.TileRedStringFertilizer;
@@ -42,7 +43,7 @@ public class BlockRedStringFertilizer extends BlockRedString implements IGrowabl
}
@Override
public void grow(@Nonnull World world, @Nonnull Random rand, @Nonnull BlockPos pos, @Nonnull BlockState state) {
public void grow(@Nonnull ServerWorld world, @Nonnull Random rand, @Nonnull BlockPos pos, @Nonnull BlockState state) {
((TileRedStringFertilizer) world.getTileEntity(pos)).grow(world, rand);
}
@@ -18,6 +18,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
@@ -45,7 +46,7 @@ public class BlockRedStringInterceptor extends BlockRedString {
@SubscribeEvent
public static void onInteract(PlayerInteractEvent.RightClickBlock event) {
TileRedStringInterceptor.onInteract(event.getEntityPlayer(), event.getWorld(), event.getPos(), event.getHand());
TileRedStringInterceptor.onInteract(event.getPlayer(), event.getWorld(), event.getPos(), event.getHand());
}
@Override
@@ -59,7 +60,7 @@ public class BlockRedStringInterceptor extends BlockRedString {
}
@Override
public void tick(BlockState state, World world, BlockPos pos, Random update) {
public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random update) {
world.setBlockState(pos, state.with(BotaniaStateProps.POWERED, false), 1 | 2);
}
@@ -175,7 +175,7 @@ public class SubTileDaffomill extends TileEntityFunctionalFlower {
if(evt.getTarget() instanceof ItemEntity) {
int entityId = evt.getTarget().getEntityId();
int age = ((ItemEntity) evt.getTarget()).age;
PacketHandler.sendTo((ServerPlayerEntity) evt.getEntityPlayer(), new PacketItemAge(entityId, age));
PacketHandler.sendTo((ServerPlayerEntity) evt.getPlayer(), new PacketItemAge(entityId, age));
}
}
}
@@ -159,9 +159,7 @@ public class SubTileRannuncarpus extends TileEntityFunctionalFlower {
int y = mc.getWindow().getScaledHeight() / 2 + 30;
mc.fontRenderer.drawStringWithShadow(stackName.getFormattedText(), x + 20, y + 5, color);
RenderHelper.enableGUIStandardItemLighting();
mc.getItemRenderer().renderItemAndEffectIntoGUI(recieverStack, x, y);
RenderHelper.disableStandardItemLighting();
}
GlStateManager.disableLighting();
@@ -145,9 +145,7 @@ public class SubTileSpectrolus extends TileEntityGeneratingFlower {
int y = mc.getWindow().getScaledHeight() / 2 + 30;
mc.fontRenderer.drawStringWithShadow(stackName.getFormattedText(), x + 20, y + 5, color);
RenderHelper.enableGUIStandardItemLighting();
mc.getItemRenderer().renderItemAndEffectIntoGUI(stack, x, y);
RenderHelper.disableStandardItemLighting();
}
GlStateManager.disableLighting();
@@ -382,14 +382,11 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary,
ItemStack stack = recipe.getOutput();
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
mc.getItemRenderer().renderItemIntoGUI(stack, xc + radius + 32, yc - 8);
mc.getItemRenderer().renderItemIntoGUI(new ItemStack(Items.WHEAT_SEEDS), xc + radius + 16, yc + 6);
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
mc.fontRenderer.drawStringWithShadow("+", xc + radius + 14, yc + 10, 0xFFFFFF);
}
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
for(int i = 0; i < amt; i++) {
double xPos = xc + Math.cos(angle * Math.PI / 180D) * radius - 8;
double yPos = yc + Math.sin(angle * Math.PI / 180D) * radius - 8;
@@ -399,7 +396,6 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary,
angle += anglePer;
}
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
} else if(recipeKeepTicks > 0 && getFluid() == Fluids.WATER) {
String s = I18n.format("botaniamisc.altarRefill0");
mc.fontRenderer.drawStringWithShadow(s, xc - mc.fontRenderer.getStringWidth(s) / 2, yc + 10, 0xFFFFFF);
@@ -304,7 +304,7 @@ public class TileLightRelay extends TileMod implements ITickableTileEntity, IWan
for(Entity e : getPassengers()) {
e.stopRiding();
e.setPositionAndUpdate(posX, posY, posZ);
e.setPositionAndUpdate(getX(), getY(), getZ());
}
remove();
} else {
@@ -321,13 +321,11 @@ public class TileLightRelay extends TileMod implements ITickableTileEntity, IWan
double sin = Math.sin(rad);
double s = 0.4;
SparkleParticleData data = SparkleParticleData.sparkle(1.2F, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, 10);
world.addParticle(data, posX + cos * s, posY - 0.5, posZ + sin * s, 0, 0, 0);
}
SparkleParticleData data = SparkleParticleData.sparkle(1.2F, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, 10);
world.addParticle(data, getX() + cos * s, getY() - 0.5, getZ() + sin * s, 0, 0, 0);
}
posX += motVec.x;
posY += motVec.y;
posZ += motVec.z;
setPosition(getX() + motVec.x, getY() + motVec.y, getZ() + motVec.z);
}
}
@@ -63,7 +63,7 @@ public class TileOpenCrate extends TileSimpleInventory implements ITickableTileE
}
public boolean canEject() {
return world.isCollisionBoxesEmpty(null, new AxisAlignedBB(pos.down()));
return world.doesNotCollide(new AxisAlignedBB(pos.down()));
}
public void eject(ItemStack stack, boolean redstone) {
@@ -377,7 +377,6 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver,
GlStateManager.color4f(1F, 1F, 1F, 1F);
RenderHelper.drawTexturedModalRect(xc + radius + 9, yc - 8, 0, progress == 1F ? 0 : 22, 8, 22, 15);
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
if(progress == 1F) {
mc.getItemRenderer().renderItemIntoGUI(new ItemStack(ModBlocks.livingrock), xc + radius + 16, yc + 8);
GlStateManager.translatef(0F, 0F, 100F);
@@ -386,13 +385,11 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver,
}
RenderHelper.renderProgressPie(xc + radius + 32, yc - 8, progress, recipe.getOutput());
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
if(progress == 1F)
mc.fontRenderer.drawStringWithShadow("+", xc + radius + 14, yc + 12, 0xFFFFFF);
}
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
for(int i = 0; i < amt; i++) {
double xPos = xc + Math.cos(angle * Math.PI / 180D) * radius - 8;
double yPos = yc + Math.sin(angle * Math.PI / 180D) * radius - 8;
@@ -402,7 +399,6 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver,
angle += anglePer;
}
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
} else if(recipeKeepTicks > 0) {
String s = I18n.format("botaniamisc.altarRefill0");
mc.fontRenderer.drawStringWithShadow(s, xc - mc.fontRenderer.getStringWidth(s) / 2, yc + 10, 0xFFFFFF);
@@ -414,10 +414,8 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
ItemStack tablet = new ItemStack(ModItems.manaTablet);
ItemManaTablet.setStackCreative(tablet);
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
mc.getItemRenderer().renderItemAndEffectIntoGUI(tablet, x - 20, y);
mc.getItemRenderer().renderItemAndEffectIntoGUI(pool, x + 26, y);
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
GlStateManager.disableLighting();
GlStateManager.disableBlend();
@@ -563,9 +563,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
int y = mc.getWindow().getScaledHeight() / 2 + 50;
mc.fontRenderer.drawStringWithShadow(lensName, x + 20, y + 5, color);
RenderHelper.enableGUIStandardItemLighting();
mc.getItemRenderer().renderItemAndEffectIntoGUI(lens, x, y);
RenderHelper.disableStandardItemLighting();
GlStateManager.disableLighting();
GlStateManager.disableBlend();
}
@@ -582,9 +580,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
int y = mc.getWindow().getScaledHeight() / 2 + 30;
mc.fontRenderer.drawStringWithShadow(stackName, x + 20, y + 5, color);
RenderHelper.enableGUIStandardItemLighting();
mc.getItemRenderer().renderItemAndEffectIntoGUI(recieverStack, x, y);
RenderHelper.disableStandardItemLighting();
}
GlStateManager.disableLighting();
@@ -16,6 +16,7 @@ import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibMisc;
@@ -43,7 +44,7 @@ public class TileRedStringFertilizer extends TileRedString {
return block instanceof IGrowable && ((IGrowable) block).canUseBonemeal(world, rand, binding, world.getBlockState(binding));
}
public void grow(World world, Random rand) {
public void grow(ServerWorld world, Random rand) {
BlockPos binding = getBinding();
Block block = getBlockAtBinding();
if(block instanceof IGrowable)
@@ -124,7 +124,7 @@ public final class PlayerHelper {
*/
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());
BlockRayTraceResult hit = new BlockRayTraceResult(ctx.getHitVec(), ctx.getFace(), ctx.getPos(), ctx.isInside());
ItemUseContext newCtx;
if(ctx.getPlayer() != null) {
@@ -120,7 +120,7 @@ public class EntityBabylonWeapon extends EntityThrowableCopy {
setChargeTicks(chargeTime + 1);
if(world.rand.nextInt(20) == 0)
world.playSound(null, posX, posY, posZ, ModSounds.babylonSpawn, SoundCategory.PLAYERS, 0.1F, 1F + world.rand.nextFloat() * 3F);
world.playSound(null, getX(), getY(), getZ(), ModSounds.babylonSpawn, SoundCategory.PLAYERS, 0.1F, 1F + world.rand.nextFloat() * 3F);
} else {
if(liveTime < delay) {
setMotion(Vec3d.ZERO);
@@ -138,12 +138,12 @@ public class EntityBabylonWeapon extends EntityThrowableCopy {
Vector3 motionVec = playerLook.subtract(thisVec).normalize().multiply(2);
mot = motionVec.toVec3D();
world.playSound(null, posX, posY, posZ, ModSounds.babylonAttack, SoundCategory.PLAYERS, 2F, 0.1F + world.rand.nextFloat() * 3F);
world.playSound(null, getX(), getY(), getZ(), ModSounds.babylonAttack, SoundCategory.PLAYERS, 2F, 0.1F + world.rand.nextFloat() * 3F);
}
setLiveTicks(liveTime + 1);
if(!world.isRemote) {
AxisAlignedBB axis = new AxisAlignedBB(posX, posY, posZ, lastTickPosX, lastTickPosY, lastTickPosZ).grow(2);
AxisAlignedBB axis = new AxisAlignedBB(getX(), getY(), getZ(), lastTickPosX, lastTickPosY, lastTickPosZ).grow(2);
List<LivingEntity> entities = world.getEntitiesWithinAABB(LivingEntity.class, axis);
for(LivingEntity living : entities) {
if(living == thrower)
@@ -166,7 +166,7 @@ public class EntityBabylonWeapon extends EntityThrowableCopy {
if(liveTime > delay) {
WispParticleData data = WispParticleData.wisp(0.3F, 1F, 1F, 0F, 1);
world.addParticle(data, posX, posY, posZ, 0, -0F, 0);
world.addParticle(data, getX(), getY(), getZ(), 0, -0F, 0);
}
if(liveTime > 200 + delay)
@@ -177,7 +177,7 @@ public class EntityBabylonWeapon extends EntityThrowableCopy {
protected void onImpact(RayTraceResult pos) {
LivingEntity thrower = getThrower();
if(pos.getType() != RayTraceResult.Type.ENTITY || ((EntityRayTraceResult) pos).getEntity() != thrower) {
world.createExplosion(this, posX, posY, posZ, 3F, Explosion.Mode.NONE);
world.createExplosion(this, getX(), getY(), getZ(), 3F, Explosion.Mode.NONE);
remove();
}
}
@@ -142,8 +142,9 @@ public class EntityCorporeaSpark extends EntitySparkBase implements ICorporeaSpa
this.connections = connections;
}
@SuppressWarnings("unchecked")
private List<ICorporeaSpark> getNearbySparks() {
return (List) world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(posX - SCAN_RANGE, posY - SCAN_RANGE, posZ - SCAN_RANGE, posX + SCAN_RANGE, posY + SCAN_RANGE, posZ + SCAN_RANGE), Predicates.instanceOf(ICorporeaSpark.class));
return (List) world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(getX() - SCAN_RANGE, getY() - SCAN_RANGE, getZ() - SCAN_RANGE, getX() + SCAN_RANGE, getY() + SCAN_RANGE, getZ() + SCAN_RANGE), Predicates.instanceOf(ICorporeaSpark.class));
}
private void restartNetwork() {
@@ -189,9 +190,9 @@ public class EntityCorporeaSpark extends EntitySparkBase implements ICorporeaSpa
@Override
public InvWithLocation getSparkInventory() {
int x = MathHelper.floor(posX);
int y = MathHelper.floor(posY - 1);
int z = MathHelper.floor(posZ);
int x = MathHelper.floor(getX());
int y = MathHelper.floor(getY() - 1);
int z = MathHelper.floor(getZ());
return InventoryHelper.getInventoryWithLocation(world, new BlockPos(x, y, z), Direction.UP);
}
@@ -62,12 +62,12 @@ public class EntityFallingStar extends EntityThrowableCopy {
float xs = (float) (Math.random() - 0.5) * dist;
float ys = (float) (Math.random() - 0.5) * dist;
float zs = (float) (Math.random() - 0.5) * dist;
world.addParticle(data, posX + xs, posY + ys, posZ + zs, 0, 0, 0);
world.addParticle(data, getX() + xs, getY() + ys, getZ() + zs, 0, 0, 0);
}
LivingEntity thrower = getThrower();
if(!world.isRemote && thrower != null) {
AxisAlignedBB axis = new AxisAlignedBB(posX, posY, posZ, lastTickPosX, lastTickPosY, lastTickPosZ).grow(2);
AxisAlignedBB axis = new AxisAlignedBB(getX(), getY(), getZ(), lastTickPosX, lastTickPosY, lastTickPosZ).grow(2);
List<LivingEntity> entities = world.getEntitiesWithinAABB(LivingEntity.class, axis);
for(LivingEntity living : entities) {
if(living == thrower)
@@ -62,19 +62,19 @@ public class EntityFlameRing extends Entity {
double z = Math.sin(rad) * renderRadius;
WispParticleData data1 = WispParticleData.wisp(0.65F + (float) Math.random() * 0.45F, 1F, (float) Math.random() * 0.25F, (float) Math.random() * 0.25F);
world.addParticle(data1, posX + x, posY - 0.2, posZ + z, (float) (Math.random() - 0.5F) * 0.15F, 0.055F + (float) Math.random() * 0.025F, (float) (Math.random() - 0.5F) * 0.15F);
world.addParticle(data1, getX() + x, getY() - 0.2, getZ() + z, (float) (Math.random() - 0.5F) * 0.15F, 0.055F + (float) Math.random() * 0.025F, (float) (Math.random() - 0.5F) * 0.15F);
float gs = (float) Math.random() * 0.15F;
float smokeRadius = (float) (renderRadius - Math.random() * renderRadius * 0.9);
x = Math.cos(rad) * smokeRadius;
z = Math.sin(rad) * smokeRadius;
WispParticleData data = WispParticleData.wisp(0.65F + (float) Math.random() * 0.45F, gs, gs, gs, 1);
world.addParticle(data, posX + x, posY - 0.2, posZ + z, 0, -(-0.155F - (float) Math.random() * 0.025F), 0);
}
WispParticleData data = WispParticleData.wisp(0.65F + (float) Math.random() * 0.45F, gs, gs, gs, 1);
world.addParticle(data, getX() + x, getY() - 0.2, getZ() + z, 0, -(-0.155F - (float) Math.random() * 0.025F), 0);
}
}
if(world.rand.nextInt(20) == 0)
world.playSound(posX, posY, posZ, SoundEvents.BLOCK_FIRE_AMBIENT, SoundCategory.BLOCKS, 1F, 1F, false);
world.playSound(getX(), getY(), getZ(), SoundEvents.BLOCK_FIRE_AMBIENT, SoundCategory.BLOCKS, 1F, 1F, false);
if(world.isRemote)
return;
@@ -85,14 +85,14 @@ public class EntityFlameRing extends Entity {
}
if(ticksExisted > 45) {
AxisAlignedBB boundingBox = new AxisAlignedBB(posX, posY, posZ, posX, posY, posZ).grow(radius, radius, radius);
AxisAlignedBB boundingBox = new AxisAlignedBB(getX(), getY(), getZ(), getX(), getY(), getZ()).grow(radius, radius, radius);
List<LivingEntity> entities = world.getEntitiesWithinAABB(LivingEntity.class, boundingBox);
if(entities.isEmpty())
return;
for(LivingEntity entity : entities) {
if(entity == null || MathHelper.pointDistancePlane(posX, posY, entity.getX(), entity.getY()) > radius)
if(entity == null || MathHelper.pointDistancePlane(getX(), getY(), entity.getX(), entity.getY()) > radius)
continue;
entity.setFire(4);
@@ -56,24 +56,24 @@ public class EntityMagicLandmine extends Entity {
float g = 0F;
float b = 0.2F;
//Botania.proxy.wispFX(world, posX, posY, posZ, r, g, b, 0.6F, -0.2F, 1);
//Botania.proxy.wispFX(world, getX(), getY(), getZ(), r, g, b, 0.6F, -0.2F, 1);
for(int i = 0; i < 6; i++) {
WispParticleData data = WispParticleData.wisp(0.4F, r, g, b, (float) 1);
world.addParticle(data, posX - range + Math.random() * range * 2, posY, posZ - range + Math.random() * range * 2, 0, - -0.015F, 0);
world.addParticle(data, getX() - range + Math.random() * range * 2, getY(), getZ() - range + Math.random() * range * 2, 0, - -0.015F, 0);
}
if(ticksExisted >= 55) {
world.playSound(null, posX, posY, posZ, ModSounds.gaiaTrap, SoundCategory.NEUTRAL, 0.3F, 1F);
world.playSound(null, getX(), getY(), getZ(), ModSounds.gaiaTrap, SoundCategory.NEUTRAL, 0.3F, 1F);
float m = 0.35F;
g = 0.4F;
for(int i = 0; i < 25; i++) {
WispParticleData data = WispParticleData.wisp(0.5F, r, g, b);
world.addParticle(data, posX, posY + 1, posZ, (float) (Math.random() - 0.5F) * m, (float) (Math.random() - 0.5F) * m, (float) (Math.random() - 0.5F) * m);
world.addParticle(data, getX(), getY() + 1, getZ(), (float) (Math.random() - 0.5F) * m, (float) (Math.random() - 0.5F) * m, (float) (Math.random() - 0.5F) * m);
}
if(!world.isRemote) {
List<PlayerEntity> players = world.getEntitiesWithinAABB(PlayerEntity.class, new AxisAlignedBB(posX - range, posY - range, posZ - range, posX + range, posY + range, posZ + range));
List<PlayerEntity> players = world.getEntitiesWithinAABB(PlayerEntity.class, new AxisAlignedBB(getX() - range, getY() - range, getZ() - range, getX() + range, getY() + range, getZ() + range));
for(PlayerEntity player : players) {
player.attackEntityFrom(DamageSource.causeIndirectMagicDamage(this, summoner), 10);
player.addPotionEffect(new EffectInstance(Effects.BLINDNESS, 25, 0));
@@ -144,7 +144,7 @@ public class EntityMagicMissile extends ThrowableEntity {
if(time < 10)
setMotion(getMotion().getX(), Math.abs(getMotion().getY()), getMotion().getZ());
List<LivingEntity> targetList = world.getEntitiesWithinAABB(LivingEntity.class, new AxisAlignedBB(posX - 0.5, posY - 0.5, posZ - 0.5, posX + 0.5, posY + 0.5, posZ + 0.5));
List<LivingEntity> targetList = world.getEntitiesWithinAABB(LivingEntity.class, new AxisAlignedBB(getX() - 0.5, getY() - 0.5, getZ() - 0.5, getX() + 0.5, getY() + 0.5, getZ() + 0.5));
if(targetList.contains(target)) {
LivingEntity thrower = getThrower();
if(thrower != null) {
@@ -183,7 +183,7 @@ public class EntityMagicMissile extends ThrowableEntity {
setTarget(null);
double range = 12;
AxisAlignedBB bounds = new AxisAlignedBB(posX - range, posY - range, posZ - range, posX + range, posY + range, posZ + range);
AxisAlignedBB bounds = new AxisAlignedBB(getX() - range, getY() - range, getZ() - range, getX() + range, getY() + range, getZ() + range);
List entities;
if(isEvil()) {
entities = world.getEntitiesWithinAABB(PlayerEntity.class, bounds);
@@ -162,9 +162,6 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
}
private void superUpdate() {
this.lastTickPosX = this.getX();
this.lastTickPosY = this.getY();
this.lastTickPosZ = this.getZ();
// Botania - inline supersuperclass.tick()
{
if (!this.world.isRemote) {
@@ -201,7 +198,7 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
}
*/
RayTraceResult raytraceresult = ProjectileHelper.func_221267_a(this, axisalignedbb, (p_213880_1_) -> {
RayTraceResult raytraceresult = ProjectileHelper.rayTrace(this, axisalignedbb, (p_213880_1_) -> {
return !p_213880_1_.isSpectator() && p_213880_1_.canBeCollidedWith(); // && p_213880_1_ != this.ignoreEntity;
}, RayTraceContext.BlockMode.OUTLINE, true);
/*
@@ -213,15 +210,15 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
if (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)) {
} else if (!net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)){
this.onImpact(raytraceresult);
}
}
Vec3d vec3d = this.getMotion();
this.getX() += vec3d.x;
this.getY() += vec3d.y;
this.getZ() += vec3d.z;
double d0 = this.getX() + vec3d.x;
double d1 = this.getY() + vec3d.y;
double d2 = this.getZ() + vec3d.z;
float f = MathHelper.sqrt(horizontalMag(vec3d));
this.rotationYaw = (float)(MathHelper.atan2(vec3d.x, vec3d.z) * (double)(180F / (float)Math.PI));
@@ -247,7 +244,7 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
if (this.isInWater()) {
for(int i = 0; i < 4; ++i) {
float f2 = 0.25F;
this.world.addParticle(ParticleTypes.BUBBLE, this.getX() - vec3d.x * 0.25D, this.getY() - vec3d.y * 0.25D, this.getZ() - vec3d.z * 0.25D, vec3d.x, vec3d.y, vec3d.z);
this.world.addParticle(ParticleTypes.BUBBLE, d0 - vec3d.x * 0.25D, d1 - vec3d.y * 0.25D, d2 - vec3d.z * 0.25D, vec3d.x, vec3d.y, vec3d.z);
}
f1 = 0.8F;
@@ -261,7 +258,7 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
this.setMotion(vec3d1.x, vec3d1.y - (double)this.getGravityVelocity(), vec3d1.z);
}
this.setPosition(this.getX(), this.getY(), this.getZ());
this.setPosition(d0, d1, d2);
}
@Override
@@ -438,14 +435,14 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
if(!noParticles && shouldDoFakeParticles()) {
SparkleParticleData data = SparkleParticleData.fake(0.4F * size, r, g, b, 1);
Botania.proxy.addParticleForce(world, data, posX, posY, posZ, 0, 0, 0);
Botania.proxy.addParticleForce(world, data, getX(), getY(), getZ(), 0, 0, 0);
}
} else {
boolean depth = !Botania.proxy.isClientPlayerWearingMonocle();
if(ConfigHandler.CLIENT.subtlePowerSystem.get()) {
WispParticleData data = WispParticleData.wisp(0.1F * size, r, g, b, depth);
world.addParticle(data, posX, posY, posZ, (float) (Math.random() - 0.5F) * 0.02F, (float) (Math.random() - 0.5F) * 0.02F, (float) (Math.random() - 0.5F) * 0.01F);
world.addParticle(data, getX(), getY(), getZ(), (float) (Math.random() - 0.5F) * 0.02F, (float) (Math.random() - 0.5F) * 0.02F, (float) (Math.random() - 0.5F) * 0.01F);
} else {
float or = r;
float og = g;
@@ -453,9 +450,9 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
double luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b; // Standard relative luminance calculation
double savedPosX = posX;
double savedPosY = posY;
double savedPosZ = posZ;
double iterX = getX();
double iterY = getY();
double iterZ = getZ();
Vector3 currentPos = Vector3.fromEntity(this);
Vector3 oldPos = new Vector3(prevPosX, prevPosY, prevPosZ);
@@ -472,27 +469,23 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
}
size = osize + ((float) Math.random() - 0.5F) * 0.065F + (float) Math.sin(new Random(entityUniqueID.getMostSignificantBits()).nextInt(9001)) * 0.4F;
WispParticleData data = WispParticleData.wisp(0.2F * size, r, g, b, depth);
world.addParticle(data, posX, posY, posZ,
world.addParticle(data, iterX, iterY, iterZ,
(float) -getMotion().getX() * 0.01F,
(float) -getMotion().getY() * 0.01F,
(float) -getMotion().getZ() * 0.01F);
posX += diffVecNorm.x * distance;
posY += diffVecNorm.y * distance;
posZ += diffVecNorm.z * distance;
iterX += diffVecNorm.x * distance;
iterY += diffVecNorm.y * distance;
iterZ += diffVecNorm.z * distance;
currentPos = Vector3.fromEntity(this);
currentPos = new Vector3(iterX, iterY, iterZ);
diffVec = oldPos.subtract(currentPos);
if(getPersistentData().contains(ItemTinyPlanet.TAG_ORBIT))
break;
} while(Math.abs(diffVec.mag()) > distance);
WispParticleData data = WispParticleData.wisp(0.1F * size, or, og, ob, depth);
world.addParticle(data, posX, posY, posZ, (float) (Math.random() - 0.5F) * 0.06F, (float) (Math.random() - 0.5F) * 0.06F, (float) (Math.random() - 0.5F) * 0.06F);
posX = savedPosX;
posY = savedPosY;
posZ = savedPosZ;
world.addParticle(data, iterX, iterY, iterZ, (float) (Math.random() - 0.5F) * 0.06F, (float) (Math.random() - 0.5F) * 0.06F, (float) (Math.random() - 0.5F) * 0.06F);
}
}
}
@@ -559,10 +552,10 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
if(!ConfigHandler.CLIENT.subtlePowerSystem.get())
for(int i = 0; i < 4; i++) {
WispParticleData data = WispParticleData.wisp(0.15F * size, r, g, b);
world.addParticle(data, posX, posY, posZ, (float) (Math.random() - 0.5F) * 0.04F, (float) (Math.random() - 0.5F) * 0.04F, (float) (Math.random() - 0.5F) * 0.04F);
world.addParticle(data, getX(), getY(), getZ(), (float) (Math.random() - 0.5F) * 0.04F, (float) (Math.random() - 0.5F) * 0.04F, (float) (Math.random() - 0.5F) * 0.04F);
}
SparkleParticleData data = SparkleParticleData.sparkle((float) 4, r, g, b, 2);
world.addParticle(data, (float) posX, (float) posY, (float) posZ, 0, 0, 0);
world.addParticle(data, getX(), getY(), getZ(), 0, 0, 0);
}
remove();
@@ -87,9 +87,9 @@ public class EntityPixie extends FlyingEntity {
protected void updateAITasks() {
LivingEntity target = getAttackTarget();
if(target != null) {
double d0 = target.getX() + target.getWidth() / 2 - posX;
double d1 = target.getY() + target.getHeight() / 2 - posY;
double d2 = target.getZ() + target.getWidth() / 2 - posZ;
double d0 = target.getX() + target.getWidth() / 2 - getX();
double d1 = target.getY() + target.getHeight() / 2 - getY();
double d2 = target.getZ() + target.getWidth() / 2 - getZ();
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
float mod = 0.45F;
@@ -138,7 +138,7 @@ public class EntityPixie extends FlyingEntity {
float g = dark ? 0.025F : 0.25F;
float b = dark ? 0.09F : 0.9F;
SparkleParticleData data = SparkleParticleData.sparkle(0.1F + (float) Math.random() * 0.25F, r, g, b, 12);
world.addParticle(data, posX + (Math.random() - 0.5) * 0.25, posY + 0.5 + (Math.random() - 0.5) * 0.25, posZ + (Math.random() - 0.5) * 0.25, 0, 0, 0);
world.addParticle(data, getX() + (Math.random() - 0.5) * 0.25, getY() + 0.5 + (Math.random() - 0.5) * 0.25, getZ() + (Math.random() - 0.5) * 0.25, 0, 0, 0);
}
}
@@ -147,7 +147,7 @@ public class EntityPixie extends FlyingEntity {
if(world != null && world.isRemote && getPixieType() == 0)
for(int i = 0; i < 12; i++) {
SparkleParticleData data = SparkleParticleData.sparkle(1F + (float) Math.random() * 0.25F, 1F, 0.25F, 0.9F, 5);
world.addParticle(data, posX + (Math.random() - 0.5) * 0.25, posY + 0.5 + (Math.random() - 0.5) * 0.25, posZ + (Math.random() - 0.5) * 0.25, 0, 0, 0);
world.addParticle(data, getX() + (Math.random() - 0.5) * 0.25, getY() + 0.5 + (Math.random() - 0.5) * 0.25, getZ() + (Math.random() - 0.5) * 0.25, 0, 0, 0);
}
super.remove();
}
@@ -69,12 +69,12 @@ public class EntitySignalFlare extends Entity {
for(int i = 0; i < 3; i++) {
WispParticleData data = WispParticleData.wisp((float) Math.random() * 5 + 1F, r / 255F, g / 255F, b / 255F);
Botania.proxy.addParticleForce(world, data, posX, posY, posZ + 0.5, (float) (Math.random() - 0.5F), 10F * (float) Math.sqrt(256F / (256F - (float) posY)), (float) (Math.random() - 0.5F));
Botania.proxy.addParticleForce(world, data, getX(), getY(), getZ() + 0.5, (float) (Math.random() - 0.5F), 10F * (float) Math.sqrt(256F / (256F - (float) getY())), (float) (Math.random() - 0.5F));
}
for(int i = 0; i < 4; i++) {
WispParticleData data = WispParticleData.wisp((float) Math.random() * 15 + 8F, r / 255F, g / 255F, b / 255F);
Botania.proxy.addParticleForce(world, data, posX + 0.5, Math.min(256, getFiredAt() + Botania.proxy.getClientRenderDistance() * 16), posZ + 0.5, (float) (Math.random() - 0.5F) * 8F, 0F, (float) (Math.random() - 0.5F) * 8F);
Botania.proxy.addParticleForce(world, data, getX() + 0.5, Math.min(256, getFiredAt() + Botania.proxy.getClientRenderDistance() * 16), getZ() + 0.5, (float) (Math.random() - 0.5F) * 8F, 0F, (float) (Math.random() - 0.5F) * 8F);
}
}
}
@@ -105,7 +105,7 @@ public class EntitySpark extends EntitySparkBase implements ISparkEntity {
switch(upgrade) {
case DISPERSIVE : {
List<PlayerEntity> players = SparkHelper.getEntitiesAround(PlayerEntity.class, world, posX, posY + (getHeight() / 2.0), posZ);
List<PlayerEntity> players = SparkHelper.getEntitiesAround(PlayerEntity.class, world, getX(), getY() + (getHeight() / 2.0), getZ());
Map<PlayerEntity, Map<ItemStack, Integer>> receivingPlayers = new HashMap<>();
@@ -159,7 +159,7 @@ public class EntitySpark extends EntitySparkBase implements ISparkEntity {
break;
}
case DOMINANT : {
List<ISparkEntity> validSparks = SparkHelper.getSparksAround(world, posX, posY + (getHeight() / 2), posZ, getNetwork())
List<ISparkEntity> validSparks = SparkHelper.getSparksAround(world, getX(), getY() + (getHeight() / 2), getZ(), getNetwork())
.filter(s -> {
SparkUpgradeType otherUpgrade = s.getUpgrade();
return s != this && otherUpgrade == SparkUpgradeType.NONE && s.getAttachedTile() instanceof IManaPool;
@@ -171,7 +171,7 @@ public class EntitySpark extends EntitySparkBase implements ISparkEntity {
break;
}
case RECESSIVE : {
SparkHelper.getSparksAround(world, posX, posY + (getHeight() / 2), posZ, getNetwork())
SparkHelper.getSparksAround(world, getX(), getY() + (getHeight() / 2), getZ(), getNetwork())
.filter(s -> {
SparkUpgradeType otherUpgrade = s.getUpgrade();
return s != this
@@ -216,7 +216,7 @@ public class EntitySpark extends EntitySparkBase implements ISparkEntity {
private void particlesTowards(Entity e) {
PacketHandler.sendToNearby(world, this,
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.SPARK_MANA_FLOW, posX, posY, posZ,
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.SPARK_MANA_FLOW, getX(), getY(), getZ(),
getEntityId(), e.getEntityId()));
}
@@ -260,7 +260,7 @@ public class EntitySpark extends EntitySparkBase implements ISparkEntity {
} else dropAndKill();
return true;
} else {
SparkHelper.getSparksAround(world, posX, posY + (getHeight() / 2), posZ, getNetwork())
SparkHelper.getSparksAround(world, getX(), getY() + (getHeight() / 2), getZ(), getNetwork())
.forEach(s -> particleBeam(player, this, (Entity) s));
return true;
}
@@ -304,9 +304,9 @@ public class EntitySpark extends EntitySparkBase implements ISparkEntity {
@Override
public ISparkAttachable getAttachedTile() {
int x = MathHelper.floor(posX);
int y = MathHelper.floor(posY) - 1;
int z = MathHelper.floor(posZ);
int x = MathHelper.floor(getX());
int y = MathHelper.floor(getY()) - 1;
int z = MathHelper.floor(getZ());
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
if(tile instanceof ISparkAttachable)
return (ISparkAttachable) tile;
@@ -116,7 +116,7 @@ public class EntityThornChakram extends ThrowableEntity implements IRendersAsIte
double r = 0.1;
double m = 0.1;
for(int i = 0; i < 3; i++)
world.addParticle(ParticleTypes.FLAME, posX + r * (Math.random() - 0.5), posY + r * (Math.random() - 0.5), posZ + r * (Math.random() - 0.5), m * (Math.random() - 0.5), m * (Math.random() - 0.5), m * (Math.random() - 0.5));
world.addParticle(ParticleTypes.FLAME, getX() + r * (Math.random() - 0.5), getY() + r * (Math.random() - 0.5), getZ() + r * (Math.random() - 0.5), m * (Math.random() - 0.5), m * (Math.random() - 0.5), m * (Math.random() - 0.5));
}
// Server state control
@@ -134,7 +134,7 @@ public class EntityThornChakram extends ThrowableEntity implements IRendersAsIte
private void dropAndKill() {
ItemStack stack = getItemStack();
ItemEntity item = new ItemEntity(world, posX, posY, posZ, stack);
ItemEntity item = new ItemEntity(world, getX(), getY(), getZ(), stack);
world.addEntity(item);
remove();
}
@@ -1,5 +1,7 @@
package vazkii.botania.common.entity;
import java.util.UUID;
import javax.annotation.Nullable;
import net.minecraft.block.Blocks;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
@@ -22,9 +24,6 @@ import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nullable;
import java.util.UUID;
public abstract class EntityThrowableCopy extends Entity implements IProjectile {
private int xTile = -1;
private int yTile = -1;
@@ -36,52 +35,52 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
private Entity ignoreEntity;
private int ignoreTime;
protected EntityThrowableCopy(EntityType<? extends EntityThrowableCopy> type, World worldIn) {
super(type, worldIn);
protected EntityThrowableCopy(EntityType<? extends EntityThrowableCopy> p_i48540_1_, World p_i48540_2_) {
super(p_i48540_1_, p_i48540_2_);
}
protected EntityThrowableCopy(EntityType<? extends EntityThrowableCopy> type, double x, double y, double z, World worldIn) {
this(type, worldIn);
this.setPosition(x, y, z);
protected EntityThrowableCopy(EntityType<? extends EntityThrowableCopy> p_i48541_1_, double p_i48541_2_, double p_i48541_4_, double p_i48541_6_, World p_i48541_8_) {
this(p_i48541_1_, p_i48541_8_);
this.setPosition(p_i48541_2_, p_i48541_4_, p_i48541_6_);
}
protected EntityThrowableCopy(EntityType<? extends EntityThrowableCopy> type, LivingEntity livingEntityIn, World worldIn) {
this(type, livingEntityIn.getX(), livingEntityIn.getY() + (double)livingEntityIn.getEyeHeight() - (double)0.1F, livingEntityIn.getZ(), worldIn);
this.owner = livingEntityIn;
this.ownerId = livingEntityIn.getUniqueID();
protected EntityThrowableCopy(EntityType<? extends EntityThrowableCopy> p_i48542_1_, LivingEntity p_i48542_2_, World p_i48542_3_) {
this(p_i48542_1_, p_i48542_2_.getX(), p_i48542_2_.getEyeY() - (double)0.1F, p_i48542_2_.getZ(), p_i48542_3_);
this.owner = p_i48542_2_;
this.ownerId = p_i48542_2_.getUniqueID();
}
/**
* Checks if the entity is in range to render.
*/
@OnlyIn(Dist.CLIENT)
public boolean isInRangeToRenderDist(double distance) {
public boolean isInRangeToRenderDist(double p_70112_1_) {
double d0 = this.getBoundingBox().getAverageEdgeLength() * 4.0D;
if (Double.isNaN(d0)) {
d0 = 4.0D;
}
d0 = d0 * 64.0D;
return distance < d0 * d0;
return p_70112_1_ < d0 * d0;
}
/**
* Sets throwable heading based on an entity that's throwing it
*/
public void shoot(Entity entityThrower, float rotationPitchIn, float rotationYawIn, float pitchOffset, float velocity, float inaccuracy) {
float f = -MathHelper.sin(rotationYawIn * ((float)Math.PI / 180F)) * MathHelper.cos(rotationPitchIn * ((float)Math.PI / 180F));
float f1 = -MathHelper.sin((rotationPitchIn + pitchOffset) * ((float)Math.PI / 180F));
float f2 = MathHelper.cos(rotationYawIn * ((float)Math.PI / 180F)) * MathHelper.cos(rotationPitchIn * ((float)Math.PI / 180F));
this.shoot((double)f, (double)f1, (double)f2, velocity, inaccuracy);
Vec3d vec3d = entityThrower.getMotion();
this.setMotion(this.getMotion().add(vec3d.x, entityThrower.onGround ? 0.0D : vec3d.y, vec3d.z));
public void shoot(Entity p_184538_1_, float p_184538_2_, float p_184538_3_, float p_184538_4_, float p_184538_5_, float p_184538_6_) {
float f = -MathHelper.sin(p_184538_3_ * ((float)Math.PI / 180F)) * MathHelper.cos(p_184538_2_ * ((float)Math.PI / 180F));
float f1 = -MathHelper.sin((p_184538_2_ + p_184538_4_) * ((float)Math.PI / 180F));
float f2 = MathHelper.cos(p_184538_3_ * ((float)Math.PI / 180F)) * MathHelper.cos(p_184538_2_ * ((float)Math.PI / 180F));
this.shoot((double)f, (double)f1, (double)f2, p_184538_5_, p_184538_6_);
Vec3d vec3d = p_184538_1_.getMotion();
this.setMotion(this.getMotion().add(vec3d.x, p_184538_1_.onGround ? 0.0D : vec3d.y, vec3d.z));
}
/**
* Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction.
*/
public void shoot(double x, double y, double z, float velocity, float inaccuracy) {
Vec3d vec3d = (new Vec3d(x, y, z)).normalize().add(this.rand.nextGaussian() * (double)0.0075F * (double)inaccuracy, this.rand.nextGaussian() * (double)0.0075F * (double)inaccuracy, this.rand.nextGaussian() * (double)0.0075F * (double)inaccuracy).scale((double)velocity);
public void shoot(double p_70186_1_, double p_70186_3_, double p_70186_5_, float p_70186_7_, float p_70186_8_) {
Vec3d vec3d = (new Vec3d(p_70186_1_, p_70186_3_, p_70186_5_)).normalize().add(this.rand.nextGaussian() * (double)0.0075F * (double)p_70186_8_, this.rand.nextGaussian() * (double)0.0075F * (double)p_70186_8_, this.rand.nextGaussian() * (double)0.0075F * (double)p_70186_8_).scale((double)p_70186_7_);
this.setMotion(vec3d);
float f = MathHelper.sqrt(horizontalMag(vec3d));
this.rotationYaw = (float)(MathHelper.atan2(vec3d.x, vec3d.z) * (double)(180F / (float)Math.PI));
@@ -94,12 +93,12 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
* Updates the entity motion clientside, called by packets from the server
*/
@OnlyIn(Dist.CLIENT)
public void setVelocity(double x, double y, double z) {
this.setMotion(x, y, z);
public void setVelocity(double p_70016_1_, double p_70016_3_, double p_70016_5_) {
this.setMotion(p_70016_1_, p_70016_3_, p_70016_5_);
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) {
float f = MathHelper.sqrt(x * x + z * z);
this.rotationYaw = (float)(MathHelper.atan2(x, z) * (double)(180F / (float)Math.PI));
this.rotationPitch = (float)(MathHelper.atan2(y, (double)f) * (double)(180F / (float)Math.PI));
float f = MathHelper.sqrt(p_70016_1_ * p_70016_1_ + p_70016_5_ * p_70016_5_);
this.rotationYaw = (float)(MathHelper.atan2(p_70016_1_, p_70016_5_) * (double)(180F / (float)Math.PI));
this.rotationPitch = (float)(MathHelper.atan2(p_70016_3_, (double)f) * (double)(180F / (float)Math.PI));
this.prevRotationYaw = this.rotationYaw;
this.prevRotationPitch = this.rotationPitch;
}
@@ -110,9 +109,6 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
* Called to update the entity's position/logic.
*/
public void tick() {
this.lastTickPosX = this.getX();
this.lastTickPosY = this.getY();
this.lastTickPosZ = this.getZ();
super.tick();
if (this.throwableShake > 0) {
--this.throwableShake;
@@ -140,7 +136,7 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
}
}
RayTraceResult raytraceresult = ProjectileHelper.func_221267_a(this, axisalignedbb, (p_213880_1_) -> {
RayTraceResult raytraceresult = ProjectileHelper.rayTrace(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) {
@@ -156,9 +152,9 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
}
Vec3d vec3d = this.getMotion();
this.getX() += vec3d.x;
this.getY() += vec3d.y;
this.getZ() += vec3d.z;
double d0 = this.getX() + vec3d.x;
double d1 = this.getY() + vec3d.y;
double d2 = this.getZ() + vec3d.z;
float f = MathHelper.sqrt(horizontalMag(vec3d));
this.rotationYaw = (float)(MathHelper.atan2(vec3d.x, vec3d.z) * (double)(180F / (float)Math.PI));
@@ -184,7 +180,7 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
if (this.isInWater()) {
for(int i = 0; i < 4; ++i) {
float f2 = 0.25F;
this.world.addParticle(ParticleTypes.BUBBLE, this.getX() - vec3d.x * 0.25D, this.getY() - vec3d.y * 0.25D, this.getZ() - vec3d.z * 0.25D, vec3d.x, vec3d.y, vec3d.z);
this.world.addParticle(ParticleTypes.BUBBLE, d0 - vec3d.x * 0.25D, d1 - vec3d.y * 0.25D, d2 - vec3d.z * 0.25D, vec3d.x, vec3d.y, vec3d.z);
}
f1 = 0.8F;
@@ -198,7 +194,7 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
this.setMotion(vec3d1.x, vec3d1.y - (double)this.getGravityVelocity(), vec3d1.z);
}
this.setPosition(this.getX(), this.getY(), this.getZ());
this.setPosition(d0, d1, d2);
}
/**
@@ -211,16 +207,16 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
/**
* Called when this EntityThrowable hits a block or entity.
*/
protected abstract void onImpact(RayTraceResult result);
protected abstract void onImpact(RayTraceResult p_70184_1_);
public void writeAdditional(CompoundNBT compound) {
compound.putInt("xTile", this.xTile);
compound.putInt("yTile", this.yTile);
compound.putInt("zTile", this.zTile);
compound.putByte("shake", (byte)this.throwableShake);
compound.putByte("inGround", (byte)(this.inGround ? 1 : 0));
public void writeAdditional(CompoundNBT p_213281_1_) {
p_213281_1_.putInt("xTile", this.xTile);
p_213281_1_.putInt("yTile", this.yTile);
p_213281_1_.putInt("zTile", this.zTile);
p_213281_1_.putByte("shake", (byte)this.throwableShake);
p_213281_1_.putBoolean("inGround", this.inGround);
if (this.ownerId != null) {
compound.put("owner", NBTUtil.writeUniqueId(this.ownerId));
p_213281_1_.put("owner", NBTUtil.writeUniqueId(this.ownerId));
}
}
@@ -228,27 +224,27 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readAdditional(CompoundNBT compound) {
this.xTile = compound.getInt("xTile");
this.yTile = compound.getInt("yTile");
this.zTile = compound.getInt("zTile");
this.throwableShake = compound.getByte("shake") & 255;
this.inGround = compound.getByte("inGround") == 1;
public void readAdditional(CompoundNBT p_70037_1_) {
this.xTile = p_70037_1_.getInt("xTile");
this.yTile = p_70037_1_.getInt("yTile");
this.zTile = p_70037_1_.getInt("zTile");
this.throwableShake = p_70037_1_.getByte("shake") & 255;
this.inGround = p_70037_1_.getBoolean("inGround");
this.owner = null;
if (compound.contains("owner", 10)) {
this.ownerId = NBTUtil.readUniqueId(compound.getCompound("owner"));
if (p_70037_1_.contains("owner", 10)) {
this.ownerId = NBTUtil.readUniqueId(p_70037_1_.getCompound("owner"));
}
}
@Nullable
public LivingEntity getThrower() {
if (this.owner == null && this.ownerId != null && this.world instanceof ServerWorld) {
if ((this.owner == null || this.owner.removed) && this.ownerId != null && this.world instanceof ServerWorld) {
Entity entity = ((ServerWorld)this.world).getEntityByUuid(this.ownerId);
if (entity instanceof LivingEntity) {
this.owner = (LivingEntity)entity;
} else {
this.ownerId = null;
this.owner = null;
}
}
@@ -258,4 +254,4 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
public IPacket<?> createSpawnPacket() {
return new SSpawnObjectPacket(this);
}
}
}
@@ -83,7 +83,7 @@ public class EntityVineBall extends ThrowableEntity implements IRendersAsItem {
public void handleStatusUpdate(byte id) {
if(id == 3) {
for(int j = 0; j < 16; j++) {
world.addParticle(new ItemParticleData(ParticleTypes.ITEM, new ItemStack(ModItems.vineBall)), posX, posY, posZ, Math.random() * 0.2 - 0.1, Math.random() * 0.25, Math.random() * 0.2 - 0.1);
world.addParticle(new ItemParticleData(ParticleTypes.ITEM, new ItemStack(ModItems.vineBall)), getX(), getY(), getZ(), Math.random() * 0.2 - 0.1, Math.random() * 0.25, Math.random() * 0.2 - 0.1);
}
}
}
@@ -96,11 +96,11 @@ public class ItemFlowerBag extends ItemMod {
if(Block.getBlockFromItem(entityStack.getItem()) instanceof BlockModFlower && entityStack.getCount() > 0) {
int color = ((BlockModFlower) Block.getBlockFromItem(entityStack.getItem())).color.getId();
for(int i = 0; i < event.getEntityPlayer().inventory.getSizeInventory(); i++) {
if(i == event.getEntityPlayer().inventory.currentItem)
for(int i = 0; i < event.getPlayer().inventory.getSizeInventory(); i++) {
if(i == event.getPlayer().inventory.currentItem)
continue; // prevent item deletion
ItemStack bag = event.getEntityPlayer().inventory.getStackInSlot(i);
ItemStack bag = event.getPlayer().inventory.getStackInSlot(i);
if(!bag.isEmpty() && bag.getItem() == this) {
IItemHandler bagInv = bag.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).orElseThrow(NullPointerException::new);
@@ -112,12 +112,12 @@ public class ItemFlowerBag extends ItemMod {
if(numPickedUp > 0) {
event.setCanceled(true);
if (!event.getItem().isSilent()) {
event.getItem().world.playSound(null, event.getEntityPlayer().getX(), event.getEntityPlayer().getY(), event.getEntityPlayer().getZ(),
event.getItem().world.playSound(null, event.getPlayer().getX(), event.getPlayer().getY(), event.getPlayer().getZ(),
SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 0.2F,
((event.getItem().world.rand.nextFloat() - event.getItem().world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
}
((ServerPlayerEntity) event.getEntityPlayer()).connection.sendPacket(new SCollectItemPacket(event.getItem().getEntityId(), event.getEntityPlayer().getEntityId(), numPickedUp));
event.getEntityPlayer().openContainer.detectAndSendChanges();
((ServerPlayerEntity) event.getPlayer()).connection.sendPacket(new SCollectItemPacket(event.getItem().getEntityId(), event.getPlayer().getEntityId(), numPickedUp));
event.getPlayer().openContainer.detectAndSendChanges();
return;
}
@@ -199,9 +199,7 @@ public class ItemLaputaShard extends ItemMod implements ILensEffect, ITinyPlanet
public EntityManaBurst getBurst(World world, BlockPos pos, ItemStack stack) {
EntityManaBurst burst = new EntityManaBurst(world);
burst.getX() = pos.getX() + 0.5;
burst.getY() = pos.getY() + 0.5;
burst.getZ() = pos.getZ() + 0.5;
burst.setPosition(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
burst.setColor(0x00EAFF);
burst.setMana(1);
@@ -45,7 +45,7 @@ public class ItemWorldSeed extends ItemMod {
player.rotationYaw = 0F;
player.setPositionAndUpdate(coords.getX() + 0.5, coords.getY() + 0.5, coords.getZ() + 0.5);
while(!world.isCollisionBoxesEmpty(player, player.getBoundingBox()))
while(!world.doesNotCollide(player, player.getBoundingBox()))
player.setPositionAndUpdate(player.getX(), player.getY() + 1, player.getZ());
world.playSound(null, player.getX(), player.getY(), player.getZ(), SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.PLAYERS, 1F, 1F);
@@ -54,7 +54,7 @@ public class ItemIcePendant extends ItemBauble {
x = MathHelper.floor(entity.getX() + (double)((float)(l % 2 * 2 - 1) * 0.25F));
z = MathHelper.floor(entity.getZ() + (double)((float)(l / 2 % 2 * 2 - 1) * 0.25F));
BlockPos blockpos = new BlockPos(x, y, z);
if (entity.world.isAirBlock(blockpos) && entity.world.getBiome(blockpos).func_225486_c(blockpos) < 0.9F && blockstate.isValidPosition(entity.world, blockpos)) {
if (entity.world.isAirBlock(blockpos) && entity.world.getBiome(blockpos).getTemperatureCached(blockpos) < 0.9F && blockstate.isValidPosition(entity.world, blockpos)) {
entity.world.setBlockState(blockpos, blockstate);
}
}
@@ -173,7 +173,7 @@ public class ItemItemFinder extends ItemBauble {
boolean foundCap = false;
for(Direction e : Direction.values()) {
if(scanInventory(tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, e), pstack)) {
blockPosBuilder.add(new LongNBT(pos_.toLong()));
blockPosBuilder.add(LongNBT.of(pos_.toLong()));
foundCap = true;
break;
}
@@ -181,7 +181,7 @@ public class ItemItemFinder extends ItemBauble {
if(!foundCap && tile instanceof IInventory) {
IInventory inv = (IInventory) tile;
if(scanInventory(LazyOptional.of(() -> new InvWrapper(inv)), pstack))
blockPosBuilder.add(new LongNBT(pos_.toLong()));
blockPosBuilder.add(LongNBT.of(pos_.toLong()));
}
}
}
@@ -82,7 +82,7 @@ public class ItemManasteelShovel extends ShovelItem implements IManaUsingItem, I
return ActionResultType.PASS;
Block block = world.getBlockState(pos).getBlock();
BlockState converted = field_195955_e.get(block);
BlockState converted = SHOVEL_LOOKUP.get(block);
if (converted == null) {
UseHoeEvent event = new UseHoeEvent(ctx);
@@ -35,11 +35,11 @@ public class ItemEnderAir extends ItemMod {
if(correctStack && ender) {
if (event.getWorld().isRemote) {
event.getEntityPlayer().swingArm(event.getHand());
event.getPlayer().swingArm(event.getHand());
} else {
ItemStack stack1 = new ItemStack(ModItems.enderAirBottle);
ItemHandlerHelper.giveItemToPlayer(event.getEntityPlayer(), stack1);
ItemHandlerHelper.giveItemToPlayer(event.getPlayer(), stack1);
stack.shrink(1);
@@ -90,9 +90,7 @@ public class ItemKingKey extends ItemRelic implements IManaUsingItem {
Vector3 end = pl.add(axis1);
EntityBabylonWeapon weapon = new EntityBabylonWeapon(living, living.world);
weapon.getX() = end.x;
weapon.getY() = end.y;
weapon.getZ() = end.z;
weapon.setPosition(end.x, end.y, end.z);
weapon.rotationYaw = living.rotationYaw;
weapon.setVariety(rand.nextInt(WEAPON_TYPES));
weapon.setDelay(spawned);
@@ -63,7 +63,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat
@SubscribeEvent
public static void onPlayerInteract(PlayerInteractEvent.RightClickBlock event) {
PlayerEntity player = event.getEntityPlayer();
PlayerEntity player = event.getPlayer();
ItemStack lokiRing = getLokiRing(player);
if(lokiRing.isEmpty() || !player.isSneaking())
return;
@@ -105,9 +105,9 @@ public class ItemExchangeRod extends ItemMod implements IManaUsingItem, IWirefra
private void onLeftClick(PlayerInteractEvent.LeftClickBlock event) {
ItemStack stack = event.getItemStack();
if(!stack.isEmpty() && stack.getItem() == this && canExchange(stack) && ManaItemHandler.requestManaExactForTool(stack, event.getEntityPlayer(), COST, false)) {
if(exchange(event.getWorld(), event.getEntityPlayer(), event.getPos(), stack, getState(stack)))
ManaItemHandler.requestManaExactForTool(stack, event.getEntityPlayer(), COST, true);
if(!stack.isEmpty() && stack.getItem() == this && canExchange(stack) && ManaItemHandler.requestManaExactForTool(stack, event.getPlayer(), COST, false)) {
if(exchange(event.getWorld(), event.getPlayer(), event.getPos(), stack, getState(stack)))
ManaItemHandler.requestManaExactForTool(stack, event.getPlayer(), COST, true);
}
}
@@ -63,19 +63,19 @@ public class ItemRainbowRod extends ItemMod implements IManaUsingItem, IAvatarWi
double x = player.getX();
double y = player.getY();
double z = player.getZ();
BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos((int) x, (int) y, (int) z);
BlockPos.Mutable pos = new BlockPos.Mutable((int) x, (int) y, (int) z);
double lastX = 0;
double lastY = -1;
double lastZ = 0;
BlockPos.MutableBlockPos lastChecker = new BlockPos.MutableBlockPos();
BlockPos.Mutable lastChecker = new BlockPos.Mutable();
int count = 0;
boolean prof = IManaProficiencyArmor.Helper.hasProficiency(player, stack);
int maxlen = prof ? 160 : 100;
int time = prof ? (int) (TIME * 1.6) : TIME;
BlockPos.MutableBlockPos placePos = new BlockPos.MutableBlockPos();
BlockPos.Mutable placePos = new BlockPos.Mutable();
while (count < maxlen) {
lastChecker.setPos(lastX, lastY, lastZ);
@@ -1,6 +1,7 @@
package vazkii.botania.common.world;
import net.minecraft.world.IWorld;
import net.minecraft.world.biome.BiomeManager;
import net.minecraft.world.biome.provider.BiomeProvider;
import net.minecraft.world.chunk.IChunk;
import net.minecraft.world.gen.ChunkGeneratorType;
@@ -20,11 +21,11 @@ public class SkyblockChunkGenerator extends OverworldChunkGenerator {
public void makeBase(IWorld worldIn, IChunk chunkIn) {}
@Override
public void generateSurface(IChunk chunkIn) {}
public void buildSurface(WorldGenRegion region, IChunk chunkIn) {}
@Override
public void decorate(WorldGenRegion region) {}
@Override
public void carve(IChunk chunkIn, GenerationStage.Carving carvingSettings) {}
public void carve(BiomeManager biomeManager, IChunk chunkIn, GenerationStage.Carving carvingSettings) {}
}