Skip to content

Commit

Permalink
2.1.6
Browse files Browse the repository at this point in the history
* Fixed a bug causing fluids not to appear in JEI and Modded Tanks.
* Fixed a bug where Fortune was not affecting Ore Drops as expected.
* Added support for Uniformed Count drop (similar to Vanilla Redstone).
* Fixed couple unclosed streams causing log spam. (Credit: Kanzaji)
  • Loading branch information
Ridanisaurus committed Jan 7, 2024
1 parent ee7ef05 commit f0381b6
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 32 deletions.
7 changes: 5 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Emendatus Enigmatica
#### MC 1.19.2 | Version 2.1.5
#### MC 1.19.2 | Version 2.1.6

* Fixed a bug caused by the Enigmatic Hammer's Lang datagen.
* Fixed a bug causing fluids not to appear in JEI and Modded Tanks.
* Fixed a bug where Fortune was not affecting Ore Drops as expected.
* Added support for Uniformed Count drop (similar to Vanilla Redstone).
* Fixed couple unclosed streams causing log spam. (Credit: Kanzaji)
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mod_version=2.1.5
mod_version=2.1.6
curseforge_id=399630

mc_version=1.19.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,43 +94,79 @@ protected void addTables() {
if (processedType.contains("ore") && material.getProperties().getMaterialType().equals("metal")) {
if (material.getOreDrop().getMax() == 1) {
blockLootTable.put(EERegistrar.oreBlockTable.get(stratum.getId(), material.getId()).get(),
specialDrop(EERegistrar.oreBlockTable.get(stratum.getId(), material.getId()).get(),
oreDrop(EERegistrar.oreBlockTable.get(stratum.getId(), material.getId()).get(),
(processedType.contains("raw") && material.getOreDrop().getDrop().isEmpty() ? EERegistrar.rawMap.get(material.getId()).get() : material.getOreDrop().getDefaultItemDropAsItem().asItem()))
);
} else {
blockLootTable.put(EERegistrar.oreBlockTable.get(stratum.getId(), material.getId()).get(),
specialCountDrop(EERegistrar.oreBlockTable.get(stratum.getId(), material.getId()).get(),
(processedType.contains("raw") && material.getOreDrop().getDrop().isEmpty() ? EERegistrar.rawMap.get(material.getId()).get() : material.getOreDrop().getDefaultItemDropAsItem()),
UniformGenerator.between(material.getOreDrop().getMin(), material.getOreDrop().getMax()))
);
if (material.getOreDrop().isUniformCount()) {
blockLootTable.put(EERegistrar.oreBlockTable.get(stratum.getId(), material.getId()).get(),
oreUniformedDrop(EERegistrar.oreBlockTable.get(stratum.getId(), material.getId()).get(),
(processedType.contains("raw") && material.getOreDrop().getDrop().isEmpty() ? EERegistrar.rawMap.get(material.getId()).get() : material.getOreDrop().getDefaultItemDropAsItem()),
UniformGenerator.between(material.getOreDrop().getMin(), material.getOreDrop().getMax()))
);
}
else {
blockLootTable.put(EERegistrar.oreBlockTable.get(stratum.getId(), material.getId()).get(),
oreCountDrop(EERegistrar.oreBlockTable.get(stratum.getId(), material.getId()).get(),
(processedType.contains("raw") && material.getOreDrop().getDrop().isEmpty() ? EERegistrar.rawMap.get(material.getId()).get() : material.getOreDrop().getDefaultItemDropAsItem()),
UniformGenerator.between(material.getOreDrop().getMin(), material.getOreDrop().getMax()))
);
}
}
}
if (processedType.contains("ore") && material.getProperties().getMaterialType().equals("gem")) {
if (material.getOreDrop().getMax() == 1) {
blockLootTable.put(EERegistrar.oreBlockTable.get(stratum.getId(), material.getId()).get(),
specialDrop(EERegistrar.oreBlockTable.get(stratum.getId(), material.getId()).get(),
oreDrop(EERegistrar.oreBlockTable.get(stratum.getId(), material.getId()).get(),
(processedType.contains("gem") && material.getOreDrop().getDrop().isEmpty() ? EERegistrar.gemMap.get(material.getId()).get() : material.getOreDrop().getDefaultItemDropAsItem().asItem()))
);
} else {
blockLootTable.put(EERegistrar.oreBlockTable.get(stratum.getId(), material.getId()).get(),
specialCountDrop(EERegistrar.oreBlockTable.get(stratum.getId(), material.getId()).get(),
(processedType.contains("gem") && material.getOreDrop().getDrop().isEmpty() ? EERegistrar.gemMap.get(material.getId()).get() : material.getOreDrop().getDefaultItemDropAsItem()),
UniformGenerator.between(material.getOreDrop().getMin(), material.getOreDrop().getMax()))
);
if (material.getOreDrop().isUniformCount()) {
blockLootTable.put(EERegistrar.oreBlockTable.get(stratum.getId(), material.getId()).get(),
oreUniformedDrop(EERegistrar.oreBlockTable.get(stratum.getId(), material.getId()).get(),
(processedType.contains("gem") && material.getOreDrop().getDrop().isEmpty() ? EERegistrar.gemMap.get(material.getId()).get() : material.getOreDrop().getDefaultItemDropAsItem()),
UniformGenerator.between(material.getOreDrop().getMin(), material.getOreDrop().getMax()))
);
}
else {
if (material.getOreDrop().isUniformCount()) {
blockLootTable.put(EERegistrar.oreBlockTable.get(stratum.getId(), material.getId()).get(),
oreUniformedDrop(EERegistrar.oreBlockTable.get(stratum.getId(), material.getId()).get(),
(processedType.contains("gem") && material.getOreDrop().getDrop().isEmpty() ? EERegistrar.gemMap.get(material.getId()).get() : material.getOreDrop().getDefaultItemDropAsItem()),
UniformGenerator.between(material.getOreDrop().getMin(), material.getOreDrop().getMax()))
);
}
else {
blockLootTable.put(EERegistrar.oreBlockTable.get(stratum.getId(), material.getId()).get(),
oreCountDrop(EERegistrar.oreBlockTable.get(stratum.getId(), material.getId()).get(),
(processedType.contains("gem") && material.getOreDrop().getDrop().isEmpty() ? EERegistrar.gemMap.get(material.getId()).get() : material.getOreDrop().getDefaultItemDropAsItem()),
UniformGenerator.between(material.getOreDrop().getMin(), material.getOreDrop().getMax()))
);
}
}
}
}
if (processedType.contains("ore") && stratum.getSampleStrata()) {
if (material.getOreDrop().getMax() == 1) {
blockLootTable.put(EERegistrar.oreSampleBlockTable.get(stratum.getId(), material.getId()).get(),
specialDrop(EERegistrar.oreSampleBlockTable.get(stratum.getId(), material.getId()).get(),
oreDrop(EERegistrar.oreSampleBlockTable.get(stratum.getId(), material.getId()).get(),
(processedType.contains("raw") && material.getOreDrop().getDrop().isEmpty() ? EERegistrar.rawMap.get(material.getId()).get() : material.getOreDrop().getDefaultItemDropAsItem().asItem()))
);
} else {
blockLootTable.put(EERegistrar.oreSampleBlockTable.get(stratum.getId(), material.getId()).get(),
specialCountDrop(EERegistrar.oreSampleBlockTable.get(stratum.getId(), material.getId()).get(),
(processedType.contains("raw") && material.getOreDrop().getDrop().isEmpty() ? EERegistrar.rawMap.get(material.getId()).get() : material.getOreDrop().getDefaultItemDropAsItem()),
UniformGenerator.between(material.getOreDrop().getMin(), material.getOreDrop().getMax()))
);
if (material.getOreDrop().isUniformCount()) {
blockLootTable.put(EERegistrar.oreSampleBlockTable.get(stratum.getId(), material.getId()).get(),
oreUniformedDrop(EERegistrar.oreSampleBlockTable.get(stratum.getId(), material.getId()).get(),
(processedType.contains("raw") && material.getOreDrop().getDrop().isEmpty() ? EERegistrar.rawMap.get(material.getId()).get() : material.getOreDrop().getDefaultItemDropAsItem()),
UniformGenerator.between(material.getOreDrop().getMin(), material.getOreDrop().getMax()))
);
}
else {
blockLootTable.put(EERegistrar.oreSampleBlockTable.get(stratum.getId(), material.getId()).get(),
oreCountDrop(EERegistrar.oreSampleBlockTable.get(stratum.getId(), material.getId()).get(),
(processedType.contains("raw") && material.getOreDrop().getDrop().isEmpty() ? EERegistrar.rawMap.get(material.getId()).get() : material.getOreDrop().getDefaultItemDropAsItem()),
UniformGenerator.between(material.getOreDrop().getMin(), material.getOreDrop().getMax()))
);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.block.Block;
Expand Down Expand Up @@ -119,7 +118,7 @@ protected static LootTable.Builder dropWhenSilkTouchWithSetCount(Block block, It
);
}

protected static LootTable.Builder specialDrop(Block block, Item item) {
protected static LootTable.Builder oreDrop(Block block, Item item) {
return LootTable.lootTable().withPool(LootPool.lootPool()
.setRolls(ConstantValue.exactly(1))
.add(LootItem.lootTableItem(block).when(HAS_SILK_TOUCH).otherwise(LootItem.lootTableItem(item.asItem())
Expand All @@ -129,12 +128,23 @@ protected static LootTable.Builder specialDrop(Block block, Item item) {
);
}

protected static LootTable.Builder specialCountDrop(Block block, ItemLike item, UniformGenerator range) {
protected static LootTable.Builder oreCountDrop(Block block, ItemLike item, UniformGenerator range) {
return LootTable.lootTable().withPool(LootPool.lootPool()
.setRolls(ConstantValue.exactly(1))
.setRolls(ConstantValue.exactly(1.0F))
.add(LootItem.lootTableItem(block).when(HAS_SILK_TOUCH).otherwise(LootItem.lootTableItem(item.asItem())
.apply(SetItemCountFunction.setCount(range))
.apply(ApplyBonusCount.addOreBonusCount(Enchantments.BLOCK_FORTUNE))
.apply(ApplyExplosionDecay.explosionDecay())
))
);
}

protected static LootTable.Builder oreUniformedDrop(Block block, ItemLike item, UniformGenerator range) {
return LootTable.lootTable().withPool(LootPool.lootPool()
.setRolls(ConstantValue.exactly(1.0F))
.add(LootItem.lootTableItem(block).when(HAS_SILK_TOUCH).otherwise(LootItem.lootTableItem(item.asItem())
.apply(ApplyBonusCount.addUniformBonusCount(Enchantments.BLOCK_FORTUNE))
.apply(SetItemCountFunction.setCount(range))
.apply(ApplyBonusCount.addUniformBonusCount(Enchantments.BLOCK_FORTUNE))
.apply(ApplyExplosionDecay.explosionDecay())
))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,32 @@ public class MaterialOreDropModel {
public static final Codec<MaterialOreDropModel> CODEC = RecordCodecBuilder.create(x -> x.group(
Codec.STRING.optionalFieldOf("drop").forGetter(i -> Optional.ofNullable(i.drop)),
Codec.INT.optionalFieldOf("min").forGetter(i -> Optional.of(i.min)),
Codec.INT.optionalFieldOf("max").forGetter(i -> Optional.of(i.max))
).apply(x, (drop, min, max) -> new MaterialOreDropModel(
Codec.INT.optionalFieldOf("max").forGetter(i -> Optional.of(i.max)),
Codec.BOOL.optionalFieldOf("uniformCount").forGetter(i -> Optional.of(i.uniformCount))
).apply(x, (drop, min, max, uniformCount) -> new MaterialOreDropModel(
drop.orElse(""),
min.orElse(1),
max.orElse(1)
max.orElse(1),
uniformCount.orElse(false)
)));

private final String drop;
private final int min;
private final int max;
private final boolean uniformCount;

public MaterialOreDropModel(String drop, int min, int max) {
public MaterialOreDropModel(String drop, int min, int max, boolean uniformCount) {
this.drop = drop;
this.min = min;
this.max = max;
this.uniformCount = uniformCount;
}

public MaterialOreDropModel() {
this.drop = "";
this.min = 1;
this.max = 1;
this.uniformCount = false;
}

public String getDrop() {
Expand All @@ -71,6 +76,10 @@ public int getMax() {
return max;
}

public boolean isUniformCount() {
return uniformCount;
}

public ItemLike getDefaultItemDropAsItem() {
return ForgeRegistries.ITEMS.getValue(new ResourceLocation(drop));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

public class ColorHelper {
public static int HEXtoDEC(String hex) {
return Integer.parseInt(hex, 16);
return Integer.parseInt(hex, 16) | 0xFF000000;
}

public static Color HEXtoColor(String hex) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ issueTrackerURL="https://github.com/Ridanisaurus/Emendatus-Enigmatica/issues"

[[mods]]
modId="emendatusenigmatica"
version="1.19.2-2.1.5"
version="1.19.2-2.1.6"
displayName="Emendatus Enigmatica"
displayURL="https://github.com/Ridanisaurus/Emendatus-Enigmatica"
logoFile= "ee_logo.png"
Expand Down

0 comments on commit f0381b6

Please sign in to comment.