Skip to content

Commit

Permalink
修了一点bug
Browse files Browse the repository at this point in the history
添加了范围模块化选择工具
  • Loading branch information
warmthdawn committed Jan 9, 2021
1 parent c00ccf9 commit 28e698d
Show file tree
Hide file tree
Showing 31 changed files with 792 additions and 41 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.


version = '0.2.1'
version = '0.5.2'
group = 'com.warmthdawn.mod.gugu-utils' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'gugu-utils'

Expand Down Expand Up @@ -102,7 +102,7 @@ dependencies {
runtime "curse.maven:guideapi-${guideapi_version}"

// deobfCompile "curse.maven:embersrekindled-${embers_version}"
deobfProvided "curse.maven:embersrekindled-${embers_version}"
deobfCompile "curse.maven:embersrekindled-${embers_version}"
deobfCompile "curse.maven:bloodmagic-${bloodmagic_version_curse}"


Expand Down
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=0.5.0
version=0.5.2
mcversion=1.12.2
4 changes: 2 additions & 2 deletions src/main/java/com/warmthdawn/mod/gugu_utils/GuGuUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
@Mod(modid = GuGuUtils.MODID, name = GuGuUtils.NAME, version = GuGuUtils.VERSION, dependencies = GuGuUtils.DEPENDENCY)
public class GuGuUtils {
public static final String MODID = "gugu-utils";
public static final String DEPENDENCY = "after:modularmachinery";
public static final String DEPENDENCY = "required-after:codechickenlib@[3.2.2,);required-after:mcjtylib_ng@[3.5.4,);after:modularmachinery;";
public static final String NAME = "GuGu Utils";
public static final String VERSION = "0.1";
public static final String VERSION = "0.5.2";
public static final CreativeTabs creativeTab = new CreativeTabs(GuGuUtils.MODID) {
@Override
@Nonnull
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/warmthdawn/mod/gugu_utils/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.warmthdawn.mod.gugu_utils.modularmachenary.mana.ItemManaBlock;
import com.warmthdawn.mod.gugu_utils.modularmachenary.mana.TileSparkManaHatch;
import com.warmthdawn.mod.gugu_utils.modularmachenary.starlight.BlockStarightInputHatch;
import com.warmthdawn.mod.gugu_utils.modularmachenary.tools.ItemRangedConstructTool;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.fml.common.registry.GameRegistry;
Expand All @@ -27,15 +28,20 @@ public class ModItems {
@GameRegistry.ObjectHolder(STRING_RESOURCE_LENS_TRANSFORM)
public static Item lensTransform;

@GameRegistry.ObjectHolder(STRING_RANGED_CONSTRUCTION_TOOL)
public static Item constructionTool;

@SideOnly(Side.CLIENT)
public static void initModels() {
if (Loads.BOTANIA) {
((ItemLensAddition) lensOverclocking).initModel();
((ItemLensAddition) lensTransform).initModel();
((ItemRangedConstructTool) constructionTool).initModel();
}
}

public static void register(IForgeRegistry<Item> registry) {

if (Loads.BOTANIA) {
registry.register(new ItemLensOverclocking().setRegistryName(RESOURCE_LENS_OVERCLOCKING));
registry.register(new ItemLensTransform().setRegistryName(RESOURCE_LENS_TRANSFORM));
Expand All @@ -44,6 +50,7 @@ public static void register(IForgeRegistry<Item> registry) {
registry.register(new ItemBlock(ModBlocks.blockEnvironmentHatch).setRegistryName(RESOURCE_ENVIRONMENTHATCH));
registry.register(new ItemBlock(ModBlocks.blockEnergyOutputPort).setRegistryName(RESOURCE_ENERGYPORT_OUTPUT));

registry.register(new ItemRangedConstructTool().setRegistryName(RESOURCE_RANGED_CONSTRUCTION_TOOL));
if (Loads.BOTANIA) {
registry.register(new ItemManaBlock((BlockSparkManaHatch) ModBlocks.blockSparkManaHatch, TileSparkManaHatch.MAX_MANA).setRegistryName(RESOURCE_MANAHATCH));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void updateBurst(IManaBurst burst, EntityThrowable entity, ItemStack stac
int maxStack = recipe.getOutput().getMaxStackSize();
while (outputCount > 0) {
ItemStack out = recipe.getOutput().copy();
out.setCount(Math.max(maxStack, outputCount));
out.setCount(Math.min(maxStack, outputCount));
entity.world.spawnEntity(
new EntityItem(entity.world, entity.posX, entity.posY, entity.posZ,
out));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,11 @@ public class Constants {
public static final ResourceLocation RESOURCE_LENS_TRANSFORM = new ResourceLocation(GuGuUtils.MODID, NAME_LENS_TRANSFORM);
public static final String STRING_RESOURCE_LENS_TRANSFORM = GuGuUtils.MODID + ":" + NAME_LENS_TRANSFORM;


//物品
public static final String NAME_RANGED_CONSTRUCTION_TOOL = "constructionranged";
public static final ResourceLocation RESOURCE_RANGED_CONSTRUCTION_TOOL = new ResourceLocation(GuGuUtils.MODID, NAME_RANGED_CONSTRUCTION_TOOL);
public static final String STRING_RANGED_CONSTRUCTION_TOOL = GuGuUtils.MODID + ":" + NAME_RANGED_CONSTRUCTION_TOOL;


}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class CraftTweakerCompact {
public static final List<IAction> LATE_ADDITIONS = new ArrayList<>();
public static final List<IAction> LATE_REMOVALS = new ArrayList<>();

public static void init() {
public static void preInit() {
if(Loads.MODULAR_MACHIENARY)
CraftTweakerAPI.registerClass(RecipePrimerExt.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void onJEIHoverTooltip(int slotIndex, boolean input, IngredientAura ingre

public static class LayoutPart extends LayoutWapper<IngredientAura> {
public LayoutPart(Point offset) {
super(offset, 6, 80, 6, 100, 0, 10, 8, 4, 2, 100);
super(offset, 6, 80, 6, 100, 0, 10, 8, 4, 2, 200);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void onJEIHoverTooltip(int slotIndex, boolean input, IngredientEnvironmen
public static class LayoutPart extends LayoutWapper<IngredientEnvironment> {

public LayoutPart(Point offset) {
super(offset, 16, 16, 0, 0, 4, 4, 3, 200);
super(offset, 16, 16, 0, 0, 4, 4, 3, 50);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static class LayoutPart extends LayoutWapper<IngedientMana> {

public LayoutPart(Point offset) {
// super(offset, 5, 118, 0, 0, 16, 16, 5, 900);
super(offset, 5, 102, 5, 118, 0, 0, 8, 8, 3, 900);
super(offset, 5, 102, 5, 118, 0, 0, 8, 8, 3, 200);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
import com.warmthdawn.mod.gugu_utils.jei.LayoutWapper;
import com.warmthdawn.mod.gugu_utils.jei.ingedients.IngredientStarlight;
import com.warmthdawn.mod.gugu_utils.jei.renders.RendererStarlight;
import hellfirepvp.astralsorcery.client.util.RenderConstellation;
import hellfirepvp.astralsorcery.common.constellation.IConstellation;
import hellfirepvp.modularmachinery.common.crafting.helper.ComponentRequirement;
import hellfirepvp.modularmachinery.common.integration.recipe.RecipeLayoutPart;
import mezz.jei.api.ingredients.IIngredientRenderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;

import java.awt.*;
Expand Down Expand Up @@ -37,7 +35,7 @@ public List<IngredientStarlight> getJEIIORequirements() {

@Override
public RecipeLayoutPart<IngredientStarlight> getLayoutPart(Point offset) {
return new LayoutPart(offset);
return new LayoutPart(offset, constellation != null);
}

@Override
Expand All @@ -47,9 +45,9 @@ public void onJEIHoverTooltip(int slotIndex, boolean input, IngredientStarlight

public static class LayoutPart extends LayoutWapper<IngredientStarlight> {

public LayoutPart(Point offset) {
public LayoutPart(Point offset, boolean showConstellation) {
// super(new Point(offset.x, offset.y - 32), 16, 80, 0, 32, 16, 16, 1, 100000);
super(offset, 16, 16, 16, 80, 0, 16, 8, 8, 2, 100000);
super(offset, 16, 16, 24, 80, 8, 16, 8, 8, 1, 80);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private RendererAura() {

@Override
public void render(Minecraft minecraft, int xPosition, int yPosition, @Nullable IngredientAura ingredient) {
renderAuraBar(minecraft, xPosition, yPosition, (int) ingredient.getValue() * ingredient.getTicks(), TileAuraHatch.MAX_AURA);
renderAuraBar(minecraft, xPosition, yPosition, (int) ingredient.getValue() * ingredient.getTicks(), TileAuraHatch.MAX_AURA / 3);
}

private void renderAuraBar(Minecraft mc, int offX, int offY, int totalAmount, int max) {
Expand All @@ -41,8 +41,8 @@ private void renderAuraBar(Minecraft mc, int offX, int offY, int totalAmount, in
tHeight = 80;
}
int offset = 80 - tHeight;
RenderUtils.drawTexturedModalRect(offX, offY, 0, 0, 102, 6, offset);
RenderUtils.drawTexturedModalRect(offX, offY + offset, 0, 6, 102 + offset, 6, tHeight);
RenderUtils.drawTexturedModalRect(offX, offY, 0, 0, 104, 6, offset);
RenderUtils.drawTexturedModalRect(offX, offY + offset, 0, 6, 104 + offset, 6, tHeight);
int color = 0x53a008;
if (totalPercentage > 1F)
mc.fontRenderer.drawString("+", offX + 4, offY - 0.5F, color, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.warmthdawn.mod.gugu_utils.tools.RenderUtils;
import mezz.jei.api.ingredients.IIngredientRenderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -38,7 +39,11 @@ public EmbersHatchVariant getHatchLevel(double ember) {
public void render(Minecraft minecraft, int xPosition, int yPosition, @Nullable IngredientEmber ingredient) {
int maxEmber = Math.max(800, getHatchLevel((double) ingredient.getValue()).getEmberMaxStorage());

GlStateManager.pushMatrix();
GlStateManager.enableAlpha();
RenderUtils.renderEmberBarVertical(xPosition, yPosition, 0.7f, (float) (double) ingredient.getValue() / maxEmber);
GlStateManager.disableAlpha();
GlStateManager.popMatrix();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.warmthdawn.mod.gugu_utils.jei.renders;

import codechicken.lib.render.state.GlStateTracker;
import com.google.common.collect.Lists;
import com.warmthdawn.mod.gugu_utils.ModBlocks;
import com.warmthdawn.mod.gugu_utils.jei.ingedients.IngredientStarlight;
Expand Down Expand Up @@ -38,18 +39,21 @@ public class RendererStarlight implements IIngredientRenderer<IngredientStarligh

@Override
public void render(Minecraft minecraft, int offsetX, int offsetY, @Nullable IngredientStarlight ingredient) {
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_BLEND);
GlStateTracker.pushState();
GlStateManager.pushAttrib();
GlStateManager.color(1F, 1F, 1F, 1F);
GlStateManager.disableDepth();
GlStateManager.enableBlend();
drawInfoStar(offsetX + 8, offsetY + 8, 10, 16, minecraft.getRenderPartialTicks());
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopAttrib();
GlStateManager.disableBlend();
GlStateManager.enableDepth();
GlStateManager.popAttrib();
GlStateManager.color(1F, 1F, 1F, 1F);


if (ingredient != null && ingredient.getConstellation() != null) {
IConstellation focus = ingredient.getConstellation();
GlStateManager.pushAttrib();
GlStateManager.disableDepth();
GlStateManager.disableAlpha();
RenderConstellation.renderConstellationIntoGUI(new Color(0xEEEEEE), focus,
offsetX - 15, offsetY - 12, 0,
Expand All @@ -60,7 +64,12 @@ public float getBrightness() {
}
}, true, false);
GlStateManager.enableAlpha();
GlStateManager.enableDepth();
GlStateManager.popAttrib();
}

GlStateTracker.pushState();
GlStateManager.color(1F, 1F, 1F, 1F);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ public void addInformation(ItemStack stack, World world, List<String> tooltip, I
double emberCapacity = tagCompound.getDouble("emberCapacity");
DecimalFormat emberFormat = Embers.proxy.getDecimalFormat("embers.decimal_format.ember");
addInformationLocalized(tooltip, emberFormat.format(ember), emberFormat.format(emberCapacity));
} else if (stack.getMetadata() < EmbersHatchVariant.VAULES.length) {
EmbersHatchVariant variant = EmbersHatchVariant.VAULES[stack.getMetadata()];
double emberCapacity = variant.getEmberMaxStorage();
DecimalFormat emberFormat = Embers.proxy.getDecimalFormat("embers.decimal_format.ember");
addInformationLocalized(tooltip, emberFormat.format(0), emberFormat.format(emberCapacity));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ public enum EmbersHatchVariant implements IStringSerializable {
BIG,
HUGE,
LUDICROUS,
EXTREME
;
EXTREME;

public static final EmbersHatchVariant[] VAULES = EmbersHatchVariant.values();

@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}

public int getEmberMaxStorage() {
switch (this){
switch (this) {
case TINY:
default:
return 400;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.warmthdawn.mod.gugu_utils.ModBlocks;
import com.warmthdawn.mod.gugu_utils.common.IRestorableTileEntity;
import com.warmthdawn.mod.gugu_utils.modularmachenary.IColorableTileEntity;
import com.warmthdawn.mod.gugu_utils.modularmachenary.starlight.BlockStarightInputHatch;
import com.warmthdawn.mod.gugu_utils.network.Messages;
import com.warmthdawn.mod.gugu_utils.network.PacketMana;
import com.warmthdawn.mod.gugu_utils.tools.CIELab;
Expand Down Expand Up @@ -132,7 +131,7 @@ public NBTTagCompound getUpdateTag() {
// client. In contrast getUpdatePacket() is called when the tile entity
// itself wants to sync to the client. In many cases you want to send
// over the same information in getUpdateTag() as in getUpdatePacket().
return writeNetworkNBT(new NBTTagCompound());
return writeNetworkNBT(super.getUpdateTag());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.warmthdawn.mod.gugu_utils.GuGuUtils;
import com.warmthdawn.mod.gugu_utils.tools.RenderUtils;
import com.warmthdawn.mod.gugu_utils.tools.ResourceUtils;
import crafttweaker.annotations.ModOnly;
import hellfirepvp.astralsorcery.client.ClientScheduler;
import hellfirepvp.astralsorcery.client.sky.RenderAstralSkybox;
import hellfirepvp.astralsorcery.client.util.Blending;
Expand All @@ -19,9 +18,6 @@
import hellfirepvp.astralsorcery.common.util.data.Tuple;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
Expand Down Expand Up @@ -80,6 +76,8 @@ protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, i
int has = hatch.getClientStarlightStored();
if (has < req) {
int max = hatch.getMaxStarlightStorage();
req = Math.min(max, req);
has = Math.min(max, has);
float percReq = (float) (req - has) / (float) max;
int from = (int) (165 * percFilled);
int to = (int) (165 * percReq);
Expand Down
Loading

0 comments on commit 28e698d

Please sign in to comment.