-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from Snakefangox/master
Switched machines over to new tier system and added JSON and textures
- Loading branch information
Showing
142 changed files
with
998 additions
and
385 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 34 additions & 3 deletions
37
src/main/java/vivatech/block/AbstractTieredMachineBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,48 @@ | ||
package vivatech.block; | ||
|
||
import java.util.List; | ||
|
||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.minecraft.ChatFormat; | ||
import net.minecraft.client.item.TooltipContext; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.network.chat.TranslatableComponent; | ||
import net.minecraft.util.Identifier; | ||
import net.minecraft.world.BlockView; | ||
import vivatech.util.MachineTier; | ||
|
||
public abstract class AbstractTieredMachineBlock extends AbstractMachineBlock { | ||
|
||
public final MachineTier TIER; | ||
protected final MachineTier tier; | ||
protected final String id; | ||
|
||
public AbstractTieredMachineBlock(Settings settings, MachineTier tier) { | ||
public AbstractTieredMachineBlock(Settings settings, String id, MachineTier tier) { | ||
super(settings); | ||
TIER = tier; | ||
this.id = id; | ||
this.tier = tier; | ||
} | ||
|
||
public abstract Identifier getTieredID(); | ||
|
||
@Override | ||
public String getTranslationKey() { | ||
return "block.vivatech."+id; | ||
} | ||
|
||
@Environment(EnvType.CLIENT) | ||
@Override | ||
public void buildTooltip(ItemStack itemStack_1, BlockView blockView_1, List<Component> list_1, TooltipContext tooltipContext_1) { | ||
|
||
Component tierLine = new TranslatableComponent("info.vivatech.tier", new TranslatableComponent("info.vivatech.tier."+(tier.toString().toLowerCase()))); | ||
tierLine.applyFormat(ChatFormat.GRAY); | ||
list_1.add(tierLine); | ||
|
||
super.buildTooltip(itemStack_1, blockView_1, list_1, tooltipContext_1); | ||
} | ||
|
||
public MachineTier getMachineTier() { | ||
return tier; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 10 additions & 8 deletions
18
src/main/java/vivatech/entity/AbstractTieredMachineEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
package vivatech.entity; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraft.block.entity.BlockEntityType; | ||
import vivatech.block.AbstractTieredMachineBlock; | ||
import vivatech.util.MachineTier; | ||
|
||
public abstract class AbstractTieredMachineEntity extends AbstractMachineEntity { | ||
|
||
public MachineTier TIER; | ||
|
||
public AbstractTieredMachineEntity(BlockEntityType<?> type, MachineTier tier) { | ||
super(type); | ||
TIER = tier; | ||
} | ||
|
||
public AbstractTieredMachineEntity(BlockEntityType<?> type) { | ||
super(type); | ||
} | ||
|
||
public MachineTier getMachineTier() { | ||
Block block = world.getBlockState(pos).getBlock(); | ||
if (block instanceof AbstractTieredMachineBlock) { | ||
return ((AbstractTieredMachineBlock)block).getMachineTier(); | ||
} else { | ||
return MachineTier.MINIMAL; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.