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

View file

@ -24,6 +24,7 @@
package techreborn.events;
import com.google.common.collect.Maps;
import net.fabricmc.fabric.api.event.client.ItemTooltipCallback;
import net.minecraft.block.Block;
import net.minecraft.block.BlockEntityProvider;
@ -54,10 +55,12 @@ import techreborn.utils.WIP;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class StackToolTipHandler implements ItemTooltipCallback {
private static ArrayList<Block> wipBlocks = new ArrayList<>();
public static final Map<Item, Boolean> ITEM_ID = Maps.newHashMap();
public static void setup() {
ItemTooltipCallback.EVENT.register(new StackToolTipHandler());
@ -70,8 +73,10 @@ public class StackToolTipHandler implements ItemTooltipCallback {
@Override
public void getTooltip(ItemStack stack, TooltipContext tooltipContext, List<Text> components) {
Item item = stack.getItem();
if (!ITEM_ID.computeIfAbsent(item, this::isTRItem))
return;
// Machine info and upgrades helper section
Block block = Block.getBlockFromItem(item);
@ -131,7 +136,11 @@ 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) {
if (CurrentValue == 0)
return 0;

View file

@ -48,7 +48,8 @@ public class ModLoot {
LootEntry advancedalloyIngot = makeEntry(Ingots.ADVANCED_ALLOY);
LootEntry basicFrame = makeEntry(TRContent.MachineBlocks.BASIC.frame.asItem());
LootEntry basicCircuit = makeEntry(Parts.ELECTRONIC_CIRCUIT);
LootEntry rubberSapling = makeEntry(TRContent.RUBBER_SAPLING, 25);
LootEntry aluminumIngot = makeEntry(Ingots.ALUMINUM);
LootEntry electrumIngot = makeEntry(Ingots.ELECTRUM);
LootEntry invarIngot = makeEntry(Ingots.INVAR);
@ -73,7 +74,7 @@ public class ModLoot {
LootPool poolBasic = FabricLootPoolBuilder.builder().withEntry(copperIngot).withEntry(tinIngot)
.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();
LootPool poolAdvanced = FabricLootPoolBuilder.builder().withEntry(aluminumIngot).withEntry(electrumIngot)
@ -137,8 +138,18 @@ public class ModLoot {
* @return LootEntry for item provided
*/
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();
}

View file

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