Below 300 errors

This commit is contained in:
Vincent Lee committed 2019-06-30 13:34:45 -07:00
1 parent d0acd5fdb0
commit 27ec1e58fc
70 files changed
+394 -438

No files matched your search

@@ -38,7 +38,7 @@ public interface IManaProficiencyArmor {
boolean proficient = false;
for(EquipmentSlotType e: EquipmentSlotType.values()) {
if(e.getSlotType() != EquipmentSlotType.Type.ARMOR)
if(e.getSlotType() != EquipmentSlotType.Group.ARMOR)
continue;
ItemStack armor = player.getItemStackFromSlot(e);
if(!armor.isEmpty()) {
@@ -33,9 +33,9 @@ public class Multiblock {
public final List<MultiblockComponent> components = new ArrayList<>();
public final List<ItemStack> materials = new ArrayList<>();
public BlockPos minPos = BlockPos.ORIGIN;
public BlockPos maxPos = BlockPos.ORIGIN;
public BlockPos offPos = BlockPos.ORIGIN;
public BlockPos minPos = BlockPos.ZERO;
public BlockPos maxPos = BlockPos.ZERO;
public BlockPos offPos = BlockPos.ZERO;
public final HashMap<BlockPos, MultiblockComponent> locationCache = new HashMap<>();
@@ -31,6 +31,7 @@ import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.storage.loot.LootContext;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.registries.ForgeRegistries;
@@ -118,11 +119,9 @@ public class TileEntityGeneratingFlower extends TileEntitySpecialFlower {
int muhBalance = BotaniaAPI.internalHandler.getPassiveFlowerDecay();
if(passive && muhBalance > 0 && passiveDecayTicks > muhBalance) {
BlockState state = getWorld().getBlockState(getPos());
getWorld().playEvent(2001, getPos(), Block.getStateId(state));
getWorld().destroyBlock(getPos(), false);
if(Blocks.DEAD_BUSH.getDefaultState().isValidPosition(getWorld(), getPos()))
getWorld().setBlockState(getPos(), Blocks.DEAD_BUSH.getDefaultState());
else getWorld().removeBlock(getPos());
}
}
@@ -203,7 +202,7 @@ public class TileEntityGeneratingFlower extends TileEntitySpecialFlower {
}
@Override
public List<ItemStack> getDrops(List<ItemStack> list) {
public List<ItemStack> getDrops(List<ItemStack> list, LootContext.Builder ctx) {
List<ItemStack> drops = super.getDrops(list);
populateDropStackNBTs(drops);
return drops;
@@ -39,6 +39,7 @@ import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.storage.loot.LootContext;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.model.data.EmptyModelData;
@@ -247,7 +248,7 @@ public class TileEntitySpecialFlower extends TileEntity implements ITickableTile
/**
* Allows additional processing of sub tile drops
*/
public List<ItemStack> getDrops(List<ItemStack> list) {
public List<ItemStack> getDrops(List<ItemStack> list, LootContext.Builder ctx) {
return list;
}
@@ -41,8 +41,7 @@ public final class AstrolabePreviewHandler {
@SubscribeEvent
public static void onWorldRenderLast(RenderWorldLastEvent event) {
World world = Minecraft.getInstance().world;
List<PlayerEntity> playerEntities = world.playerEntities;
for (PlayerEntity player : playerEntities) {
for (PlayerEntity player : world.getPlayers()) {
ItemStack currentStack = player.getHeldItemMainhand();
if(currentStack.isEmpty() || !(currentStack.getItem() instanceof ItemAstrolabe))
currentStack = player.getHeldItemOffhand();
@@ -13,7 +13,10 @@ package vazkii.botania.client.core.handler;
import net.minecraft.client.Minecraft;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.platform.GLX;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.renderer.entity.IEntityRenderer;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.client.renderer.entity.model.PlayerModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.entity.player.PlayerEntity;
@@ -32,10 +35,14 @@ import vazkii.botania.common.item.ModItems;
import javax.annotation.Nonnull;
import java.util.Map;
public final class BaubleRenderHandler implements LayerRenderer<PlayerEntity> {
public final class BaubleRenderHandler extends LayerRenderer<AbstractClientPlayerEntity, PlayerModel<AbstractClientPlayerEntity>> {
public BaubleRenderHandler(IEntityRenderer<AbstractClientPlayerEntity, PlayerModel<AbstractClientPlayerEntity>> renderer) {
super(renderer);
}
@Override
public void render(@Nonnull PlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
public void render(@Nonnull AbstractClientPlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
dispatchRenders(player, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
// todo 1.13 recheck what this was checking for (make sure to account for config+invis)
@@ -19,6 +19,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.EntityRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@@ -54,8 +56,8 @@ public final class BlockHighlightRenderHandler {
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
boundTile: {
if(Botania.proxy.isClientPlayerWearingMonocle() && pos != null && pos.entity == null) {
BlockPos bPos = pos.getBlockPos();
if(Botania.proxy.isClientPlayerWearingMonocle() && pos != null && pos.getType() == RayTraceResult.Type.BLOCK) {
BlockPos bPos = ((BlockRayTraceResult) pos).getPos();
ItemStack stackHeld = PlayerHelper.getFirstHeldItem(mc.player, ModItems.twigWand);
if(!stackHeld.isEmpty() && ItemTwigWand.getBindMode(stackHeld)) {
@@ -81,7 +83,7 @@ public final class BlockHighlightRenderHandler {
}
double offY = -1.0 / 16 + 0.005;
for(Entity e : mc.world.loadedEntityList)
for(Entity e : mc.world.func_217416_b())
if(e instanceof EntityMagicLandmine) {
BlockPos bpos = e.getPosition();
AxisAlignedBB aabb = new AxisAlignedBB(bpos).offset(0, offY, 0).grow(2.5, 0, 2.5);
@@ -70,7 +70,7 @@ public final class ClientTickHandler {
}
Screen gui = Minecraft.getInstance().currentScreen;
if(gui == null || !gui.doesGuiPauseGame()) {
if(gui == null || !gui.isPauseScreen()) {
ticksInGame++;
partialTicks = 0;
@@ -52,11 +52,11 @@ public class CorporeaInputHandler {
int count = 1;
int max = stack.getMaxStackSize();
if(Screen.isShiftKeyDown()) {
if(Screen.hasShiftDown()) {
count = max;
if(Screen.isCtrlKeyDown())
if(Screen.hasControlDown())
count /= 4;
} else if(Screen.isCtrlKeyDown())
} else if(Screen.hasControlDown())
count = max / 2;
if(count > 0) {
@@ -26,6 +26,7 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.server.ServerLifecycleHooks;
import net.minecraftforge.registries.ForgeRegistries;
import org.lwjgl.opengl.ARBFragmentShader;
import org.lwjgl.opengl.ARBVertexShader;
@@ -64,15 +65,13 @@ public final class DebugHandler {
if (Minecraft.getInstance().isSingleplayer()) {
DimensionType dim = Minecraft.getInstance().world.getDimension().getType();
ResourceLocation dimName = Registry.DIMENSION_TYPE.getKey(dim);
UUID id = Minecraft.getInstance().player.getUniqueID();
Entity ent = Minecraft.getInstance().getIntegratedServer().getWorld(dim).getEntityFromUuid(id);
if (ent != null) {
World serverWorld = ent.world;
event.getLeft().add(PREFIX + String.format("(INTEGRATED SERVER DIM %s) netColl : %d, netPool: %d", dimName, ManaNetworkHandler.instance.getAllCollectorsInWorld(serverWorld).size(), ManaNetworkHandler.instance.getAllPoolsInWorld(serverWorld).size()));
if (ServerLifecycleHooks.getCurrentServer() != null) {
World serverWorld = ServerLifecycleHooks.getCurrentServer().getWorld(dim);
event.getLeft().add(PREFIX + String.format("(INTEGRATED SERVER %s) netColl : %d, netPool: %d", dimName, ManaNetworkHandler.instance.getAllCollectorsInWorld(serverWorld).size(), ManaNetworkHandler.instance.getAllPoolsInWorld(serverWorld).size()));
}
}
if(Screen.isCtrlKeyDown() && Screen.isShiftKeyDown()) {
if(Screen.hasControlDown() && Screen.hasShiftDown()) {
event.getLeft().add(PREFIX + "Config Context");
event.getLeft().add(" shaders.enabled: " + ConfigHandler.CLIENT.useShaders.get());
event.getLeft().add(" shaders.secondaryUnit: " + ConfigHandler.CLIENT.glSecondaryTextureUnit.get());
@@ -82,7 +82,7 @@ public class MiscellaneousIcons {
@SubscribeEvent
public void onModelBake(ModelBakeEvent evt) {
// Floating flowers
FloatingFlowerModel model = new FloatingFlowerModel();
FloatingFlowerModel model = new FloatingFlowerModel(evt.getModelLoader());
evt.getModelRegistry().put(new ModelResourceLocation("botania:mini_island", "normal"), model);
evt.getModelRegistry().put(new ModelResourceLocation("botania:mini_island", "inventory"), model);
evt.getModelRegistry().put(new ModelResourceLocation("botania:floating_special_flower", "normal"), model);
@@ -113,12 +113,12 @@ public class MiscellaneousIcons {
// Mana Blaster
ModelResourceLocation key = new ModelResourceLocation("botania:mana_gun", "inventory");
IBakedModel originalModel = evt.getModelRegistry().get(key);
evt.getModelRegistry().put(key, new GunModel(originalModel));
evt.getModelRegistry().put(key, new GunModel(evt.getModelLoader(), originalModel));
// same as lexicon, reach into all json overrides and wrap them
for (int i = 0; i < originalModel.getOverrides().overrideBakedModels.size(); i++) {
Botania.LOGGER.info("wrapping {}", i);
originalModel.getOverrides().overrideBakedModels.set(i, new GunModel(originalModel.getOverrides().overrideBakedModels.get(i)));
originalModel.getOverrides().overrideBakedModels.set(i, new GunModel(evt.getModelLoader(), originalModel.getOverrides().overrideBakedModels.get(i)));
}
}
@@ -30,7 +30,6 @@ import vazkii.botania.client.render.entity.RenderManaStorm;
import vazkii.botania.client.render.entity.RenderPinkWither;
import vazkii.botania.client.render.entity.RenderPixie;
import vazkii.botania.client.render.entity.RenderPoolMinecart;
import vazkii.botania.client.render.entity.RenderSnowballStack;
import vazkii.botania.client.render.entity.RenderSpark;
import vazkii.botania.client.render.tile.*;
import vazkii.botania.common.block.ModBlocks;
@@ -102,10 +101,9 @@ public final class ModelHandler {
RenderingRegistry.registerEntityRenderingHandler(EntityManaStorm.class, RenderManaStorm::new);
RenderingRegistry.registerEntityRenderingHandler(EntityBabylonWeapon.class, RenderBabylonWeapon::new);
RenderingRegistry.registerEntityRenderingHandler(EntityThornChakram.class, renderManager -> new RenderSnowballStack<>(renderManager, ModItems.thornChakram, Minecraft.getInstance().getItemRenderer(),
entity -> entity.isFire() ? new ItemStack(ModItems.flareChakram) : new ItemStack(ModItems.thornChakram)));
RenderingRegistry.registerEntityRenderingHandler(EntityVineBall.class, renderManager -> new SpriteRenderer<>(renderManager, ModItems.vineBall, Minecraft.getInstance().getItemRenderer()));
RenderingRegistry.registerEntityRenderingHandler(EntityEnderAirBottle.class, renderManager -> new SpriteRenderer<>(renderManager, ModItems.enderAirBottle, Minecraft.getInstance().getItemRenderer()));
RenderingRegistry.registerEntityRenderingHandler(EntityThornChakram.class, renderManager -> new SpriteRenderer<>(renderManager, Minecraft.getInstance().getItemRenderer()));
RenderingRegistry.registerEntityRenderingHandler(EntityVineBall.class, renderManager -> new SpriteRenderer<>(renderManager, Minecraft.getInstance().getItemRenderer()));
RenderingRegistry.registerEntityRenderingHandler(EntityEnderAirBottle.class, renderManager -> new SpriteRenderer<>(renderManager, Minecraft.getInstance().getItemRenderer()));
IMultiblockRenderHook.renderHooks.put(ModBlocks.manaPylon, renderTilePylon);
IMultiblockRenderHook.renderHooks.put(ModBlocks.naturaPylon, renderTilePylon);
@@ -19,6 +19,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.Style;
import net.minecraft.util.text.TranslationTextComponent;
@@ -80,9 +81,9 @@ public final class MultiblockRenderHandler {
}
}
private static void renderPlayerLook(PlayerEntity player, RayTraceResult src) {
private static void renderPlayerLook(PlayerEntity player, BlockRayTraceResult src) {
if(currentMultiblock != null && dimension == player.world.getDimension().getType()) {
BlockPos anchorPos = anchor != null ? anchor : src.getBlockPos();
BlockPos anchorPos = anchor != null ? anchor : src.getPos();
GlStateManager.pushMatrix();
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
@@ -108,7 +108,7 @@ public class RenderLexicon {
pageFlip = pageFlipTicks / 5F;
model.render(null, 0F, 0F, pageFlip, opening, 0F, 1F / 16F);
model.func_217103_a(0F, 0F, pageFlip, opening, 0F, 1F / 16F);
if(ticks < 3) {
FontRenderer font = Minecraft.getInstance().fontRenderer;
GlStateManager.rotatef(180F, 0F, 0F, 1F);
@@ -81,10 +81,10 @@ public final class TooltipAdditionDisplayHandler {
int x = tooltipX - 34;
GlStateManager.disableDepthTest();
AbstractGui.drawRect(x - 4, tooltipY - 4, x + 20, tooltipY + 26, 0x44000000);
AbstractGui.drawRect(x - 6, tooltipY - 6, x + 22, tooltipY + 28, 0x44000000);
AbstractGui.fill(x - 4, tooltipY - 4, x + 20, tooltipY + 26, 0x44000000);
AbstractGui.fill(x - 6, tooltipY - 6, x + 22, tooltipY + 28, 0x44000000);
if(ConfigHandler.CLIENT.useShiftForQuickLookup.get() ? Screen.isShiftKeyDown() : Screen.isCtrlKeyDown()) {
if(ConfigHandler.CLIENT.useShiftForQuickLookup.get() ? Screen.hasShiftDown() : Screen.hasControlDown()) {
lexiconLookupTime += ClientTickHandler.delta;
int cx = x + 8;
@@ -154,10 +154,10 @@ public final class TooltipAdditionDisplayHandler {
float hueOff = (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.01F;
GlStateManager.disableDepthTest();
AbstractGui.drawRect(mouseX - 1, mouseY - height - 1, mouseX + width + 1, mouseY, 0xFF000000);
AbstractGui.fill(mouseX - 1, mouseY - height - 1, mouseX + width + 1, mouseY, 0xFF000000);
for(int i = 0; i < rainbowWidth; i++)
AbstractGui.drawRect(mouseX + i, mouseY - height, mouseX + i + 1, mouseY, Color.HSBtoRGB(hueOff + huePer * i, 1F, 1F));
AbstractGui.drawRect(mouseX + rainbowWidth, mouseY - height, mouseX + width, mouseY, 0xFF555555);
AbstractGui.fill(mouseX + i, mouseY - height, mouseX + i + 1, mouseY, Color.HSBtoRGB(hueOff + huePer * i, 1F, 1F));
AbstractGui.fill(mouseX + rainbowWidth, mouseY - height, mouseX + width, mouseY, 0xFF555555);
String rank = I18n.format("botania.rank" + level).replaceAll("&", "\u00a7");
@@ -178,9 +178,9 @@ public final class TooltipAdditionDisplayHandler {
int manaBarWidth = (int) Math.ceil(width * fraction);
GlStateManager.disableDepthTest();
AbstractGui.drawRect(mouseX - 1, mouseY - height - 1, mouseX + width + 1, mouseY, 0xFF000000);
AbstractGui.drawRect(mouseX, mouseY - height, mouseX + manaBarWidth, mouseY, Color.HSBtoRGB(0.528F, ((float) Math.sin((ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.2) + 1F) * 0.3F + 0.4F, 1F));
AbstractGui.drawRect(mouseX + manaBarWidth, mouseY - height, mouseX + width, mouseY, 0xFF555555);
AbstractGui.fill(mouseX - 1, mouseY - height - 1, mouseX + width + 1, mouseY, 0xFF000000);
AbstractGui.fill(mouseX, mouseY - height, mouseX + manaBarWidth, mouseY, Color.HSBtoRGB(0.528F, ((float) Math.sin((ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.2) + 1F) * 0.3F + 0.4F, 1F));
AbstractGui.fill(mouseX + manaBarWidth, mouseY - height, mouseX + width, mouseY, 0xFF555555);
}
}
@@ -195,7 +195,7 @@ public final class RenderHelper {
Minecraft mc = Minecraft.getInstance();
mc.getItemRenderer().renderItemAndEffectIntoGUI(stack, x, y);
GlStateManager.clear(GL11.GL_DEPTH_BUFFER_BIT);
GlStateManager.clear(GL11.GL_DEPTH_BUFFER_BIT, true);
GL11.glEnable(GL11.GL_STENCIL_TEST);
GlStateManager.colorMask(false, false, false, false);
GlStateManager.depthMask(false);
@@ -244,7 +244,7 @@ public final class RenderHelper {
KeyBinding[] keys = Minecraft.getInstance().gameSettings.keyBindings;
for(KeyBinding otherKey : keys)
if(otherKey.getKeyDescription().equals(keyName)) {
key = otherKey.func_197978_k();
key = otherKey.getLocalizedName();
break;
}
@@ -127,7 +127,7 @@ public final class ShaderHelper {
}
public static boolean useShaders() {
return ConfigHandler.CLIENT.useShaders.get() && GLX.shadersSupported && checkIncompatibleMods();
return ConfigHandler.CLIENT.useShaders.get() && GLX.hasShaders && checkIncompatibleMods();
}
private static boolean checkIncompatibleMods() {
@@ -155,14 +155,14 @@ public class ClientProxy implements IProxy {
render = skinMap.get("default");
render.addLayer(new ContributorFancinessHandler(render));
if(Botania.curiosLoaded)
render.addLayer(new BaubleRenderHandler());
render.addLayer(new BaubleRenderHandler(render));
render.addLayer(new LayerTerraHelmet(render));
render.addLayer(new LayerGaiaHead(render, render.getEntityModel().bipedHead));
render = skinMap.get("slim");
render.addLayer(new ContributorFancinessHandler(render));
if(Botania.curiosLoaded)
render.addLayer(new BaubleRenderHandler());
render.addLayer(new BaubleRenderHandler(render));
render.addLayer(new LayerTerraHelmet(render));
render.addLayer(new LayerGaiaHead(render, render.getEntityModel().bipedHead));
}
@@ -11,7 +11,9 @@
package vazkii.botania.client.fx;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.IParticleRenderType;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.BufferBuilder;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
@@ -26,6 +28,7 @@ import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.core.handler.ConfigHandler;
import javax.annotation.Nonnull;
import java.util.ArrayDeque;
import java.util.Queue;
@@ -116,13 +119,13 @@ public class FXSparkle extends Particle {
}
@Override
public void renderParticle(BufferBuilder worldRendererIn, Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
this.f = f;
this.f1 = f1;
this.f2 = f2;
this.f3 = f3;
this.f4 = f4;
this.f5 = f5;
public void renderParticle(BufferBuilder buffer, ActiveRenderInfo entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
this.f = partialTicks;
this.f1 = rotationX;
this.f2 = rotationZ;
this.f3 = rotationYZ;
this.f4 = rotationXY;
this.f5 = rotationXZ;
if(corrupt)
queuedCorruptRenders.add(this);
@@ -160,6 +163,12 @@ public class FXSparkle extends Particle {
setExpired();
}
@Nonnull
@Override
public IParticleRenderType getRenderType() {
return IParticleRenderType.NO_RENDER;
}
public void setGravity(float value) {
particleGravity = value;
}
@@ -11,7 +11,9 @@
package vazkii.botania.client.fx;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.IParticleRenderType;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.BufferBuilder;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
@@ -23,6 +25,7 @@ import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.core.handler.ConfigHandler;
import javax.annotation.Nonnull;
import java.util.ArrayDeque;
import java.util.Queue;
@@ -64,7 +67,7 @@ public class FXWisp extends Particle {
if (!Minecraft.getInstance().gameSettings.fancyGraphics)
visibleDistance = 25;
if (renderentity == null || renderentity.getDistance(posX, posY, posZ) > visibleDistance)
if (renderentity == null || renderentity.getDistanceSq(posX, posY, posZ) > visibleDistance * visibleDistance)
maxAge = 0;
}
@@ -125,19 +128,25 @@ public class FXWisp extends Particle {
}
@Override
public void renderParticle(BufferBuilder wr, Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
this.f = f;
this.f1 = f1;
this.f2 = f2;
this.f3 = f3;
this.f4 = f4;
this.f5 = f5;
public void renderParticle(BufferBuilder buffer, ActiveRenderInfo entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
this.f = partialTicks;
this.f1 = rotationX;
this.f2 = rotationZ;
this.f3 = rotationYZ;
this.f4 = rotationXY;
this.f5 = rotationXZ;
if(depthTest)
queuedRenders.add(this);
else queuedDepthIgnoringRenders.add(this);
}
@Nonnull
@Override
public IParticleRenderType getRenderType() {
return IParticleRenderType.NO_RENDER;
}
// [VanillaCopy] of super, without drag when onGround is true
@Override
public void tick() {
@@ -16,6 +16,7 @@ import net.minecraft.client.gui.screen.Screen;
public class GuiBotaniaConfig extends /*GuiConfig*/ Screen {
public GuiBotaniaConfig(Screen parentScreen) {
super(parentScreen.getTitle());
// super(parentScreen, new ConfigElement(ConfigHandler.config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), LibMisc.MOD_ID, false, false, GuiConfig.getAbridgedConfigPath(ConfigHandler.config.toString()));
}
@@ -15,24 +15,37 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.inventory.container.Slot;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.Hand;
import net.minecraftforge.items.SlotItemHandler;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.client.gui.SlotLocked;
import vazkii.botania.common.block.BlockModFlower;
import vazkii.botania.common.lib.LibItemNames;
import javax.annotation.Nonnull;
public class ContainerFlowerBag extends Container {
@ObjectHolder("botania:" + LibItemNames.FLOWER_BAG)
public static ContainerType<ContainerFlowerBag> TYPE;
public static ContainerFlowerBag fromNetwork(int windowId, PlayerInventory inv, PacketBuffer buf) {
Hand hand = buf.readBoolean() ? Hand.MAIN_HAND : Hand.OFF_HAND;
return new ContainerFlowerBag(windowId, inv, inv.player.getHeldItem(hand));
}
private final InventoryFlowerBag flowerBagInv;
public ContainerFlowerBag(PlayerInventory playerInv, InventoryFlowerBag flowerBagInv) {
public ContainerFlowerBag(int windowId, PlayerInventory playerInv, ItemStack bag) {
super(TYPE, windowId);
int i;
int j;
this.flowerBagInv = flowerBagInv;
this.flowerBagInv = new InventoryFlowerBag(bag);
for(i = 0; i < 2; ++i)
for(j = 0; j < 8; ++j) {
@@ -23,18 +23,19 @@ import net.minecraft.item.DyeColor;
import net.minecraft.item.DyeColor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.items.SlotItemHandler;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.block.ModBlocks;
import java.util.List;
public class GuiFlowerBag extends ContainerScreen {
public class GuiFlowerBag extends ContainerScreen<ContainerFlowerBag> {
private static final ResourceLocation texture = new ResourceLocation(LibResources.GUI_FLOWER_BAG);
public GuiFlowerBag(PlayerInventory playerInv, InventoryFlowerBag flowerBagInv) {
super(new ContainerFlowerBag(playerInv, flowerBagInv));
public GuiFlowerBag(ContainerFlowerBag container, PlayerInventory playerInv, ITextComponent title) {
super(container, playerInv, title);
}
@Override
@@ -11,33 +11,46 @@
package vazkii.botania.client.gui.box;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.inventory.container.Slot;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.Hand;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.SlotItemHandler;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.mana.IManaItem;
import vazkii.botania.client.gui.SlotLocked;
import vazkii.botania.common.lib.LibItemNames;
import javax.annotation.Nonnull;
import java.util.List;
public class ContainerBaubleBox extends Container {
@ObjectHolder("botania:" + LibItemNames.BAUBLE_BOX)
public static ContainerType<ContainerBaubleBox> TYPE;
public static ContainerBaubleBox fromNetwork(int windowId, PlayerInventory inv, PacketBuffer buf) {
Hand hand = buf.readBoolean() ? Hand.MAIN_HAND : Hand.OFF_HAND;
return new ContainerBaubleBox(windowId, inv, inv.player.getHeldItem(hand));
}
private final InventoryBaubleBox baubleBoxInv;
public IItemHandlerModifiable baubles;
public ContainerBaubleBox(PlayerEntity player, InventoryBaubleBox boxInv) {
public ContainerBaubleBox(int windowId, PlayerInventory playerInv, ItemStack box) {
super(TYPE, windowId);
int i;
int j;
IInventory playerInv = player.inventory;
baubleBoxInv = boxInv;
baubleBoxInv = new InventoryBaubleBox(box);
/* todo 1.13
baubles = BaublesApi.getBaublesHandler(player);
@@ -10,26 +10,29 @@
*/
package vazkii.botania.client.gui.box;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Slot;
import net.minecraft.inventory.container.Slot;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import vazkii.botania.client.lib.LibResources;
public class GuiBaubleBox extends ContainerScreen {
public class GuiBaubleBox extends ContainerScreen<ContainerBaubleBox> {
private static final ResourceLocation texture = new ResourceLocation(LibResources.GUI_BAUBLE_BOX);
public GuiBaubleBox(PlayerEntity player, InventoryBaubleBox box) {
super(new ContainerBaubleBox(player, box));
public GuiBaubleBox(ContainerBaubleBox container, PlayerInventory player, ITextComponent title) {
super(container, player, title);
}
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
this.drawDefaultBackground();
this.renderBackground();
super.render(mouseX, mouseY, partialTicks);
this.renderHoveredToolTip(mouseX, mouseY);
}
@@ -37,13 +40,13 @@ public class GuiBaubleBox extends ContainerScreen {
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
Minecraft.getInstance().getTextureManager().bindTexture(texture);
blit(guiLeft, guiTop, 0, 0, xSize, ySize);
for(int i1 = 0; i1 < 7; ++i1) {
Slot slot = inventorySlots.inventorySlots.get(i1);
Slot slot = container.inventorySlots.get(i1);
if(slot.getHasStack() && slot.getSlotStackLimit() == 1)
drawTexturedModalRect(guiLeft+slot.xPos, guiTop+slot.yPos, 200, 0, 16, 16);
blit(guiLeft+slot.xPos, guiTop+slot.yPos, 200, 0, 16, 16);
}
}
@@ -36,7 +36,7 @@ public class GuiButtonBookmark extends GuiButtonLexicon {
modified = true;
}
} else {
if(Screen.isShiftKeyDown()) {
if(Screen.hasShiftDown()) {
GuiLexicon.bookmarks.remove(i);
GuiLexicon.bookmarkKeys.remove(i);
@@ -41,7 +41,7 @@ public class GuiButtonChallenges extends GuiButtonLexicon {
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
GlStateManager.color4f(1F, 1F, 1F, 1F);
drawTexturedModalRect(x, y, k == 2 ? 131 : 120, 180, 11, 11);
blit(x, y, k == 2 ? 131 : 120, 180, 11, 11);
List<String> tooltip = new ArrayList<>();
tooltip.add(TextFormatting.GREEN + I18n.format("botaniamisc.challenges"));
@@ -37,7 +37,7 @@ public class GuiButtonUpdateWarning extends GuiButtonLexicon {
@Override
public void onClick(double mouseX, double mouseY) {
super.onClick(mouseX, mouseY);
if(Screen.isShiftKeyDown()) {
if(Screen.hasShiftDown()) {
try {
if(Desktop.isDesktopSupported())
Desktop.getDesktop().browse(new URI("http://botaniamod.net/changelog.php#" + PersistentVariableHelper.lastBotaniaVersion.replaceAll("\\.|\\s", "-")));
@@ -64,7 +64,7 @@ public class GuiButtonUpdateWarning extends GuiButtonLexicon {
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
GlStateManager.color4f(1F, 1F, 1F, 1F);
drawTexturedModalRect(x, y, red ? 153 : 142, 180, 11, 11);
blit(x, y, red ? 153 : 142, 180, 11, 11);
List<String> tooltip = new ArrayList<>();
String version = PersistentVariableHelper.lastBotaniaVersion;
@@ -10,6 +10,7 @@ import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.model.ModelBakery;
import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
@@ -20,6 +21,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction;
import net.minecraft.world.World;
import net.minecraftforge.client.model.BasicState;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
@@ -44,9 +46,11 @@ import java.util.stream.Collectors;
public class GunModel implements IBakedModel {
private final ModelBakery bakery;
private final IBakedModel originalModel;
public GunModel(IBakedModel originalModel) {
public GunModel(ModelBakery bakery, IBakedModel originalModel) {
this.bakery = bakery;
this.originalModel = Preconditions.checkNotNull(originalModel);
}
@@ -90,7 +94,7 @@ public class GunModel implements IBakedModel {
private final IdentityHashMap<IUnbakedModel, CompositeBakedModel> cache = new IdentityHashMap<>();
private CompositeBakedModel getModel(IUnbakedModel lens) {
return cache.computeIfAbsent(lens, l -> new CompositeBakedModel(l, originalModel));
return cache.computeIfAbsent(lens, l -> new CompositeBakedModel(bakery, l, originalModel));
}
private static class CompositeBakedModel implements IBakedModel {
@@ -99,11 +103,11 @@ public class GunModel implements IBakedModel {
private final List<BakedQuad> genQuads = new ArrayList<>();
private final Map<Direction, List<BakedQuad>> faceQuads = new EnumMap<>(Direction.class);
CompositeBakedModel(IUnbakedModel lensUnbaked, IBakedModel gun) {
CompositeBakedModel(ModelBakery bakery, IUnbakedModel lensUnbaked, IBakedModel gun) {
this.gun = gun;
final TRSRTransformation transform = new TRSRTransformation(new Vector3f(-0.2F, 0.4F, 0.8F), TRSRTransformation.quatFromXYZ(0, (float) Math.PI / 2, 0), new Vector3f(0.625F, 0.625F, 0.625F), null);
IBakedModel lens = lensUnbaked.bake(ModelLoader.defaultModelGetter(), ModelLoader.defaultTextureGetter(), transform, false, DefaultVertexFormats.ITEM);
IBakedModel lens = lensUnbaked.bake(bakery, ModelLoader.defaultTextureGetter(), new BasicState(transform, false), DefaultVertexFormats.ITEM);
for(Direction e : Direction.values())
faceQuads.put(e, new ArrayList<>());
@@ -5,6 +5,7 @@ import net.minecraft.client.renderer.entity.model.BipedModel;
import net.minecraft.client.renderer.entity.model.RendererModel;
import net.minecraft.client.renderer.entity.model.RendererModel;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.inventory.EquipmentSlotType;
@@ -16,38 +17,38 @@ public class ModelArmor extends BipedModel {
this.slot = slot;
}
// [VanillaCopy] ModelArmorStandArmor.setRotationAngles because armor stands are dumb
// [VanillaCopy] ArmorStandArmorModel.setRotationAngles because armor stands are dumb
// This fixes the armor "breathing" and helmets always facing south on armor stands
@Override
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
{
if (entityIn instanceof ArmorStandEntity)
{
ArmorStandEntity entityarmorstand = (ArmorStandEntity)entityIn;
this.bipedHead.rotateAngleX = 0.017453292F * entityarmorstand.getHeadRotation().getX();
this.bipedHead.rotateAngleY = 0.017453292F * entityarmorstand.getHeadRotation().getY();
this.bipedHead.rotateAngleZ = 0.017453292F * entityarmorstand.getHeadRotation().getZ();
this.bipedHead.setRotationPoint(0.0F, 1.0F, 0.0F);
this.bipedBody.rotateAngleX = 0.017453292F * entityarmorstand.getBodyRotation().getX();
this.bipedBody.rotateAngleY = 0.017453292F * entityarmorstand.getBodyRotation().getY();
this.bipedBody.rotateAngleZ = 0.017453292F * entityarmorstand.getBodyRotation().getZ();
this.bipedLeftArm.rotateAngleX = 0.017453292F * entityarmorstand.getLeftArmRotation().getX();
this.bipedLeftArm.rotateAngleY = 0.017453292F * entityarmorstand.getLeftArmRotation().getY();
this.bipedLeftArm.rotateAngleZ = 0.017453292F * entityarmorstand.getLeftArmRotation().getZ();
this.bipedRightArm.rotateAngleX = 0.017453292F * entityarmorstand.getRightArmRotation().getX();
this.bipedRightArm.rotateAngleY = 0.017453292F * entityarmorstand.getRightArmRotation().getY();
this.bipedRightArm.rotateAngleZ = 0.017453292F * entityarmorstand.getRightArmRotation().getZ();
this.bipedLeftLeg.rotateAngleX = 0.017453292F * entityarmorstand.getLeftLegRotation().getX();
this.bipedLeftLeg.rotateAngleY = 0.017453292F * entityarmorstand.getLeftLegRotation().getY();
this.bipedLeftLeg.rotateAngleZ = 0.017453292F * entityarmorstand.getLeftLegRotation().getZ();
this.bipedLeftLeg.setRotationPoint(1.9F, 11.0F, 0.0F);
this.bipedRightLeg.rotateAngleX = 0.017453292F * entityarmorstand.getRightLegRotation().getX();
this.bipedRightLeg.rotateAngleY = 0.017453292F * entityarmorstand.getRightLegRotation().getY();
this.bipedRightLeg.rotateAngleZ = 0.017453292F * entityarmorstand.getRightLegRotation().getZ();
this.bipedRightLeg.setRotationPoint(-1.9F, 11.0F, 0.0F);
copyModelAngles(this.bipedHead, this.bipedHeadwear);
} else super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
// Botania - defer to super if not an armor stand
public void setRotationAngles(LivingEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor) {
if (!(entity instanceof ArmorStandEntity)) {
super.setRotationAngles(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor);
return;
}
ArmorStandEntity entityIn = (ArmorStandEntity) entity;
this.bipedHead.rotateAngleX = ((float)Math.PI / 180F) * entityIn.getHeadRotation().getX();
this.bipedHead.rotateAngleY = ((float)Math.PI / 180F) * entityIn.getHeadRotation().getY();
this.bipedHead.rotateAngleZ = ((float)Math.PI / 180F) * entityIn.getHeadRotation().getZ();
this.bipedHead.setRotationPoint(0.0F, 1.0F, 0.0F);
this.bipedBody.rotateAngleX = ((float)Math.PI / 180F) * entityIn.getBodyRotation().getX();
this.bipedBody.rotateAngleY = ((float)Math.PI / 180F) * entityIn.getBodyRotation().getY();
this.bipedBody.rotateAngleZ = ((float)Math.PI / 180F) * entityIn.getBodyRotation().getZ();
this.bipedLeftArm.rotateAngleX = ((float)Math.PI / 180F) * entityIn.getLeftArmRotation().getX();
this.bipedLeftArm.rotateAngleY = ((float)Math.PI / 180F) * entityIn.getLeftArmRotation().getY();
this.bipedLeftArm.rotateAngleZ = ((float)Math.PI / 180F) * entityIn.getLeftArmRotation().getZ();
this.bipedRightArm.rotateAngleX = ((float)Math.PI / 180F) * entityIn.getRightArmRotation().getX();
this.bipedRightArm.rotateAngleY = ((float)Math.PI / 180F) * entityIn.getRightArmRotation().getY();
this.bipedRightArm.rotateAngleZ = ((float)Math.PI / 180F) * entityIn.getRightArmRotation().getZ();
this.bipedLeftLeg.rotateAngleX = ((float)Math.PI / 180F) * entityIn.getLeftLegRotation().getX();
this.bipedLeftLeg.rotateAngleY = ((float)Math.PI / 180F) * entityIn.getLeftLegRotation().getY();
this.bipedLeftLeg.rotateAngleZ = ((float)Math.PI / 180F) * entityIn.getLeftLegRotation().getZ();
this.bipedLeftLeg.setRotationPoint(1.9F, 11.0F, 0.0F);
this.bipedRightLeg.rotateAngleX = ((float)Math.PI / 180F) * entityIn.getRightLegRotation().getX();
this.bipedRightLeg.rotateAngleY = ((float)Math.PI / 180F) * entityIn.getRightLegRotation().getY();
this.bipedRightLeg.rotateAngleZ = ((float)Math.PI / 180F) * entityIn.getRightLegRotation().getZ();
this.bipedRightLeg.setRotationPoint(-1.9F, 11.0F, 0.0F);
this.bipedHeadwear.copyModelAngles(this.bipedHead);
}
protected void setRotateAngle(RendererModel modelRenderer, float x, float y, float z) {
@@ -1,38 +0,0 @@
/**
* This class was created by <williewillus>. 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
*/
package vazkii.botania.client.render.entity;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.entity.SpriteRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
import java.util.function.Function;
// Same as RenderSnowball, but ItemStack sensitive
public class RenderSnowballStack<T extends Entity> extends SpriteRenderer<T> {
private final Function<T, ItemStack> stackGetter;
public RenderSnowballStack(EntityRendererManager renderManagerIn, Item item, ItemRenderer render, Function<T, ItemStack> stackGetter) {
super(renderManagerIn, item, render);
this.stackGetter = stackGetter;
}
@Nonnull
@Override
public ItemStack getStackToRender(T entity) {
return stackGetter.apply(entity);
}
}
@@ -31,7 +31,7 @@ public class RenderTileAlfPortal extends TileEntityRenderer<TileAlfPortal> {
@Override
public void render(@Nonnull TileAlfPortal portal, double d0, double d1, double d2, float f, int digProgress) {
if (!portal.getWorld().isBlockLoaded(portal.getPos(), false)
if (!portal.getWorld().isBlockLoaded(portal.getPos())
|| portal.getWorld().getBlockState(portal.getPos()).getBlock() != ModBlocks.alfPortal)
return;
@@ -53,7 +53,7 @@ public class RenderTileEnchanter extends TileEntityRenderer<TileEnchanter> {
GlStateManager.color4f(1F, 1F, 1F, 1F);
GlStateManager.translatef(0.5F, 1.25F, 0.5F);
((EntityRenderer) Minecraft.getInstance().getRenderManager().entityRenderMap.get(ItemEntity.class)).doRender(item, d0, d1, d2, 1F, f);
((EntityRenderer) Minecraft.getInstance().getRenderManager().renderers.get(ItemEntity.class)).doRender(item, d0, d1, d2, 1F, f);
GlStateManager.translatef(-0.5F, -1.25F, -0.5F);
}
@@ -45,7 +45,7 @@ public class RenderTilePool extends TileEntityRenderer<TilePool> {
@Override
public void render(@Nullable TilePool pool, double d0, double d1, double d2, float f, int digProgress) {
if(pool != null && (!pool.getWorld().isBlockLoaded(pool.getPos(), false)
if(pool != null && (!pool.getWorld().isBlockLoaded(pool.getPos())
|| !(pool.getBlockState().getBlock() instanceof BlockPool)))
return;
@@ -59,7 +59,7 @@ public class RenderTilePylon extends TileEntityRenderer<TilePylon> implements IM
@Override
public void render(@Nonnull TilePylon pylon, double d0, double d1, double d2, float pticks, int digProgress) {
if(!pylon.getWorld().isBlockLoaded(pylon.getPos(), false) || !(pylon.getBlockState().getBlock() instanceof BlockPylon))
if(!pylon.getWorld().isBlockLoaded(pylon.getPos()) || !(pylon.getBlockState().getBlock() instanceof BlockPylon))
return;
renderPylon(pylon, d0, d1, d2, pticks);
@@ -52,7 +52,7 @@ public class SkyblockSkyRenderer implements IRenderHandler {
// Begin
GlStateManager.disableTexture();
Vec3d vec3d = world.getSkyColor(mc.getRenderViewEntity(), partialTicks);
Vec3d vec3d = world.func_217382_a(mc.gameRenderer.getActiveRenderInfo().getBlockPos(), partialTicks);
float f = (float)vec3d.x;
float f1 = (float)vec3d.y;
float f2 = (float)vec3d.z;
@@ -23,10 +23,13 @@ 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.storage.loot.LootContext;
import net.minecraft.world.storage.loot.LootParameters;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.block.tile.TileCacophonium;
import javax.annotation.Nonnull;
import java.util.List;
public class BlockCacophonium extends BlockMod {
@@ -46,7 +49,7 @@ public class BlockCacophonium extends BlockMod {
}
@Override
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) {
boolean power = world.getRedstonePowerFromNeighbors(pos) > 0 || world.getRedstonePowerFromNeighbors(pos.up()) > 0;
boolean powered = state.get(BotaniaStateProps.POWERED);
@@ -59,34 +62,17 @@ public class BlockCacophonium extends BlockMod {
world.setBlockState(pos, state.with(BotaniaStateProps.POWERED, false), 4);
}
@Nonnull
@Override
public boolean removedByPlayer(@Nonnull BlockState state, World world, @Nonnull BlockPos pos, @Nonnull PlayerEntity player, boolean willHarvest, IFluidState fluid) {
if (willHarvest) {
// Copy of super.removedByPlayer but don't set to air yet
// This is so getDrops below will have a TE to work with
onBlockHarvested(world, pos, state, player);
return true;
} else {
return super.removedByPlayer(state, world, pos, player, willHarvest, fluid);
}
}
@Override
public void harvestBlock(@Nonnull World world, PlayerEntity player, @Nonnull BlockPos pos, @Nonnull BlockState state, TileEntity te, ItemStack stack) {
super.harvestBlock(world, player, pos, state, te, stack);
// Now delete the block and TE
world.removeBlock(pos);
}
@Override
public void getDrops(@Nonnull BlockState state, NonNullList<ItemStack> stacks, World world, BlockPos pos, int fortune) {
TileEntity tile = world.getTileEntity(pos);
if(tile != null && tile instanceof TileCacophonium) {
stacks.add(new ItemStack(Blocks.NOTE_BLOCK));
ItemStack thingy = ((TileCacophonium) tile).stack;
public List<ItemStack> getDrops(@Nonnull BlockState state, @Nonnull LootContext.Builder builder) {
List<ItemStack> stacks = super.getDrops(state, builder);
TileEntity te = builder.get(LootParameters.BLOCK_ENTITY);
if(te instanceof TileCacophonium) {
ItemStack thingy = ((TileCacophonium) te).stack;
if(!thingy.isEmpty())
stacks.add(thingy.copy());
}
return stacks;
}
@Override
@@ -33,6 +33,8 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.IEnviromentBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.world.storage.loot.LootContext;
import net.minecraft.world.storage.loot.LootParameters;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import vazkii.botania.api.lexicon.ILexiconable;
@@ -45,6 +47,7 @@ import vazkii.botania.common.block.decor.BlockFloatingFlower;
import vazkii.botania.common.core.handler.ConfigHandler;
import javax.annotation.Nonnull;
import java.util.List;
import java.util.Random;
import java.util.function.Supplier;
@@ -96,32 +99,16 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
((TileEntitySpecialFlower) world.getTileEntity(pos)).onBlockHarvested(world, pos, state, player);
}
@Nonnull
@Override
public boolean removedByPlayer(@Nonnull BlockState state, World world, @Nonnull BlockPos pos, @Nonnull PlayerEntity player, boolean willHarvest, IFluidState fluid) {
if (willHarvest) {
// Copy of super.removedByPlayer but don't set to air yet
// This is so getDrops below will have a TE to work with
onBlockHarvested(world, pos, state, player);
return true;
public List<ItemStack> getDrops(@Nonnull BlockState state, @Nonnull LootContext.Builder builder) {
List<ItemStack> drops = super.getDrops(state, builder);
TileEntity te = builder.get(LootParameters.BLOCK_ENTITY);
if(te instanceof TileEntitySpecialFlower) {
return ((TileEntitySpecialFlower) te).getDrops(drops, builder);
} else {
return super.removedByPlayer(state, world, pos, player, willHarvest, fluid);
}
}
@Override
public void harvestBlock(@Nonnull World world, PlayerEntity player, @Nonnull BlockPos pos, @Nonnull BlockState state, TileEntity te, ItemStack stack) {
super.harvestBlock(world, player, pos, state, te, stack);
// Now delete the block and TE
world.removeBlock(pos);
}
@Override
public void getDrops(@Nonnull BlockState state, NonNullList<ItemStack> list, World world, BlockPos pos, int fortune) {
super.getDrops(state, list, world, pos, fortune);
TileEntity tile = world.getTileEntity(pos);
if(tile != null) {
((TileEntitySpecialFlower) tile).getDrops(list);
return drops;
}
}
@@ -109,11 +109,6 @@ public class BlockIncensePlate extends BlockMod implements ILexiconable {
}
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
@@ -28,6 +28,8 @@ import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraft.world.storage.loot.LootContext;
import net.minecraft.world.storage.loot.LootParameters;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
@@ -41,6 +43,8 @@ import vazkii.botania.common.lexicon.LexiconData;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.List;
public class BlockPool extends BlockMod implements IWandHUD, IWandable, ILexiconable {
private static final VoxelShape SLAB = makeCuboidShape(0, 0, 0, 16, 8, 16);
@@ -67,29 +71,16 @@ public class BlockPool extends BlockMod implements IWandHUD, IWandable, ILexicon
return REAL_SHAPE;
}
// If harvesting, delay setting block to air so getDrops can read the TE
@Override
public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, IFluidState fluid) {
if (willHarvest)
return true;
return super.removedByPlayer(state, world, pos, player, willHarvest, fluid);
}
@Override
public void getDrops(BlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
TileEntity te = world.getTileEntity(pos);
if (te instanceof TilePool && !((TilePool) te).fragile) {
super.getDrops(state, drops, world, pos, fortune);
public List<ItemStack> getDrops(@Nonnull BlockState state, LootContext.Builder builder) {
if (builder.get(LootParameters.BLOCK_ENTITY) instanceof TilePool
&& ((TilePool) builder.get(LootParameters.BLOCK_ENTITY)).fragile) {
return Collections.emptyList();
} else {
return super.getDrops(state, builder);
}
}
// After getDrops reads the TE, then delete the block
@Override
public void harvestBlock(World world, PlayerEntity player, BlockPos pos, BlockState state, @Nullable TileEntity te, ItemStack tool) {
super.harvestBlock(world, player, pos, state, te, tool);
world.removeBlock(pos);
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
@@ -110,11 +101,6 @@ public class BlockPool extends BlockMod implements IWandHUD, IWandable, ILexicon
}
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Nonnull
@Override
public BlockRenderType getRenderType(BlockState state) {
@@ -84,7 +84,7 @@ public class BergamuteEventHandler {
@Nonnull @Override public Sound getSound() { return compose.getSound(); }
@Nonnull @Override public SoundCategory getCategory() { return compose.getCategory(); }
@Override public boolean canRepeat() { return compose.canRepeat(); }
@Override public boolean func_217861_m() { return compose.func_217861_m(); }
@Override public boolean isGlobal() { return compose.isGlobal(); }
@Override public int getRepeatDelay() { return compose.getRepeatDelay(); }
@Override public float getPitch() { return compose.getPitch(); }
@Override public float getX() { return compose.getX(); }
@@ -17,6 +17,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.AbstractFurnaceTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.FurnaceTileEntity;
import net.minecraft.tileentity.TileEntityType;
@@ -62,14 +63,14 @@ public class SubTileExoflame extends TileEntityFunctionalFlower {
FurnaceTileEntity furnace = (FurnaceTileEntity) tile;
boolean canSmelt = canFurnaceSmelt(furnace);
if(canSmelt && mana > 2) {
if(furnace.getField(0) < 2) { // Field 0 -> Burn time
if(furnace.getField(0) == 0)
if(furnace.burnTime < 2) {
if(furnace.burnTime == 0)
getWorld().setBlockState(pos, state.with(BlockStateProperties.LIT, true));
furnace.setField(0, 200);
furnace.burnTime = 200;
mana = Math.max(0, mana - COST);
}
if(ticksExisted % 2 == 0)
furnace.setField(2, Math.min(199, furnace.getField(2) + 1)); // Field 2 -> cook time
furnace.cookTime = Math.min(199, furnace.cookTime + 1);
did = true;
@@ -99,7 +100,7 @@ public class SubTileExoflame extends TileEntityFunctionalFlower {
sync();
}
public static boolean canFurnaceSmelt(FurnaceTileEntity furnace){
public static boolean canFurnaceSmelt(AbstractFurnaceTileEntity furnace){
if(furnace.getStackInSlot(0).isEmpty())
return false;
else {
@@ -187,7 +187,7 @@ public class SubTileHopperhock extends TileEntityFunctionalFlower {
AxisAlignedBB aabb = new AxisAlignedBB(pos.offset(dir));
List<ItemFrameEntity> frames = getWorld().getEntitiesWithinAABB(ItemFrameEntity.class, aabb);
for(ItemFrameEntity frame : frames) {
if(frame.facingDirection == dir)
if(frame.getHorizontalFacing() == dir)
filter.add(frame.getDisplayedItem());
}
}
@@ -21,6 +21,7 @@ import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.storage.loot.LootContext;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.RadiusDescriptor;
@@ -132,7 +133,7 @@ public class SubTileMunchdew extends TileEntityGeneratingFlower {
}
@Override
public List<ItemStack> getDrops(List<ItemStack> list) {
public List<ItemStack> getDrops(List<ItemStack> list, LootContext.Builder ctx) {
List<ItemStack> drops = super.getDrops(list);
if(cooldown > 0)
ItemNBTHelper.setInt(drops.get(0), TAG_COOLDOWN, cooldown);
@@ -65,7 +65,7 @@ public class TileCorporeaFunnel extends TileCorporeaBase implements ICorporeaReq
for(Direction dir : MathHelper.HORIZONTALS) {
List<ItemFrameEntity> frames = world.getEntitiesWithinAABB(ItemFrameEntity.class, new AxisAlignedBB(pos.offset(dir), pos.offset(dir).add(1, 1, 1)));
for(ItemFrameEntity frame : frames) {
Direction orientation = frame.facingDirection;
Direction orientation = frame.getHorizontalFacing();
if(orientation == dir) {
ItemStack stack = frame.getDisplayedItem();
if(!stack.isEmpty()) {
@@ -85,7 +85,7 @@ public class TileCorporeaInterceptor extends TileCorporeaBase implements ICorpor
for(Direction dir : Direction.values()) {
List<ItemFrameEntity> frames = world.getEntitiesWithinAABB(ItemFrameEntity.class, new AxisAlignedBB(pos.offset(dir), pos.offset(dir).add(1, 1, 1)));
for(ItemFrameEntity frame : frames) {
Direction orientation = frame.facingDirection;
Direction orientation = frame.getHorizontalFacing();
if(orientation == dir)
filter.add(frame.getDisplayedItem());
}
@@ -15,6 +15,7 @@ import net.minecraft.block.FurnaceBlock;
import net.minecraft.block.Blocks;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.AbstractFurnaceTileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.SoundEvents;
import net.minecraft.nbt.CompoundNBT;
@@ -74,14 +75,15 @@ public class TileBellows extends TileMod implements ITickableTileEntity {
if(moving == 0F)
world.playSound(null, pos, ModSounds.bellows, SoundCategory.BLOCKS, 0.1F, 3F);
if(tile instanceof FurnaceTileEntity) {
FurnaceTileEntity furnace = (FurnaceTileEntity) tile;
if(tile instanceof AbstractFurnaceTileEntity) {
AbstractFurnaceTileEntity furnace = (AbstractFurnaceTileEntity) tile;
if(SubTileExoflame.canFurnaceSmelt(furnace)) {
furnace.setField(2, Math.min(199, furnace.getField(2) + 20)); // cookTime
furnace.setField(0, Math.max(0, furnace.getField(0) - 10)); // burnTime
furnace.cookTime = Math.min(199, furnace.cookTime + 20);
furnace.burnTime = Math.max(0, furnace.burnTime - 10);
}
if(furnace.hasWorld() && furnace.getBlockState().get(FurnaceBlock.LIT)) {
if(furnace instanceof FurnaceTileEntity
&& furnace.hasWorld() && furnace.getBlockState().get(FurnaceBlock.LIT)) {
// [VanillaCopy] BlockFurnace
double d0 = (double)pos.getX() + 0.5D;
double d1 = (double)pos.getY();
@@ -14,6 +14,7 @@ import net.minecraft.block.Block;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
@@ -55,7 +56,7 @@ public class ServerProxy implements IProxy {
}
@Override
public boolean openWikiPage(World world, Block block, RayTraceResult pos) {
public boolean openWikiPage(World world, Block block, BlockRayTraceResult pos) {
return false;
}
@@ -14,15 +14,18 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.pattern.BlockStateMatcher;
import net.minecraft.entity.IRendersAsItem;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.EntityRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
@@ -31,7 +34,7 @@ import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
public class EntityEnderAirBottle extends ThrowableEntity {
public class EntityEnderAirBottle extends ThrowableEntity implements IRendersAsItem {
@ObjectHolder(LibMisc.MOD_ID + ":ender_air_bottle")
public static EntityType<EntityEnderAirBottle> TYPE;
@@ -78,4 +81,10 @@ public class EntityEnderAirBottle extends ThrowableEntity {
@Override
protected void registerData() {}
@Nonnull
@Override
public ItemStack getItem() {
return new ItemStack(ModItems.enderAirBottle);
}
}
@@ -15,6 +15,7 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.IPacket;
import net.minecraft.util.SoundEvents;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.DamageSource;
@@ -22,6 +23,7 @@ import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.fml.network.NetworkHooks;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.helper.MathHelper;
@@ -111,4 +113,10 @@ public class EntityFlameRing extends Entity {
@Override
protected void writeAdditional(@Nonnull CompoundNBT var1) {}
@Nonnull
@Override
public IPacket<?> createSpawnPacket() {
return NetworkHooks.getEntitySpawningPacket(this);
}
}
@@ -41,10 +41,12 @@ public class EntityPinkWither extends WitherEntity {
public EntityPinkWither(World world) {
super(TYPE, world);
tasks.taskEntries.removeIf(entry -> entry.action instanceof RangedAttackGoal); // Remove firing wither skulls
// Remove firing wither skulls
goalSelector.goals.removeIf(entry -> entry.func_220772_j() instanceof RangedAttackGoal);
targetTasks.taskEntries.removeIf(entry -> entry.action instanceof HurtByTargetGoal
|| entry.action instanceof NearestAttackableTargetGoal); // Remove revenge and aggro
// Remove revenge and aggro
targetSelector.goals.removeIf(entry -> entry.func_220772_j() instanceof HurtByTargetGoal
|| entry.func_220772_j() instanceof NearestAttackableTargetGoal);
}
@Override
@@ -14,6 +14,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.BushBlock;
import net.minecraft.block.LeavesBlock;
import net.minecraft.entity.Entity;
import net.minecraft.entity.IRendersAsItem;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.item.ItemEntity;
@@ -41,7 +42,7 @@ import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
public class EntityThornChakram extends ThrowableEntity {
public class EntityThornChakram extends ThrowableEntity implements IRendersAsItem {
@ObjectHolder(LibMisc.MOD_ID + ":thorn_chakram")
public static EntityType<EntityThornChakram> TYPE;
@@ -230,4 +231,9 @@ public class EntityThornChakram extends ThrowableEntity {
setFire(compound.getBoolean("flare"));
}
@Nonnull
@Override
public ItemStack getItem() {
return stack;
}
}
@@ -14,6 +14,7 @@ import com.google.common.collect.ImmutableMap;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.VineBlock;
import net.minecraft.entity.IRendersAsItem;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.projectile.ThrowableEntity;
@@ -40,7 +41,7 @@ import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
import java.util.Map;
public class EntityVineBall extends ThrowableEntity {
public class EntityVineBall extends ThrowableEntity implements IRendersAsItem {
@ObjectHolder(LibMisc.MOD_ID + ":vine_ball")
public static EntityType<EntityVineBall> TYPE;
@@ -113,4 +114,9 @@ public class EntityVineBall extends ThrowableEntity {
return dataManager.get(GRAVITY);
}
@Nonnull
@Override
public ItemStack getItem() {
return new ItemStack(ModItems.vineBall);
}
}
@@ -10,33 +10,29 @@
*/
package vazkii.botania.common.item;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.INBT;
import net.minecraft.nbt.INBT;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Hand;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fml.network.NetworkHooks;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemStackHandler;
import vazkii.botania.api.mana.IManaItem;
import vazkii.botania.common.Botania;
import vazkii.botania.common.lib.LibGuiIDs;
import vazkii.botania.common.lib.LibItemNames;
import vazkii.botania.client.gui.box.ContainerBaubleBox;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -91,8 +87,32 @@ public class ItemBaubleBox extends ItemMod {
@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, @Nonnull Hand hand) {
// todo 1.13 player.openGui(Botania.instance, LibGuiIDs.BAUBLE_BOX, world, hand == EnumHand.OFF_HAND ? 1 : 0, 0, 0);
if(!world.isRemote) {
NetworkHooks.openGui((ServerPlayerEntity) player, new ContainerProvider(player.getHeldItem(hand)), b -> {
b.writeBoolean(hand == Hand.MAIN_HAND);
});
}
return ActionResult.newResult(ActionResultType.SUCCESS, player.getHeldItem(hand));
}
private static class ContainerProvider implements INamedContainerProvider {
private final ItemStack stack;
private ContainerProvider(ItemStack stack) {
this.stack = stack;
}
@Nonnull
@Override
public ITextComponent getDisplayName() {
return stack.getDisplayName();
}
@Nullable
@Override
public Container createMenu(int windowId, PlayerInventory playerInv, PlayerEntity player) {
return new ContainerBaubleBox(windowId, playerInv, stack);
}
}
}
@@ -16,6 +16,7 @@ import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.INBT;
import net.minecraft.network.play.server.SCollectItemPacket;
@@ -39,7 +40,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.IInteractionObject;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.capabilities.Capability;
@@ -143,7 +143,7 @@ public class ItemFlowerBag extends ItemMod {
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, @Nonnull Hand hand) {
if(!world.isRemote) {
NetworkHooks.openGui((ServerPlayerEntity) player, new ContainerProvider(player.getHeldItem(hand)), buf -> {
buf.writeBoolean(hand == Hand.OFF_HAND);
buf.writeBoolean(hand == Hand.MAIN_HAND);
});
}
return ActionResult.newResult(ActionResultType.SUCCESS, player.getHeldItem(hand));
@@ -180,7 +180,7 @@ public class ItemFlowerBag extends ItemMod {
return ActionResultType.PASS;
}
private static class ContainerProvider implements IInteractionObject {
private static class ContainerProvider implements INamedContainerProvider {
private final ItemStack stack;
private ContainerProvider(ItemStack stack) {
@@ -189,31 +189,14 @@ public class ItemFlowerBag extends ItemMod {
@Nonnull
@Override
public Container createContainer(@Nonnull PlayerInventory playerInventory, @Nonnull PlayerEntity player) {
return new ContainerFlowerBag(playerInventory, new InventoryFlowerBag(stack));
}
@Nonnull
@Override
public String getGuiID() {
return "botania:flower_bag";
}
@Nonnull
@Override
public ITextComponent getName() {
return new StringTextComponent(getGuiID());
}
@Override
public boolean hasCustomName() {
return false;
public ITextComponent getDisplayName() {
return stack.getDisplayName();
}
@Nullable
@Override
public ITextComponent getCustomName() {
return null;
public Container createMenu(int windowId, PlayerInventory playerInv, PlayerEntity player) {
return new ContainerFlowerBag(windowId, playerInv, stack);
}
}
@@ -10,7 +10,10 @@
*/
package vazkii.botania.common.item;
import net.minecraft.client.gui.ScreenManager;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.DyeColor;
import net.minecraft.item.Food;
import net.minecraft.item.Items;
@@ -19,18 +22,25 @@ import net.minecraft.item.DyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.network.PacketBuffer;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.extensions.IForgeContainerType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.network.IContainerFactory;
import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.item.IFloatingFlower;
import vazkii.botania.api.mana.spark.SparkUpgradeType;
import vazkii.botania.api.item.IAncientWillContainer;
import vazkii.botania.api.state.enums.CratePattern;
import vazkii.botania.client.gui.bag.ContainerFlowerBag;
import vazkii.botania.client.gui.bag.GuiFlowerBag;
import vazkii.botania.client.gui.box.ContainerBaubleBox;
import vazkii.botania.client.gui.box.GuiBaubleBox;
import vazkii.botania.client.render.tile.RenderTileGaiaHead;
import vazkii.botania.client.render.tile.TEISR;
import vazkii.botania.common.block.ModBlocks;
@@ -711,6 +721,19 @@ public final class ModItems {
r.register(TerraPickTippingRecipe.SERIALIZER.setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "terra_pick_tipping")));
}
@SubscribeEvent
public static void registerContainers(RegistryEvent.Register<ContainerType<?>> evt) {
IForgeRegistry<ContainerType<?>> r = evt.getRegistry();
ContainerType<ContainerFlowerBag> bag = IForgeContainerType.create(ContainerFlowerBag::fromNetwork);
register(r, bag, flowerBag.getRegistryName());
ScreenManager.registerFactory(bag, GuiFlowerBag::new);
ContainerType<ContainerBaubleBox> box = IForgeContainerType.create(ContainerBaubleBox::fromNetwork);
register(r, box, baubleBox.getRegistryName());
ScreenManager.registerFactory(box, GuiBaubleBox::new);
}
private static void registerOreDictionary() {
/* TODO 1.13 reevaluate these
@@ -25,6 +25,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectType;
import net.minecraft.potion.Effects;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ItemGroup;
@@ -84,7 +85,7 @@ public class ItemBloodPendant extends ItemBauble implements IBrewContainer, IBre
list.add(new TranslationTextComponent("botaniamisc.brewOf", I18n.format(brew.getUnlocalizedName(stack))).applyTextStyle(TextFormatting.LIGHT_PURPLE));
for(EffectInstance effect : brew.getPotionEffects(stack)) {
TextFormatting format = effect.getPotion().isBadEffect() ? TextFormatting.RED : TextFormatting.GRAY;
TextFormatting format = effect.getPotion().type.func_220306_a();
ITextComponent cmp = new TranslationTextComponent(effect.getEffectName());
if(effect.getAmplifier() > 0) {
cmp.appendText(" ");
@@ -51,7 +51,7 @@ public class ItemKnockbackBelt extends ItemBauble {
GlStateManager.scalef(s, s, s);
if(model == null)
model = new ModelBiped();
model = new BipedModel();
model.bipedBody.render(1F);
}
@@ -17,6 +17,7 @@ import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.item.crafting.ShapedRecipe;
import net.minecraft.item.crafting.ShapelessRecipe;
@@ -77,7 +78,8 @@ public class PageCraftingRecipe extends PageRecipe {
public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) {
shapelessRecipe = false;
IRecipe recipe = Minecraft.getInstance().world.getRecipeManager().getRecipe(recipes.get(recipeAt));
ResourceLocation recipeId = recipes.get(recipeAt);
IRecipe recipe = Minecraft.getInstance().world.getRecipeManager().getRecipes(IRecipeType.CRAFTING).get(recipeId);
renderCraftingRecipe(gui, recipe);
TextureManager render = Minecraft.getInstance().textureManager;
@@ -57,7 +57,7 @@ public class PageElvenRecipe extends PageRecipe {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.color4f(1F, 1F, 1F, 1F);
((Screen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
((Screen) gui).blit(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
GlStateManager.disableBlend();
List<ItemStack> outputs = recipe.getOutputs();
@@ -74,7 +74,7 @@ public class PageElvenRecipe extends PageRecipe {
TextureAtlasSprite portalIcon = MiscellaneousIcons.INSTANCE.alfPortalTex;
Minecraft.getInstance().textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
((Screen) gui).drawTexturedModalRect(gui.getLeft() + 22, gui.getTop() + 36, portalIcon, 48, 48);
((Screen) gui).blit(gui.getLeft() + 22, gui.getTop() + 36, portalIcon, 48, 48);
}
@OnlyIn(Dist.CLIENT)
@@ -103,7 +103,7 @@ public class PageElvenRecipe extends PageRecipe {
@Override
@OnlyIn(Dist.CLIENT)
public void updateScreen() {
if(Screen.isShiftKeyDown())
if(Screen.hasShiftDown())
return;
if(ticksElapsed % 20 == 0) {
@@ -48,7 +48,7 @@ public class PageEntity extends LexiconPage{
int text_y = gui.getTop() + gui.getHeight() - 40;
int entity_scale = getEntityScale(size);
int entity_x = gui.getLeft() + gui.getWidth() / 2;
int entity_y = gui.getTop() + gui.getHeight() / 2 + MathHelper.floor(dummyEntity.height * entity_scale / 2);
int entity_y = gui.getTop() + gui.getHeight() / 2 + MathHelper.floor(dummyEntity.getHeight() * entity_scale / 2);
renderEntity(gui, dummyEntity, entity_x, entity_y, entity_scale, dummyEntity.ticksExisted * 2);
@@ -57,10 +57,10 @@ public class PageEntity extends LexiconPage{
@OnlyIn(Dist.CLIENT)
public int getEntityScale(int targetSize) {
float entity_size = dummyEntity.width;
float entity_size = dummyEntity.getWidth();
if(dummyEntity.width < dummyEntity.height)
entity_size = dummyEntity.height;
if(dummyEntity.getWidth() < dummyEntity.getHeight())
entity_size = dummyEntity.getHeight();
return MathHelper.floor(size / entity_size);
@@ -92,7 +92,7 @@ public class PageEntity extends LexiconPage{
GlStateManager.disableTexture();
GLX.glActiveTexture(GLX.GL_TEXTURE0);
if(relativeMouseX >= x - dummyEntity.width * scale / 2 - 10 && relativeMouseY >= y - dummyEntity.height * scale - 20 && relativeMouseX <= x + dummyEntity.width * scale / 2 + 10 && relativeMouseY <= y + 20)
if(relativeMouseX >= x - dummyEntity.getWidth() * scale / 2 - 10 && relativeMouseY >= y - dummyEntity.getHeight() * scale - 20 && relativeMouseX <= x + dummyEntity.getWidth() * scale / 2 + 10 && relativeMouseY <= y + 20)
tooltipEntity = true;
}
@@ -30,19 +30,16 @@ public class PageGuide extends PageText {
@Override
public void onOpened(IGuiLexiconEntry gui) {
button = new Button(101, gui.getLeft() + 30, gui.getTop() + gui.getHeight() - 50, gui.getWidth() - 60, 20, I18n.format("botaniamisc.playVideo")) {
@Override
public void onClick(double mouseX, double mouseY) {
super.onClick(mouseX, mouseY);
if(Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop().browse(new URI("https://www.youtube.com/watch?v=rx0xyejC6fI"));
if(Math.random() < 0.01)
Desktop.getDesktop().browse(new URI("https://www.youtube.com/watch?v=dQw4w9WgXcQ"));
} catch(IOException | URISyntaxException ignored) { }
}
button = new Button(gui.getLeft() + 30, gui.getTop() + gui.getHeight() - 50, gui.getWidth() - 60, 20, I18n.format("botaniamisc.playVideo"),
b -> {
if(Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop().browse(new URI("https://www.youtube.com/watch?v=rx0xyejC6fI"));
if(Math.random() < 0.01)
Desktop.getDesktop().browse(new URI("https://www.youtube.com/watch?v=dQw4w9WgXcQ"));
} catch(IOException | URISyntaxException ignored) { }
}
};
});
gui.getButtonList().add(button);
}
@@ -40,7 +40,7 @@ public class PageImage extends LexiconPage {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.color4f(1F, 1F, 1F, 1F);
((Screen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
((Screen) gui).blit(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
GlStateManager.disableBlend();
int width = gui.getWidth() - 30;
@@ -63,7 +63,7 @@ public class PageMultiblock extends LexiconPage {
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.disableAlphaTest();
GlStateManager.color4f(1F, 1F, 1F, 1F);
((Screen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
((Screen) gui).blit(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
GlStateManager.disableBlend();
GlStateManager.enableAlphaTest();
@@ -116,16 +116,12 @@ public class PageMultiblock extends LexiconPage {
@Override
public void onOpened(IGuiLexiconEntry gui) {
button = new Button(101, gui.getLeft() + 30, gui.getTop() + gui.getHeight() - 50, gui.getWidth() - 60, 20, getButtonStr()) {
@Override
public void onClick(double mouseX, double mouseY) {
super.onClick(mouseX, mouseY);
if(MultiblockRenderHandler.currentMultiblock == set)
MultiblockRenderHandler.setMultiblock(null);
else MultiblockRenderHandler.setMultiblock(set);
button.displayString = getButtonStr();
}
};
button = new Button(gui.getLeft() + 30, gui.getTop() + gui.getHeight() - 50, gui.getWidth() - 60, 20, getButtonStr(), b -> {
if(MultiblockRenderHandler.currentMultiblock == set)
MultiblockRenderHandler.setMultiblock(null);
else MultiblockRenderHandler.setMultiblock(set);
button.setMessage(getButtonStr()); // todo 1.14 this capture probably wont work
});
gui.getButtonList().add(button);
}
@@ -72,7 +72,11 @@ public class PagePetalRecipe<T extends RecipePetals> extends PageRecipe {
List<Ingredient> inputs = recipe.getInputs();
int degreePerInput = (int) (360F / inputs.size());
float currentDegree = ConfigHandler.CLIENT.lexiconRotatingItems.get() ? Screen.isShiftKeyDown() ? ticksElapsed : ticksElapsed + ClientTickHandler.partialTicks : 0;
float currentDegree = ConfigHandler.CLIENT.lexiconRotatingItems.get()
? Screen.hasShiftDown()
? ticksElapsed
: ticksElapsed + ClientTickHandler.partialTicks
: 0;
int inputIndex = ticksElapsed / 40;
for(Ingredient input : inputs) {
@@ -93,7 +97,7 @@ public class PagePetalRecipe<T extends RecipePetals> extends PageRecipe {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.color4f(1F, 1F, 1F, 1F);
((Screen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
((Screen) gui).blit(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
GlStateManager.disableBlend();
}
@@ -119,7 +123,7 @@ public class PagePetalRecipe<T extends RecipePetals> extends PageRecipe {
@Override
@OnlyIn(Dist.CLIENT)
public void updateScreen() {
if(Screen.isShiftKeyDown())
if(Screen.hasShiftDown())
return;
if(ticksElapsed % 20 == 0) {
@@ -79,7 +79,7 @@ public class PageTerrasteel extends PageRecipe {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.color4f(1F, 1F, 1F, 1F);
((Screen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
((Screen) gui).blit(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
GlStateManager.disableBlend();
}
@@ -37,29 +37,21 @@ public class PageTutorial extends PageText {
@Override
public void onOpened(IGuiLexiconEntry gui) {
buttonText = new Button(101, gui.getLeft() + 20, gui.getTop() + gui.getHeight() - 40, 50, 20, I18n.format("botaniamisc.tutorialText")) {
@Override
public void onClick(double mouseX, double mouseY) {
super.onClick(mouseX, mouseY);
GuiLexicon.startTutorial();
Minecraft.getInstance().displayGuiScreen(new GuiLexicon());
Minecraft.getInstance().player.sendMessage(new TranslationTextComponent("botaniamisc.tutorialStarted").setStyle(new Style().setColor(TextFormatting.GREEN)));
}
};
buttonText = new Button(gui.getLeft() + 20, gui.getTop() + gui.getHeight() - 40, 50, 20, I18n.format("botaniamisc.tutorialText"), b -> {
GuiLexicon.startTutorial();
Minecraft.getInstance().displayGuiScreen(new GuiLexicon());
Minecraft.getInstance().player.sendMessage(new TranslationTextComponent("botaniamisc.tutorialStarted").setStyle(new Style().setColor(TextFormatting.GREEN)));
});
if(VIDEO_ENABLED)
buttonVideo = new Button(101, gui.getLeft() + 75, gui.getTop() + gui.getHeight() - 40, 50, 20, I18n.format("botaniamisc.tutorialVideo")) {
@Override
public void onClick(double mouseX, double mouseY) {
super.onClick(mouseX, mouseY);
if(Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop().browse(new URI("https://www.youtube.com/watch?v=D75Aad-5QgQ"));
} catch(Exception e) {
e.printStackTrace();
}
buttonVideo = new Button(gui.getLeft() + 75, gui.getTop() + gui.getHeight() - 40, 50, 20, I18n.format("botaniamisc.tutorialVideo"), b -> {
if(Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop().browse(new URI("https://www.youtube.com/watch?v=D75Aad-5QgQ"));
} catch(Exception e) {
e.printStackTrace();
}
}
};
});
gui.getButtonList().add(buttonText);
if(VIDEO_ENABLED)
@@ -78,6 +70,6 @@ public class PageTutorial extends PageText {
super.renderScreen(gui, mx, my);
if(!VIDEO_ENABLED)
PageText.renderText(buttonText.x + buttonText.width + 4, buttonText.y - 14, 65, 100, "botaniamisc.noVideo");
PageText.renderText(buttonText.x + buttonText.getWidth() + 4, buttonText.y - 14, 65, 100, "botaniamisc.noVideo");
}
}
@@ -1,76 +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 @ [Jan 14, 2014, 6:50:15 PM (GMT)]
*/
package vazkii.botania.common.network;
import net.minecraft.client.gui.screen.inventory.CraftingScreen;
import net.minecraft.client.gui.screen.inventory.CraftingScreen;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.container.WorkbenchContainer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Hand;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;
import vazkii.botania.client.gui.bag.ContainerFlowerBag;
import vazkii.botania.client.gui.bag.GuiFlowerBag;
import vazkii.botania.client.gui.bag.InventoryFlowerBag;
import vazkii.botania.client.gui.box.ContainerBaubleBox;
import vazkii.botania.client.gui.box.GuiBaubleBox;
import vazkii.botania.client.gui.box.InventoryBaubleBox;
import vazkii.botania.client.gui.crafting.ContainerCraftingHalo;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibGuiIDs;
public class GuiHandler implements IGuiHandler {
@Override
public Object getServerGuiElement(int ID, PlayerEntity player, World world, int handId, int unused1, int unused2) {
Hand hand = handId == 1 ? Hand.OFF_HAND : Hand.MAIN_HAND;
ItemStack stack = player.getHeldItem(hand);
switch(ID) {
case LibGuiIDs.CRAFTING_HALO :
return new ContainerCraftingHalo(player.inventory, world);
case LibGuiIDs.FLOWER_BAG :
if(stack.getItem() == ModItems.flowerBag)
return new ContainerFlowerBag(player.inventory, new InventoryFlowerBag(stack));
case LibGuiIDs.BAUBLE_BOX :
if(stack.getItem() == ModItems.baubleBox)
return new ContainerBaubleBox(player, new InventoryBaubleBox(stack));
}
return null;
}
@Override
public Object getClientGuiElement(int ID, PlayerEntity player, World world, int handId, int unused1, int unused2) {
Hand hand = handId == 1 ? Hand.OFF_HAND : Hand.MAIN_HAND;
ItemStack stack = player.getHeldItem(hand);
switch(ID) {
case LibGuiIDs.LEXICON :
return GuiLexicon.currentOpenLexicon;
case LibGuiIDs.CRAFTING_HALO :
return new CraftingScreen(player.inventory, world);
case LibGuiIDs.FLOWER_BAG :
if(stack.getItem() == ModItems.flowerBag)
return new GuiFlowerBag(player.inventory, new InventoryFlowerBag(stack));
case LibGuiIDs.BAUBLE_BOX :
if(stack.getItem() == ModItems.baubleBox)
return new GuiBaubleBox(player, new InventoryBaubleBox(stack));
}
return null;
}
}