Merge remote-tracking branch 'remotes/origin/1.15' into 1.16

# Conflicts:
#	build.gradle
#	src/main/java/techreborn/init/ModLoot.java
This commit is contained in:
modmuss50 2020-06-01 22:25:00 +01:00
commit bbc4b2b765
4 changed files with 39 additions and 12 deletions

View file

@ -65,10 +65,6 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
private SolarPanels panel; private SolarPanels panel;
public SolarPanelBlockEntity() {
super(TRBlockEntities.SOLAR_PANEL);
}
public SolarPanelBlockEntity(SolarPanels panel) { public SolarPanelBlockEntity(SolarPanels panel) {
super(TRBlockEntities.SOLAR_PANEL); super(TRBlockEntities.SOLAR_PANEL);
this.panel = panel; this.panel = panel;
@ -103,6 +99,9 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
} }
private void updateState() { private void updateState() {
if (world == null) {
return;
}
if (world.isSkyVisible(pos.up())) { if (world.isSkyVisible(pos.up())) {
this.setSunState(NIGHTGEN); this.setSunState(NIGHTGEN);
@ -112,6 +111,10 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
} else { } else {
this.setSunState(ZEROGEN); this.setSunState(ZEROGEN);
} }
// Nether and The End
if (!world.dimension.hasSkyLight()) {
this.setSunState(NIGHTGEN);
}
if (prevState != this.getSunState()) { if (prevState != this.getSunState()) {
boolean isGenerating = getSunState() == DAYGEN; boolean isGenerating = getSunState() == DAYGEN;
@ -143,6 +146,10 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
public void tick() { public void tick() {
super.tick(); super.tick();
if (world == null){
return;
}
if (world.isClient) { if (world.isClient) {
return; return;
} }

View file

@ -24,6 +24,7 @@
package techreborn.events; package techreborn.events;
import com.google.common.collect.Maps;
import net.fabricmc.fabric.api.event.client.ItemTooltipCallback; import net.fabricmc.fabric.api.event.client.ItemTooltipCallback;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockEntityProvider; import net.minecraft.block.BlockEntityProvider;
@ -54,10 +55,12 @@ import techreborn.utils.WIP;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
public class StackToolTipHandler implements ItemTooltipCallback { public class StackToolTipHandler implements ItemTooltipCallback {
private static ArrayList<Block> wipBlocks = new ArrayList<>(); private static ArrayList<Block> wipBlocks = new ArrayList<>();
public static final Map<Item, Boolean> ITEM_ID = Maps.newHashMap();
public static void setup() { public static void setup() {
ItemTooltipCallback.EVENT.register(new StackToolTipHandler()); ItemTooltipCallback.EVENT.register(new StackToolTipHandler());
@ -71,6 +74,8 @@ public class StackToolTipHandler implements ItemTooltipCallback {
public void getTooltip(ItemStack stack, TooltipContext tooltipContext, List<Text> components) { public void getTooltip(ItemStack stack, TooltipContext tooltipContext, List<Text> components) {
Item item = stack.getItem(); Item item = stack.getItem();
if (!ITEM_ID.computeIfAbsent(item, this::isTRItem))
return;
// Machine info and upgrades helper section // Machine info and upgrades helper section
Block block = Block.getBlockFromItem(item); Block block = Block.getBlockFromItem(item);
@ -132,6 +137,10 @@ public class StackToolTipHandler implements ItemTooltipCallback {
} }
} }
private boolean isTRItem(Item item) {
return Registry.ITEM.getId(item).getNamespace().equals("techreborn");
}
public int percentage(int MaxValue, int CurrentValue) { public int percentage(int MaxValue, int CurrentValue) {
if (CurrentValue == 0) if (CurrentValue == 0)
return 0; return 0;

View file

@ -48,6 +48,7 @@ public class ModLoot {
LootEntry advancedalloyIngot = makeEntry(Ingots.ADVANCED_ALLOY); LootEntry advancedalloyIngot = makeEntry(Ingots.ADVANCED_ALLOY);
LootEntry basicFrame = makeEntry(TRContent.MachineBlocks.BASIC.frame.asItem()); LootEntry basicFrame = makeEntry(TRContent.MachineBlocks.BASIC.frame.asItem());
LootEntry basicCircuit = makeEntry(Parts.ELECTRONIC_CIRCUIT); LootEntry basicCircuit = makeEntry(Parts.ELECTRONIC_CIRCUIT);
LootEntry rubberSapling = makeEntry(TRContent.RUBBER_SAPLING, 25);
LootEntry aluminumIngot = makeEntry(Ingots.ALUMINUM); LootEntry aluminumIngot = makeEntry(Ingots.ALUMINUM);
LootEntry electrumIngot = makeEntry(Ingots.ELECTRUM); LootEntry electrumIngot = makeEntry(Ingots.ELECTRUM);
@ -73,7 +74,7 @@ public class ModLoot {
LootPool poolBasic = FabricLootPoolBuilder.builder().withEntry(copperIngot).withEntry(tinIngot) LootPool poolBasic = FabricLootPoolBuilder.builder().withEntry(copperIngot).withEntry(tinIngot)
.withEntry(leadIngot).withEntry(silverIngot).withEntry(refinedronIngot).withEntry(advancedalloyIngot) .withEntry(leadIngot).withEntry(silverIngot).withEntry(refinedronIngot).withEntry(advancedalloyIngot)
.withEntry(basicFrame).withEntry(basicCircuit).rolls(UniformLootTableRange.between(1.0f, 2.0f)) .withEntry(basicFrame).withEntry(basicCircuit).withEntry(rubberSapling).rolls(UniformLootTableRange.between(1.0f, 2.0f))
.build(); .build();
LootPool poolAdvanced = FabricLootPoolBuilder.builder().withEntry(aluminumIngot).withEntry(electrumIngot) LootPool poolAdvanced = FabricLootPoolBuilder.builder().withEntry(aluminumIngot).withEntry(electrumIngot)
@ -137,8 +138,18 @@ public class ModLoot {
* @return LootEntry for item provided * @return LootEntry for item provided
*/ */
private static LootEntry makeEntry(ItemConvertible item) { private static LootEntry makeEntry(ItemConvertible item) {
return makeEntry(item, 5);
}
return ItemEntry.builder(item).weight(5) /**
* Makes loot entry from item provided with weight provided
*
* @param item Item to include into LootEntry
* @param weight Weight of that item
* @return LootEntry for item and weight provided
*/
private static LootEntry makeEntry(ItemConvertible item, int weight){
return ItemEntry.builder(item).weight(weight)
.apply(SetCountLootFunction.builder(UniformLootTableRange.between(1.0f, 2.0f))).build(); .apply(SetCountLootFunction.builder(UniformLootTableRange.between(1.0f, 2.0f))).build();
} }

View file

@ -1,7 +1,7 @@
{ {
"display": { "display": {
"icon": { "icon": {
"item": "techreborn:quantum_tank" "item": "techreborn:quantum_tank_unit"
}, },
"title": { "title": {
"translate": "advancements.techreborn.quantumtank" "translate": "advancements.techreborn.quantumtank"
@ -16,7 +16,7 @@
"crit1": { "crit1": {
"trigger": "minecraft:placed_block", "trigger": "minecraft:placed_block",
"conditions": { "conditions": {
"block": "techreborn:quantum_tank" "block": "techreborn:quantum_tank_unit"
} }
} }
} }