Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import gregtech.api.unification.material.properties.OreProperty;
import gregtech.api.unification.material.properties.PolymerProperty;
import gregtech.api.unification.material.properties.PropertyKey;
import gregtech.api.unification.material.properties.RawOreProperty;
import gregtech.api.unification.material.properties.RotorProperty;
import gregtech.api.unification.material.properties.WireProperties;
import gregtech.api.unification.material.properties.WoodProperty;
Expand Down Expand Up @@ -1040,21 +1041,25 @@ public Builder blast(UnaryOperator<BlastProperty.Builder> b) {

public Builder ore() {
properties.ensureSet(PropertyKey.ORE);
properties.ensureSet(PropertyKey.RAW_ORE);
return this;
}

public Builder ore(boolean emissive) {
properties.setProperty(PropertyKey.ORE, new OreProperty(1, 1, emissive));
properties.setProperty(PropertyKey.RAW_ORE, new RawOreProperty(1, 1));
return this;
}

public Builder ore(int oreMultiplier, int byproductMultiplier) {
properties.setProperty(PropertyKey.ORE, new OreProperty(oreMultiplier, byproductMultiplier));
properties.setProperty(PropertyKey.RAW_ORE, new RawOreProperty(oreMultiplier, byproductMultiplier));
return this;
}

public Builder ore(int oreMultiplier, int byproductMultiplier, boolean emissive) {
properties.setProperty(PropertyKey.ORE, new OreProperty(oreMultiplier, byproductMultiplier, emissive));
properties.setProperty(PropertyKey.RAW_ORE, new RawOreProperty(oreMultiplier, byproductMultiplier));
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public class MaterialIconType {
public static final MaterialIconType dustImpure = new MaterialIconType("dustImpure");
public static final MaterialIconType dustPure = new MaterialIconType("dustPure");

public static final MaterialIconType rawOre = new MaterialIconType("rawOre");

public static final MaterialIconType crushed = new MaterialIconType("crushed");
public static final MaterialIconType crushedPurified = new MaterialIconType("crushedPurified");
public static final MaterialIconType crushedCentrifuged = new MaterialIconType("crushedCentrifuged");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class PropertyKey<T extends IMaterialProperty> {
public static final PropertyKey<ItemPipeProperties> ITEM_PIPE = new PropertyKey<>("item_pipe",
ItemPipeProperties.class);
public static final PropertyKey<OreProperty> ORE = new PropertyKey<>("ore", OreProperty.class);
public static final PropertyKey<RawOreProperty> RAW_ORE = new PropertyKey<>("raw_ore", RawOreProperty.class);
public static final PropertyKey<MaterialToolProperty> TOOL = new PropertyKey<>("tool", MaterialToolProperty.class);
public static final PropertyKey<ExtraToolProperty> EXTRATOOL = new PropertyKey<>("extra_tool",
ExtraToolProperty.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
package gregtech.api.unification.material.properties;

import gregtech.api.unification.material.Material;

import net.minecraft.util.math.MathHelper;

import org.apache.commons.lang3.tuple.Pair;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

public class RawOreProperty implements IMaterialProperty {

/**
* List of Ore byproducts.
* <p>
* Default: none, meaning only this property's Material.
*/
// @ZenProperty
private final List<Material> oreByProducts = new ArrayList<>();

/**
* Crushed Ore output amount multiplier during Maceration.
* <p>
* Default: 1 (no multiplier).
*/
// @ZenProperty
private int oreMultiplier;

/**
* Byproducts output amount multiplier during Maceration.
* <p>
* Default: 1 (no multiplier).
*/
// @ZenProperty
private int byProductMultiplier;

/**
* Material to which smelting of this Ore will result.
* <p>
* Material will have a Dust Property.
* Default: none.
*/
// @ZenProperty
@Nullable
private Material directSmeltResult;

/**
* Material in which this Ore should be washed to give additional output.
* <p>
* Material will have a Fluid Property.
* Default: none.
*/
// @ZenProperty
@Nullable
private Material washedIn;

/**
* The amount of Material that the ore should be washed in
* in the Chemical Bath.
* <p>
* Default 100 mb
*/
private int washedAmount = 100;

/**
* During Electromagnetic Separation, this Ore will be separated
* into this Material and the Material specified by this field.
* Limit 2 Materials
* <p>
* Material will have a Dust Property.
* Default: none.
*/
// @ZenProperty
private final List<Material> separatedInto = new ArrayList<>();

public RawOreProperty(int oreMultiplier, int byProductMultiplier) {
this.oreMultiplier = oreMultiplier;
this.byProductMultiplier = byProductMultiplier;
}

/**
* Default values constructor.
*/
public RawOreProperty() {
this(1, 1);
}

public void setOreMultiplier(int multiplier) {
this.oreMultiplier = multiplier;
}

public int getOreMultiplier() {
return this.oreMultiplier;
}

public void setByProductMultiplier(int multiplier) {
this.byProductMultiplier = multiplier;
}

public int getByProductMultiplier() {
return this.byProductMultiplier;
}

public void setDirectSmeltResult(@Nullable Material m) {
this.directSmeltResult = m;
}

@Nullable
public Material getDirectSmeltResult() {
return this.directSmeltResult;
}

public void setWashedIn(@Nullable Material m) {
this.washedIn = m;
}

public void setWashedIn(@Nullable Material m, int washedAmount) {
this.washedIn = m;
this.washedAmount = washedAmount;
}

public Pair<Material, Integer> getWashedIn() {
return Pair.of(this.washedIn, this.washedAmount);
}

public void setSeparatedInto(Material... materials) {
this.separatedInto.addAll(Arrays.asList(materials));
}

@Nullable
public List<Material> getSeparatedInto() {
return this.separatedInto;
}

/**
* Set the ore byproducts for this property
*
* @param materials the materials to use as byproducts
*/
public void setOreByProducts(@NotNull Material... materials) {
setOreByProducts(Arrays.asList(materials));
}

/**
* Set the ore byproducts for this property
*
* @param materials the materials to use as byproducts
*/
public void setOreByProducts(@NotNull Collection<Material> materials) {
this.oreByProducts.clear();
this.oreByProducts.addAll(materials);
}

/**
* Add ore byproducts to this property
*
* @param materials the materials to add as byproducts
*/
public void addOreByProducts(@NotNull Material... materials) {
this.oreByProducts.addAll(Arrays.asList(materials));
}

public List<Material> getOreByProducts() {
return this.oreByProducts;
}

@Nullable
public final Material getOreByProduct(int index) {
if (this.oreByProducts.isEmpty()) return null;
return this.oreByProducts.get(MathHelper.clamp(index, 0, this.oreByProducts.size() - 1));
}

@NotNull
public final Material getOreByProduct(int index, @NotNull Material fallback) {
Material material = getOreByProduct(index);
return material != null ? material : fallback;
}

@Override
public void verifyProperty(MaterialProperties properties) {
properties.ensureSet(PropertyKey.DUST, true);

if (directSmeltResult != null) directSmeltResult.getProperties().ensureSet(PropertyKey.DUST, true);
if (washedIn != null) washedIn.getProperties().ensureSet(PropertyKey.FLUID, true);
separatedInto.forEach(m -> m.getProperties().ensureSet(PropertyKey.DUST, true));
oreByProducts.forEach(m -> m.getProperties().ensureSet(PropertyKey.DUST, true));
}
}
2 changes: 2 additions & 0 deletions src/main/java/gregtech/api/unification/ore/OrePrefix.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public class OrePrefix {
mat -> Collections.singletonList(I18n.format("metaitem.dust.tooltip.purify")));
public static final OrePrefix dust = new OrePrefix("dust", M, null, MaterialIconType.dust, ENABLE_UNIFICATION,
hasDustProperty);
public static final OrePrefix rawOre = new OrePrefix("oreRaw", M, null, MaterialIconType.rawOre, ENABLE_UNIFICATION, hasRawOreProperty);

// A Nugget. Introduced by Eloraam
public static final OrePrefix nugget = new OrePrefix("nugget", M / 9, null, MaterialIconType.nugget,
Expand Down Expand Up @@ -341,6 +342,7 @@ public static class Conditions {
public static final Predicate<Material> hasOreProperty = mat -> mat.hasProperty(PropertyKey.ORE);
public static final Predicate<Material> hasGemProperty = mat -> mat.hasProperty(PropertyKey.GEM);
public static final Predicate<Material> hasDustProperty = mat -> mat.hasProperty(PropertyKey.DUST);
public static final Predicate<Material> hasRawOreProperty = mat -> mat.hasProperty(PropertyKey.RAW_ORE);
public static final Predicate<Material> hasIngotProperty = mat -> mat.hasProperty(PropertyKey.INGOT);
public static final Predicate<Material> hasBlastProperty = mat -> mat.hasProperty(PropertyKey.BLAST);
public static final Predicate<Material> hasRotorProperty = mat -> mat.hasProperty(PropertyKey.ROTOR);
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/gregtech/common/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import gregtech.common.blocks.MetaBlocks;
import gregtech.common.blocks.OreItemBlock;
import gregtech.common.blocks.StoneVariantBlock;
import gregtech.api.util.Mods;
import gregtech.common.items.MetaItems;
import gregtech.common.items.ToolItems;
import gregtech.common.pipelike.cable.BlockCable;
Expand All @@ -47,6 +48,7 @@
import gregtech.common.pipelike.optical.ItemBlockOpticalPipe;
import gregtech.datafix.GTDataFixers;
import gregtech.integration.groovy.GroovyScriptModule;
import gregtech.integration.jei.basic.OreByProduct;
import gregtech.loaders.MaterialInfoLoader;
import gregtech.loaders.OreDictionaryLoader;
import gregtech.loaders.recipe.CraftingComponent;
Expand Down Expand Up @@ -254,7 +256,12 @@ public static void registerItems(RegistryEvent.Register<Item> event) {
for (IGTTool tool : ToolItems.getAllTools()) {
registry.register(tool.get());
}


if (Mods.JustEnoughItems.isModLoaded())
{
OreByProduct.addOreByProductPrefix(OrePrefix.rawOre);
}

GTRecipeManager.preLoad();

for (MTERegistry r : GregTechAPI.mteManager.getRegistries()) {
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/gregtech/common/blocks/BlockOre.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package gregtech.common.blocks;

import gregtech.api.GTValues;
import gregtech.api.items.toolitem.ToolClasses;
import gregtech.api.unification.OreDictUnifier;
import gregtech.api.unification.material.Material;
import gregtech.api.unification.material.info.MaterialFlags;
import gregtech.api.unification.material.properties.PropertyKey;
import gregtech.api.unification.ore.OrePrefix;
import gregtech.api.unification.ore.StoneType;
import gregtech.api.unification.ore.StoneTypes;
import gregtech.api.util.GTUtility;
Expand All @@ -28,6 +31,7 @@
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.relauncher.Side;
Expand Down Expand Up @@ -96,6 +100,26 @@ public Item getItemDropped(@NotNull IBlockState state, @NotNull Random rand, int
IBlockState stoneOre = OreConfigUtils.getOreForMaterial(this.material).get(StoneTypes.STONE);
return Item.getItemFromBlock(stoneOre.getBlock());
}

@Override
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
{
if(fortune > 0)
{
int i = GTValues.RNG.nextInt((fortune + 2) - 1);

if (i < 0)
{
i = 0;
}

drops.add(OreDictUnifier.get(OrePrefix.rawOre, material, i + 1));
}
else
{
drops.add(OreDictUnifier.get(OrePrefix.rawOre, material, 1));
}
}

@Override
public int damageDropped(@NotNull IBlockState state) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/gregtech/common/items/MetaItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ private MetaItems() {}
orePrefixes.add(OrePrefix.dustTiny);
orePrefixes.add(OrePrefix.dustImpure);
orePrefixes.add(OrePrefix.dustPure);
orePrefixes.add(OrePrefix.rawOre);
orePrefixes.add(OrePrefix.crushed);
orePrefixes.add(OrePrefix.crushedPurified);
orePrefixes.add(OrePrefix.crushedCentrifuged);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public static void register() {
OrePrefix.oreRedSand.addProcessingHandler(PropertyKey.ORE, OreRecipeHandler::processOre);
}

OrePrefix.rawOre.addProcessingHandler(PropertyKey.ORE, OreRecipeHandler::processOre);

OrePrefix.crushed.addProcessingHandler(PropertyKey.ORE, OreRecipeHandler::processCrushedOre);
OrePrefix.crushedPurified.addProcessingHandler(PropertyKey.ORE, OreRecipeHandler::processCrushedPurified);
OrePrefix.crushedCentrifuged.addProcessingHandler(PropertyKey.ORE, OreRecipeHandler::processCrushedCentrifuged);
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/gregtech/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -1480,6 +1480,7 @@ item.material.oreprefix.dustSmall=Small Pile of %s Dust
item.material.oreprefix.dustImpure=Impure Pile of %s Dust
item.material.oreprefix.dustPure=Purified Pile of %s Dust
item.material.oreprefix.dust=%s Dust
item.material.oreprefix.oreRaw=Raw %s Ore
item.material.oreprefix.nugget=%s Nugget
item.material.oreprefix.plateDense=Dense %s Plate
item.material.oreprefix.plateDouble=Double %s Plate
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "gregtech:items/material_sets/diamond/raw_ore"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "gregtech:items/material_sets/dull/raw_ore"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "gregtech:items/material_sets/fine/raw_ore"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "gregtech:items/material_sets/metallic/raw_ore"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "gregtech:items/material_sets/shiny/raw_ore"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.