Skip to content

Commit

Permalink
i dunno..just pushin
Browse files Browse the repository at this point in the history
  • Loading branch information
p455w0rd committed Nov 4, 2018
1 parent fdb599c commit 2de0387
Show file tree
Hide file tree
Showing 30 changed files with 213 additions and 770 deletions.
2 changes: 1 addition & 1 deletion src/main/java/minechem/Minechem.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

@Mod(modid = ModGlobals.ID, name = ModGlobals.NAME, version = ModGlobals.VERSION, useMetadata = false, acceptedMinecraftVersions = "[1.12.2]", dependencies = "required-after:forge@[14.23.2.2638,);")
@Mod(modid = ModGlobals.ID, name = ModGlobals.NAME, version = ModGlobals.VERSION, useMetadata = false, acceptedMinecraftVersions = "[1.12.2]", dependencies = ModGlobals.DEPENDENCIES)
public class Minechem {

@Mod.Instance(value = ModGlobals.ID)
Expand Down
12 changes: 9 additions & 3 deletions src/main/java/minechem/block/tile/TileDecomposer.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import javax.annotation.Nullable;

import minechem.api.IDecomposerControl;
import minechem.api.RadiationInfo;
import minechem.init.ModConfig;
import minechem.init.ModNetworking;
import minechem.inventory.InventoryBounded;
Expand All @@ -18,6 +17,7 @@
import minechem.recipe.RecipeDecomposerFluid;
import minechem.recipe.handler.RecipeHandlerDecomposer;
import minechem.utils.MinechemUtil;
import minechem.utils.RadiationUtil;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
Expand Down Expand Up @@ -151,7 +151,7 @@ else if (tank.getFluidAmount() > 0) {
isCooking = true;
NonNullList<ItemStack> stacks = MinechemUtil.convertChemicalsIntoItemStacks(getBrokenOutput(output, inputStack.isEmpty() ? 1.0D : getDecompositionMultiplier(inputStack)));
for (ItemStack stack : stacks) {
if (RadiationInfo.getRadioactivity(stack) != RadiationEnum.stable) {
if (RadiationUtil.getRadioactivity(stack) != RadiationEnum.stable) {
ItemElement.initiateRadioactivity(stack, getWorld());
}
}
Expand Down Expand Up @@ -223,7 +223,13 @@ else if (tank.getFluidAmount() > 0) {
recipe = RecipeDecomposer.get(tank.getFluid());
}
if (recipe != null) {
NonNullList<ItemStack> recipeList = MinechemUtil.convertChemicalsIntoItemStacks(recipe.getOutputAsArray());
//@formatter:off
NonNullList<ItemStack> recipeList = MinechemUtil.convertChemicalsIntoItemStacks(

recipe.getOutputAsArray()

);
//@formatter:on
for (ItemStack currentStack : recipeList) {
for (int i = 0; i < outputInventory.getSizeInventory(); i++) {
ItemStack tmpStack = outputInventory.getStackInSlot(i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public int receiveEnergy(int maxReceive, boolean simulate) {
return 0;
}

int energyReceived = Math.min(tile.maxEnergy - tile.energyStored, Math.max(maxEnergyReceived, maxReceive));
int energyReceived = Math.min(tile.maxEnergy - tile.energyStored, Math.min(maxEnergyReceived, maxReceive));
if (!simulate) {
tile.energyStored += energyReceived;
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/minechem/block/tile/TileRadioactiveFluid.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import javax.annotation.Nullable;

import minechem.api.RadiationInfo;
import minechem.radiation.RadiationEnum;
import minechem.utils.RadiationUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
Expand All @@ -12,13 +12,13 @@

public class TileRadioactiveFluid extends TileEntity {

public RadiationInfo info;
public RadiationUtil info;

public TileRadioactiveFluid() {
this(null);
}

public TileRadioactiveFluid(RadiationInfo info) {
public TileRadioactiveFluid(RadiationUtil info) {
this.info = info;
}

Expand All @@ -29,7 +29,7 @@ public void readFromNBT(NBTTagCompound tag) {
info = null;
}
else {
info = new RadiationInfo(new ItemStack(tag.getCompoundTag("item")), tag.getLong("decayStart"), tag.getLong("lastUpdate"), tag.getInteger("dimensionID"), RadiationEnum.values()[tag.getInteger("radioactivity")]);
info = new RadiationUtil(new ItemStack(tag.getCompoundTag("item")), tag.getLong("decayStart"), tag.getLong("lastUpdate"), tag.getInteger("dimensionID"), RadiationEnum.values()[tag.getInteger("radioactivity")]);
info.radiationDamage = tag.getInteger("radiationDamage");
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/minechem/block/tile/TileSynthesis.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import minechem.network.message.MessageSyncSynthesisMachine;
import minechem.recipe.handler.RecipeHandlerSynthesis;
import minechem.utils.MinechemUtil;
import minechem.utils.RadiationUtil;
import minechem.utils.RecipeUtil;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.RecipeItemHelper;
Expand Down Expand Up @@ -259,7 +260,7 @@ private Map<ItemStack, Integer> getStorageStackAmounts() {
NonNullList<ItemStack> storageList = getStorageBuffer(true);
for (ItemStack stack : storageList) {
int count = stack.getCount();
ItemStack tmpStack = stack.copy();
ItemStack tmpStack = RadiationUtil.getStackWithoutRadiation(stack.copy());
tmpStack.setCount(1);

if (!isStackAdded(data, tmpStack)) {
Expand All @@ -275,8 +276,8 @@ private Map<ItemStack, Integer> getStorageStackAmounts() {

private int getCount(Map<ItemStack, Integer> data, ItemStack scompStack) {
for (ItemStack stack : data.keySet()) {
if (ItemStack.areItemStacksEqual(stack, scompStack)) {
return data.get(stack);
if (ItemStack.areItemStacksEqual(RadiationUtil.getStackWithoutRadiation(stack), RadiationUtil.getStackWithoutRadiation(scompStack))) {
return data.get(RadiationUtil.getStackWithoutRadiation(stack));
}
}
return 0;
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/minechem/client/gui/GuiChemistJournal.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ public void populateItemList() {
if (!searchBar.getText().equals("") && !itemstack.isEmpty() && !(itemstack.getDisplayName().toLowerCase().contains(searchBar.getText()))) {
continue;
}
int xPos = (i * 18) + 18;
int yPos = (j * 18) + 28;
int xPos = (i * 18) + 20;
int yPos = (j * 18) + 31;
GuiFakeSlot slot = new GuiFakeSlot(this, player);
slot.setXPos(xPos);
slot.setYPos(yPos);
Expand Down Expand Up @@ -176,16 +176,16 @@ public void showDecomposerRecipe(RecipeDecomposer recipe) {
}

private void showDecomposerRecipeSelect(RecipeDecomposerSelect recipe) {
List<RecipeDecomposer> recipes = recipe.getAllPossibleRecipes();
ArrayList<ArrayList<PotionChemical>> outputs = recipe.getAllPossibleOutputs();
if (slideShowTimer >= ModGlobals.TICKS_PER_SECOND * 8) {
slideShowTimer = 0;
currentSlide++;
if (currentSlide >= recipes.size()) {
if (currentSlide >= outputs.size()) {
currentSlide = 0;
}
}
if (slideShowTimer == 0) {
ArrayList<PotionChemical> potionChemicals = recipes.get(currentSlide).getOutputRaw();
ArrayList<PotionChemical> potionChemicals = outputs.get(currentSlide);
NonNullList<ItemStack> ingredients = MinechemUtil.convertChemicalsIntoItemStacks(potionChemicals);
showIngredients(ingredients, decomposerSlots, DECOMPOSER_X, DECOMPOSER_Y);
}
Expand Down
1 change: 0 additions & 1 deletion src/main/java/minechem/client/gui/GuiContainerBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public GuiContainerBase(Container container, RenderItem itemRenderer) {
inventorySlots = container;
fontRenderer = Minecraft.getMinecraft().getRenderManager().getFontRenderer();
renderItem = itemRenderer == null ? Minecraft.getMinecraft().getRenderItem() : itemRenderer;
//itemRender = renderItem;
}

@Override
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/minechem/client/gui/GuiContainerTabbed.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,14 @@ public void drawTexture(int x, int y, ResourceLocation resource) {
int h = 16;
mc.getTextureManager().bindTexture(resource);
GlStateManager.color(1F, 1F, 1F, 1F);

Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();

buffer.begin(7, DefaultVertexFormats.POSITION_TEX);
buffer.pos(x + 0, y + h, _zLevel - 1).tex(0D, 1D).endVertex();
buffer.pos(x + w, y + h, _zLevel - 1).tex(1D, 1D).endVertex();
buffer.pos(x + w, y + 0, _zLevel - 1).tex(1D, 0D).endVertex();
buffer.pos(x + 0, y + 0, _zLevel - 1).tex(0D, 0D).endVertex();
tessellator.draw();

}

public GuiContainerTabbed(Container container) {
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/minechem/client/gui/GuiMicroscope.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import minechem.container.ContainerMicroscope;
import minechem.init.ModGlobals;
import minechem.init.ModGlobals.ModResources;
import minechem.potion.PotionChemical;
import minechem.recipe.RecipeDecomposer;
import minechem.recipe.RecipeDecomposerChance;
import minechem.recipe.RecipeDecomposerSelect;
Expand Down Expand Up @@ -206,7 +207,7 @@ private void drawDecomposerRecipe(@Nonnull ItemStack inputstack, int x, int y) {
if (recipe != null) {
NonNullList<ItemStack> output = MinechemUtil.convertChemicalsIntoItemStacks(recipe.getOutputRaw());
if (recipe instanceof RecipeDecomposerSelect) {
drawDecomposerRecipeSelectMatrix(((RecipeDecomposerSelect) recipe).getAllPossibleRecipes(), x, y);
drawDecomposerRecipeSelectMatrix(((RecipeDecomposerSelect) recipe).getAllPossibleOutputs(), x, y);
}
else {
drawDecomposerRecipeMatrix(output, x, y);
Expand All @@ -226,20 +227,20 @@ private void drawDecomposerRecipeMatrix(NonNullList<ItemStack> output, int x, in
}
}

private void drawDecomposerRecipeSelectMatrix(ArrayList<RecipeDecomposer> recipes, int x, int y) {
private void drawDecomposerRecipeSelectMatrix(ArrayList<ArrayList<PotionChemical>> outputs, int x, int y) {
if (slideShowTimer == ModGlobals.TICKS_PER_SECOND * 8) {
slideShowTimer = 0;
currentSlide++;
}

if (currentSlide == recipes.size()) {
if (currentSlide == outputs.size()) {
currentSlide = 0;
}

slideShowTimer++;
RecipeDecomposer recipe = recipes.get(currentSlide);
NonNullList<ItemStack> output = MinechemUtil.convertChemicalsIntoItemStacks(recipe.getOutputRaw());
drawDecomposerRecipeMatrix(output, x, y);
ArrayList<PotionChemical> output = outputs.get(currentSlide);
NonNullList<ItemStack> outputStack = MinechemUtil.convertChemicalsIntoItemStacks(output);
drawDecomposerRecipeMatrix(outputStack, x, y);
}

private void drawDecomposerChance(RecipeDecomposer recipe, int x, int y) {
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/minechem/client/gui/GuiSynthesis.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
@Override
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

mc.renderEngine.bindTexture(ModResources.Gui.SYNTHESIS);
int x = (width - guiWidth) / 2;
int y = (height - guiHeight) / 2;
Expand All @@ -61,7 +60,6 @@ protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
@Override
public void handleMouseInput() throws IOException {
super.handleMouseInput();

final int i = Mouse.getEventDWheel();
if (i != 0 && isShiftKeyDown() && isOverSynthesisMatrixSlot()) {
final int x = Mouse.getEventX() * width / mc.displayWidth;
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/minechem/client/render/ElementItemRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ public void renderByItem(ItemStack stack, float partialTicks) {
if (model != null) {
model.handlePerspective(transformType);
}
if (transformType == TransformType.GUI) {
//RenderHelper.enableStandardItemLighting();
//RenderHelper.disableStandardItemLighting();
}
if (transformType == TransformType.FIXED) {
GlStateManager.translate(1.0, 0, 1.0);
GlStateManager.rotate(180.0f, 0, 1.0f, 0);
Expand Down
17 changes: 1 addition & 16 deletions src/main/java/minechem/client/render/IconLayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public IconLayer(ResourceLocation iIcon, boolean colour, boolean isSolid) {

@Override
public void render(int colour) {
//GlStateManager.scale(1F, 1F, 1F);
RenderUtil.resetOpenGLColour();
if (this.colour) {
if (!isSolid) {
Expand All @@ -35,24 +34,10 @@ public void render(int colour) {
RenderUtil.setOpenGLColour(colour);
}
GlStateManager.pushMatrix();
//GlStateManager.scale(0.5F, 0.5F, 0.5F);
//RenderHelper.enableGUIStandardItemLighting();
//RenderHelper.disableStandardItemLighting();
//GlStateManager.disableLighting();
//GlStateManager.disableLight(0);
//GlStateManager.disableLight(1);
//GlStateManager.disableColorMaterial();
GlStateManager.translate(0.5F, 0.5F, 0.0F);
//if (!stack.isOnItemFrame()) {
// EntityPlayer player = Minecraft.getMinecraft().player;
// if (player.getHeldItemMainhand().getItem() != ModItems.element && player.getHeldItemOffhand().getItem() != ModItems.element) {
//GlStateManager.rotate(180F, 0, 180F, 0);
// }
//}
RenderUtil.drawTextureIn3D(iIcon, this.colour ? colour : 0xFFFFFFFF);
GlStateManager.translate(-0.5F, -0.5F, 0.0F);
//RenderUtil.resetOpenGLColour();
//RenderHelper.enableStandardItemLighting();
GlStateManager.popMatrix();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ public void renderByItem(ItemStack stack, float partialTicks) {
layers.add(new IconLayer(Textures.Sprite.MOLECULE_PASS_1, true, false));
layers.add(new IconLayer(Textures.Sprite.MOLECULE_PASS_2, true));
GlStateManager.pushMatrix();
//RenderHelper.disableStandardItemLighting();
GlStateManager.enableRescaleNormal();
//GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.translate(1.0, 0, 1.0);
GlStateManager.rotate(180.0f, 0, 1.0f, 0);
layers.get(0).render();
Expand All @@ -36,10 +34,6 @@ public void renderByItem(ItemStack stack, float partialTicks) {
layers.get(0).render();
GlStateManager.disableRescaleNormal();
GlStateManager.popMatrix();
//RenderHelper.enableStandardItemLighting();
//GlStateManager.disableLighting();
//GlStateManager.enableLighting();
//GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
}

Expand Down
Loading

0 comments on commit 2de0387

Please sign in to comment.