Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Material Tree JEI page #48

Closed
wants to merge 50 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
8be19b9
Add material tree jei page
kumquat-ir Jul 23, 2021
592f34f
Add fluid and fluid container
kumquat-ir Jul 23, 2021
16f86c5
More material info, revert to DustMaterial, remove fluid containers, …
kumquat-ir Jul 23, 2021
e8c2593
first draft layout
kumquat-ir Jul 23, 2021
700a80f
New layout, only show slots that are filled
kumquat-ir Jul 24, 2021
b4749e9
Add arrows, clean things up
kumquat-ir Jul 25, 2021
f0271b1
Add Unbreaking to base enchant list (#49)
BraggestSage833 Jul 25, 2021
4443807
Add Multiblock cached value invalidation on structure deform (#51)
ALongStringOfNumbers Jul 27, 2021
b8f69de
Fixed Material Casting and Added RecipeMap Bracket Handler (#47)
idcppl Jul 28, 2021
812b005
suggested improvements
kumquat-ir Jul 28, 2021
0056465
remove `getTimer()` and add `isFirstTick()`
serenibyss Jul 28, 2021
b870b15
remove deprecated `IMetaItemStats`
serenibyss Jul 28, 2021
ab2f9c0
dump deprecated recipe property methods
serenibyss Jul 28, 2021
3a82954
make recipe properties easier to use
serenibyss Jul 28, 2021
4857d38
remove possible empty spaces between info text
kumquat-ir Jul 28, 2021
0e9d8c7
further small property cleanup
serenibyss Jul 28, 2021
7f6fab9
Implement Item Pipes
brachy84 Jul 28, 2021
7b8f5e4
fix lignite composition
serenibyss Jul 29, 2021
e09f13d
add Coal Gas and Coal Tar processing
serenibyss Jul 29, 2021
00fa71c
use non-deprecated JEI methods, change icon to aluminium ingot
kumquat-ir Jul 29, 2021
512ae6f
Cleanup the usage of some deprecated JEI method (#54)
ALongStringOfNumbers Jul 29, 2021
4da3dbc
add a ton of fluid pipes
TechLord22 Jul 29, 2021
8b840fe
Update some dependencies (#55)
ALongStringOfNumbers Jul 29, 2021
ba98780
new quantum chest texture
TechLord22 Jul 29, 2021
5b5ec62
Allow Multiblocks to share hatches (#12)
BraggestSage833 Jul 30, 2021
09bd434
add steam venting to multiblocks
TechLord22 Jul 31, 2021
33770b6
Add recipes for nearly all vanilla items (#56)
TechLord22 Aug 1, 2021
a0c0a03
Cleanup findRecipe calls (#57)
ALongStringOfNumbers Aug 2, 2021
cf82f95
set `makeObfSourceJar` false
serenibyss Aug 3, 2021
049897d
Material API Overhaul (#58)
serenibyss Aug 5, 2021
b7e2f15
MaterialIconSet Specific Fluid Textures (#61)
TechLord22 Aug 5, 2021
455cd7b
make less merge conflicts for brachy
serenibyss Aug 6, 2021
93a296d
change some colors and iconsets, add BRIGHT iconset
TechLord22 Aug 6, 2021
4aabcb0
add `colorAverage()` builder call
serenibyss Aug 6, 2021
54ba2e9
clean up warnings in RecipeBuilder
serenibyss Aug 6, 2021
1529aae
fix transformer textures not updating properly
TechLord22 Aug 6, 2021
eb091ed
fix incorrect gem_vertical fluid sprite registration
TechLord22 Aug 6, 2021
8022707
improve transformer rendering update logic
TechLord22 Aug 6, 2021
c7fb654
:monkey:
serenibyss Aug 7, 2021
bd584ab
de-Enum OrePrefix
serenibyss Aug 7, 2021
64ba7ff
Add material tree jei page
kumquat-ir Jul 23, 2021
7d71d97
Add fluid and fluid container
kumquat-ir Jul 23, 2021
c55e24e
More material info, revert to DustMaterial, remove fluid containers, …
kumquat-ir Jul 23, 2021
04b6e94
first draft layout
kumquat-ir Jul 23, 2021
39c57f0
New layout, only show slots that are filled
kumquat-ir Jul 24, 2021
5ee3ad5
Add arrows, clean things up
kumquat-ir Jul 25, 2021
00a4d95
suggested improvements
kumquat-ir Jul 28, 2021
856956c
remove possible empty spaces between info text
kumquat-ir Jul 28, 2021
4cabda1
use non-deprecated JEI methods, change icon to aluminium ingot
kumquat-ir Jul 29, 2021
c183803
Merge remote-tracking branch 'origin/materialtree' into materialtree
kumquat-ir Aug 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ minecraft {
mappings = "stable_39"
runDir = "run"
isUseDepAts = true
makeObfSourceJar = false
}

repositories {
Expand Down
4 changes: 2 additions & 2 deletions build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ forge.version=14.23.5.2847
ccl.version=3.2.3.358
chickenasm.version=1.0.2.9
forestry.version=5.8.2.387
jei.version=4.15.0.291
crafttweaker.version=1.12-4.1.9.6
jei.version=4.16.1.302
crafttweaker.version=1.12-4.1.20.655
top.version=1.4.28-17
ctm.version=1.0.2.31
14 changes: 7 additions & 7 deletions src/main/java/gregtech/GregTechMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
import gregtech.api.model.ResourcePackHook;
import gregtech.api.net.NetworkHandler;
import gregtech.api.recipes.RecipeMap;
import gregtech.api.unification.Elements;
import gregtech.api.unification.OreDictUnifier;
import gregtech.api.unification.material.IMaterialHandler;
import gregtech.api.unification.material.MaterialRegistry;
import gregtech.api.unification.material.Materials;
import gregtech.api.unification.material.type.Material;
import gregtech.api.util.AnnotatedMaterialHandlerLoader;
import gregtech.api.util.GTLog;
import gregtech.api.util.NBTUtil;
Expand Down Expand Up @@ -69,18 +69,15 @@ public class GregTechMod {
public void onPreInit(FMLPreInitializationEvent event) {
GTLog.init(event.getModLog());
NetworkHandler.init();
Elements.register();
MetaTileEntityUIFactory.INSTANCE.init();
PlayerInventoryUIFactory.INSTANCE.init();
CoverBehaviorUIFactory.INSTANCE.init();
SimpleCapabilityManager.init();
OreDictUnifier.init();
NBTUtil.registerSerializers();

//first, register primary materials and run material handlers
Materials.register();
AnnotatedMaterialHandlerLoader.discoverAndLoadAnnotatedMaterialHandlers(event.getAsmData());
Material.runMaterialHandlers();
IMaterialHandler.runMaterialHandlers();

//then, run CraftTweaker early material registration scripts
if (GTValues.isModLoaded(GTValues.MODID_CT)) {
Expand All @@ -89,7 +86,10 @@ public void onPreInit(FMLPreInitializationEvent event) {
}

//freeze material registry before processing items, blocks and fluids
Material.freezeRegistry();
MaterialRegistry.freeze();

OreDictUnifier.init();
NBTUtil.registerSerializers();

MetaBlocks.init();
MetaItems.init();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/gregtech/api/GregTechAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import gregtech.api.block.machines.BlockMachine;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.unification.OreDictUnifier;
import gregtech.api.unification.material.Material;
import gregtech.api.unification.material.Materials;
import gregtech.api.unification.material.type.DustMaterial;
import gregtech.api.unification.ore.OrePrefix;
import gregtech.api.unification.ore.StoneType;
import gregtech.api.util.BaseCreativeTab;
Expand All @@ -19,7 +19,7 @@
public class GregTechAPI {

public static BlockMachine MACHINE;
public static final Map<DustMaterial, Map<StoneType, IBlockOre>> oreBlockTable = new HashMap<>();
public static final Map<Material, Map<StoneType, IBlockOre>> oreBlockTable = new HashMap<>();

public static final BaseCreativeTab TAB_GREGTECH =
new BaseCreativeTab(GTValues.MODID + ".main", () -> MetaItems.BATTERY_HULL_HV.getStackForm(), true);
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/gregtech/api/block/machines/BlockMachine.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import gregtech.api.cover.IFacadeCover;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.MetaTileEntityHolder;
import gregtech.api.pipenet.block.BlockPipe;
import gregtech.api.pipenet.block.IPipeType;
import gregtech.api.pipenet.tile.AttachmentType;
import gregtech.api.pipenet.tile.IPipeTile;
import gregtech.api.render.MetaTileEntityRenderer;
Expand Down Expand Up @@ -244,22 +246,20 @@ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, Enti
if (ConfigHolder.U.GT6.gt6StylePipesCables) {
if (placer instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) placer;
RayTraceResult rt1 = GTUtility.getBlockLookingAt(player);
RayTraceResult rt2 = GTUtility.getBlockLookingAt(player, pos);
for (EnumFacing facing : EnumFacing.VALUES) {
BlockPos pipePos = null;

if (rt1 != null)
if (GTUtility.arePosEqual(rt1.getBlockPos(), pos.offset(facing, 1)))
pipePos = rt1.getBlockPos();
if (rt2 != null)
if (GTUtility.arePosEqual(rt2.getBlockPos(), pos.offset(facing, 1)))
pipePos = rt2.getBlockPos();
if (pipePos != null) {
TileEntity tileEntity = placer.world.getTileEntity(pipePos);
if (tileEntity instanceof IPipeTile) {
IPipeTile<?, ?> pipeTile = (IPipeTile<?, ?>) tileEntity;
pipeTile.setConnectionBlocked(AttachmentType.PIPE, facing.getOpposite(), false, true);
Block block = worldIn.getBlockState(pipePos).getBlock();
if(block instanceof BlockPipe) {
IPipeTile pipeTile = ((BlockPipe<?, ?, ?>) block).getPipeTileEntity(worldIn, pipePos);
if(((BlockPipe<?, ?, ?>) block).canPipeConnectToBlock(pipeTile, facing.getOpposite(), worldIn.getTileEntity(pos))) {
pipeTile.setConnectionBlocked(AttachmentType.PIPE, facing.getOpposite(), false, false);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import gregtech.api.capability.IWorkable;
import gregtech.api.metatileentity.MTETrait;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.recipes.MatchingMode;
import gregtech.api.recipes.Recipe;
import gregtech.api.recipes.RecipeMap;
import gregtech.api.util.GTUtility;
Expand Down Expand Up @@ -165,7 +166,7 @@ protected void trySearchNewRecipe() {
if (dirty || forceRecipeRecheck) {
this.forceRecipeRecheck = false;
//else, try searching new recipe for given inputs
currentRecipe = findRecipe(maxVoltage, importInventory, importFluids);
currentRecipe = findRecipe(maxVoltage, importInventory, importFluids, MatchingMode.DEFAULT);
if (currentRecipe != null) {
this.previousRecipe = currentRecipe;
}
Expand All @@ -191,8 +192,8 @@ protected int getMinTankCapacity(IMultipleTankHandler tanks) {
return result;
}

protected Recipe findRecipe(long maxVoltage, IItemHandlerModifiable inputs, IMultipleTankHandler fluidInputs) {
return recipeMap.findRecipe(maxVoltage, inputs, fluidInputs, getMinTankCapacity(getOutputTank()));
protected Recipe findRecipe(long maxVoltage, IItemHandlerModifiable inputs, IMultipleTankHandler fluidInputs, MatchingMode mode) {
return recipeMap.findRecipe(maxVoltage, inputs, fluidInputs, getMinTankCapacity(getOutputTank()), mode);
}

protected boolean checkRecipeInputsDirty(IItemHandler inputs, IMultipleTankHandler fluidInputs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ public void updateWorkable() {
super.update();
}

/**
* Used to reset cached values in the Recipe Logic on structure deform
*/
public void invalidate() {

}

public IEnergyContainer getEnergyContainer() {
RecipeMapMultiblockController controller = (RecipeMapMultiblockController) metaTileEntity;
return controller.getEnergyContainer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ protected void tryDoVenting() {
if (blockOnPos.getCollisionBoundingBox(metaTileEntity.getWorld(), ventingBlockPos) == Block.NULL_AABB) {
metaTileEntity.getWorld()
.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(ventingBlockPos), EntitySelectors.CAN_AI_TARGET)
.forEach(entity -> entity.attackEntityFrom(DamageSources.getHeatDamage(), 6.0f));
.forEach(entity -> entity.attackEntityFrom(DamageSources.getHeatDamage(), this.isHighPressure ? 12.0f : 6.0f));
WorldServer world = (WorldServer) metaTileEntity.getWorld();
double posX = machinePos.getX() + 0.5 + ventingSide.getXOffset() * 0.6;
double posY = machinePos.getY() + 0.5 + ventingSide.getYOffset() * 0.6;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package gregtech.api.capability.impl;

import gregtech.api.capability.IMultipleTankHandler;
import gregtech.api.capability.impl.FluidTankList;
import gregtech.api.recipes.CountableIngredient;
import gregtech.api.recipes.MatchingMode;
import gregtech.api.recipes.Recipe;
import gregtech.api.recipes.RecipeBuilder;
import gregtech.api.util.InventoryUtils;
Expand Down Expand Up @@ -38,7 +38,7 @@ protected void trySearchNewRecipe() {
if(dirty || forceRecipeRecheck) {
this.forceRecipeRecheck = false;

currentRecipe = findRecipe(maxVoltage, importInventory, null);
currentRecipe = findRecipe(maxVoltage, importInventory, null, MatchingMode.DEFAULT);
if (currentRecipe != null) {
this.previousRecipe = currentRecipe;
}
Expand All @@ -52,7 +52,7 @@ protected void trySearchNewRecipe() {
}

@Override
protected Recipe findRecipe(long maxVoltage, IItemHandlerModifiable inputs, IMultipleTankHandler fluidInputs) {
protected Recipe findRecipe(long maxVoltage, IItemHandlerModifiable inputs, IMultipleTankHandler fluidInputs, MatchingMode mode) {
int currentItemsEngaged = 0;
final ArrayList<CountableIngredient> recipeInputs = new ArrayList<>();
final ArrayList<ItemStack> recipeOutputs = new ArrayList<>();
Expand All @@ -73,7 +73,8 @@ protected Recipe findRecipe(long maxVoltage, IItemHandlerModifiable inputs, IMul
// Check recipe for item in slot
Recipe matchingRecipe = recipeMap.findRecipe(maxVoltage,
Collections.singletonList(currentInputItem),
Collections.emptyList(), 0);
Collections.emptyList(), 0,
MatchingMode.DEFAULT);
CountableIngredient inputIngredient;
if (matchingRecipe != null) {
if (matchingRecipe.getOutputs().isEmpty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
import gregtech.api.capability.IMultipleTankHandler;
import gregtech.api.recipes.Recipe;
import gregtech.api.recipes.RecipeMap;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.SoundEvents;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldServer;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.IFluidTank;
import net.minecraftforge.items.IItemHandler;
Expand Down Expand Up @@ -112,4 +120,30 @@ protected boolean setupAndConsumeRecipeInputs(Recipe recipe) {
protected boolean checkRecipeInputsDirty(IItemHandler inputs, IMultipleTankHandler fluidInputs) {
return super.checkRecipeInputsDirty(inputs, new FluidTankList(false));
}

@Override
protected void completeRecipe() {
super.completeRecipe();
ventSteam();
}

private void ventSteam() {
BlockPos machinePos = metaTileEntity.getPos();
EnumFacing ventingSide = metaTileEntity.getFrontFacing();
BlockPos ventingBlockPos = machinePos.offset(ventingSide);
IBlockState blockOnPos = metaTileEntity.getWorld().getBlockState(ventingBlockPos);
if (blockOnPos.getCollisionBoundingBox(metaTileEntity.getWorld(), ventingBlockPos) == Block.NULL_AABB) {
WorldServer world = (WorldServer) metaTileEntity.getWorld();
double posX = machinePos.getX() + 0.5 + ventingSide.getXOffset() * 0.6;
double posY = machinePos.getY() + 0.5 + ventingSide.getYOffset() * 0.6;
double posZ = machinePos.getZ() + 0.5 + ventingSide.getZOffset() * 0.6;

world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, posX, posY, posZ,
7 + world.rand.nextInt(3),
ventingSide.getXOffset() / 2.0,
ventingSide.getYOffset() / 2.0,
ventingSide.getZOffset() / 2.0, 0.1);
world.playSound(null, posX, posY, posZ, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, 1.0f);
}
}
}
3 changes: 0 additions & 3 deletions src/main/java/gregtech/api/cover/ICoverable.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ public interface ICoverable {

BlockPos getPos();

@Deprecated
long getTimer();

long getOffsetTimer();

void markDirty();
Expand Down
29 changes: 7 additions & 22 deletions src/main/java/gregtech/api/damagesources/DamageSources.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
package gregtech.api.damagesources;

import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSource;

public class DamageSources {

private static DamageSource EXPLOSION = new DamageSource("explosion").setExplosion();
private static DamageSource HEAT = new DamageSource("heat").setDamageBypassesArmor();
private static DamageSource FROST = new DamageSource("frost").setDamageBypassesArmor();
private static DamageSource ELECTRIC = new DamageSource("electric").setDamageBypassesArmor();
private static DamageSource RADIATION = new DamageSource("radiation").setDamageBypassesArmor();
private static DamageSource TURBINE = new DamageSource("turbine");
private static DamageSource CRUSHER = new DamageSource("crusher");
private static final DamageSource EXPLOSION = new DamageSource("explosion").setExplosion();
private static final DamageSource HEAT = new DamageSource("heat").setDamageBypassesArmor();
private static final DamageSource FROST = new DamageSource("frost").setDamageBypassesArmor();
private static final DamageSource ELECTRIC = new DamageSource("electric").setDamageBypassesArmor();
private static final DamageSource RADIATION = new DamageSource("radiation").setDamageBypassesArmor();
private static final DamageSource TURBINE = new DamageSource("turbine");

public static DamageSource getElectricDamage() {
return ELECTRIC;
Expand All @@ -37,16 +34,4 @@ public static DamageSource getFrostDamage() {
public static DamageSource getTurbineDamage() {
return TURBINE;
}

public static DamageSource getCrusherDamage() {
return CRUSHER;
}

public static DamageSource causeElectricDamage(EntityLivingBase damager) {
return new EntityDamageSource(ELECTRIC.getDamageType(), damager).setDamageBypassesArmor();
}

public static DamageSource causeCombatDamage(String type, EntityLivingBase damager) {
return new EntityDamageSource(type, damager);
}
}
}
2 changes: 2 additions & 0 deletions src/main/java/gregtech/api/gui/GuiTextures.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class GuiTextures {
public static final TextureArea SLOT_DARKENED = TextureArea.fullImage("textures/gui/base/darkened_slot.png");

//FLUID & ITEM OUTPUT BUTTONS
public static final TextureArea BLOCKS_INPUT = TextureArea.fullImage("textures/gui/widget/button_blocks_input.png");
public static final TextureArea BUTTON = TextureArea.fullImage("textures/gui/widget/button.png");
public static final TextureArea BUTTON_ALLOW_IMPORT_EXPORT = TextureArea.fullImage("textures/gui/widget/button_allow_import_export.png");
public static final TextureArea BUTTON_BLACKLIST = TextureArea.fullImage("textures/gui/widget/button_blacklist.png");
Expand All @@ -34,6 +35,7 @@ public class GuiTextures {
public static final TextureArea BUTTON_ITEM_OUTPUT = TextureArea.fullImage("textures/gui/widget/button_item_output.png");
public static final TextureArea BUTTON_OVERCLOCK = TextureArea.fullImage("textures/gui/widget/button_overclock.png");
public static final TextureArea BUTTON_SWITCH_VIEW = TextureArea.fullImage("textures/gui/widget/button_switch_view.png");
public static final TextureArea DISTRIBUTION_MODE = TextureArea.fullImage("textures/gui/widget/button_distribution_mode.png");
public static final TextureArea LOCK = TextureArea.fullImage("textures/gui/widget/lock.png");
public static final TextureArea SWITCH = TextureArea.fullImage("textures/gui/widget/switch.png");
public static final TextureArea SWITCH_HORIZONTAL = TextureArea.fullImage("textures/gui/widget/switch_horizontal.png");
Expand Down
Loading