Skip to content

Commit

Permalink
Merge pull request #586 from refinedmods/feat/GH-368/vanilla-materials
Browse files Browse the repository at this point in the history
Quartz Enriched Copper
  • Loading branch information
raoulvdberge authored Jul 3, 2024
2 parents 8a27f41 + 7a66bd7 commit 504b6ef
Show file tree
Hide file tree
Showing 43 changed files with 142 additions and 47 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

- Ported to Minecraft 1.21.
- More help information for items.
- Quartz Enriched Copper, used to craft cables.
- Block of Quartz Enriched Copper

### Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@
import static com.refinedmods.refinedstorage2.platform.common.content.ContentIds.NETWORK_TRANSMITTER;
import static com.refinedmods.refinedstorage2.platform.common.content.ContentIds.PORTABLE_GRID;
import static com.refinedmods.refinedstorage2.platform.common.content.ContentIds.PROCESSOR_BINDING;
import static com.refinedmods.refinedstorage2.platform.common.content.ContentIds.QUARTZ_ENRICHED_COPPER;
import static com.refinedmods.refinedstorage2.platform.common.content.ContentIds.QUARTZ_ENRICHED_COPPER_BLOCK;
import static com.refinedmods.refinedstorage2.platform.common.content.ContentIds.QUARTZ_ENRICHED_IRON;
import static com.refinedmods.refinedstorage2.platform.common.content.ContentIds.QUARTZ_ENRICHED_IRON_BLOCK;
import static com.refinedmods.refinedstorage2.platform.common.content.ContentIds.REGULATOR_UPGRADE;
Expand Down Expand Up @@ -323,6 +325,7 @@ protected final void registerBlocks(
final BiFunction<BlockPos, BlockState, AbstractDiskInterfaceBlockEntity> diskInterfaceBlockEntityFactory
) {
Blocks.INSTANCE.setQuartzEnrichedIronBlock(callback.register(QUARTZ_ENRICHED_IRON_BLOCK, SimpleBlock::new));
Blocks.INSTANCE.setQuartzEnrichedCopperBlock(callback.register(QUARTZ_ENRICHED_COPPER_BLOCK, SimpleBlock::new));
Blocks.INSTANCE.setDiskDrive(
callback.register(DISK_DRIVE, () -> new DiskDriveBlock(diskDriveBlockEntityFactory))
);
Expand Down Expand Up @@ -393,10 +396,15 @@ protected final void registerItems(final RegistryCallback<Item> callback) {

private void registerSimpleItems(final RegistryCallback<Item> callback) {
Items.INSTANCE.setQuartzEnrichedIron(callback.register(QUARTZ_ENRICHED_IRON, SimpleItem::new));
Items.INSTANCE.setQuartzEnrichedCopper(callback.register(QUARTZ_ENRICHED_COPPER, SimpleItem::new));
callback.register(
QUARTZ_ENRICHED_IRON_BLOCK,
() -> new BaseBlockItem(Blocks.INSTANCE.getQuartzEnrichedIronBlock())
);
callback.register(
QUARTZ_ENRICHED_COPPER_BLOCK,
() -> new BaseBlockItem(Blocks.INSTANCE.getQuartzEnrichedCopperBlock())
);
Items.INSTANCE.setSilicon(callback.register(SILICON, SimpleItem::new));
Items.INSTANCE.setProcessorBinding(callback.register(PROCESSOR_BINDING, SimpleItem::new));
callback.register(DISK_DRIVE, () -> Blocks.INSTANCE.getDiskDrive().createBlockItem());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ public final class Blocks {
@Nullable
private Supplier<SimpleBlock> quartzEnrichedIronBlock;
@Nullable
private Supplier<SimpleBlock> quartzEnrichedCopperBlock;
@Nullable
private Supplier<DiskDriveBlock> diskDrive;
@Nullable
private Supplier<SimpleBlock> machineCasing;
Expand Down Expand Up @@ -189,6 +191,10 @@ public SimpleBlock getQuartzEnrichedIronBlock() {
return requireNonNull(quartzEnrichedIronBlock).get();
}

public SimpleBlock getQuartzEnrichedCopperBlock() {
return requireNonNull(quartzEnrichedCopperBlock).get();
}

public DiskDriveBlock getDiskDrive() {
return requireNonNull(diskDrive).get();
}
Expand Down Expand Up @@ -219,6 +225,10 @@ public void setQuartzEnrichedIronBlock(final Supplier<SimpleBlock> quartzEnriche
this.quartzEnrichedIronBlock = quartzEnrichedIronBlockSupplier;
}

public void setQuartzEnrichedCopperBlock(final Supplier<SimpleBlock> quartzEnrichedCopperBlockSupplier) {
this.quartzEnrichedCopperBlock = quartzEnrichedCopperBlockSupplier;
}

public void setDiskDrive(final Supplier<DiskDriveBlock> diskDriveSupplier) {
this.diskDrive = diskDriveSupplier;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ public final class ContentIds {
public static final ResourceLocation MACHINE_CASING = createIdentifier("machine_casing");
public static final ResourceLocation CABLE = createIdentifier("cable");
public static final ResourceLocation QUARTZ_ENRICHED_IRON_BLOCK = createIdentifier("quartz_enriched_iron_block");
public static final ResourceLocation QUARTZ_ENRICHED_COPPER_BLOCK = createIdentifier(
"quartz_enriched_copper_block"
);
public static final ResourceLocation QUARTZ_ENRICHED_IRON = createIdentifier("quartz_enriched_iron");
public static final ResourceLocation QUARTZ_ENRICHED_COPPER = createIdentifier("quartz_enriched_copper");
public static final ResourceLocation SILICON = createIdentifier("silicon");
public static final ResourceLocation PROCESSOR_BINDING = createIdentifier("processor_binding");
public static final ResourceLocation WRENCH = createIdentifier("wrench");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ private static void appendBlocks(final Consumer<ItemStack> consumer) {
));
itemConsumer.accept(Blocks.INSTANCE.getMachineCasing());
itemConsumer.accept(Blocks.INSTANCE.getQuartzEnrichedIronBlock());
itemConsumer.accept(Blocks.INSTANCE.getQuartzEnrichedCopperBlock());
itemConsumer.accept(Blocks.INSTANCE.getStorageMonitor());
Items.INSTANCE.getNetworkTransmitters().stream().map(Supplier::get).forEach(itemConsumer);
Items.INSTANCE.getNetworkReceivers().stream().map(Supplier::get).forEach(itemConsumer);
Expand All @@ -65,6 +66,7 @@ private static void appendBlockColors(final Consumer<ItemStack> consumer, final
private static void appendItems(final Consumer<ItemStack> consumer) {
final Consumer<ItemLike> itemConsumer = item -> consumer.accept(new ItemStack(item));
itemConsumer.accept(Items.INSTANCE.getQuartzEnrichedIron());
itemConsumer.accept(Items.INSTANCE.getQuartzEnrichedCopper());
itemConsumer.accept(Items.INSTANCE.getSilicon());
itemConsumer.accept(Items.INSTANCE.getProcessorBinding());
itemConsumer.accept(Items.INSTANCE.getWrench());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public final class Items {
@Nullable
private Supplier<Item> quartzEnrichedIron;
@Nullable
private Supplier<Item> quartzEnrichedCopper;
@Nullable
private Supplier<Item> silicon;
@Nullable
private Supplier<Item> processorBinding;
Expand Down Expand Up @@ -145,6 +147,14 @@ public Item getQuartzEnrichedIron() {
return requireNonNull(quartzEnrichedIron).get();
}

public void setQuartzEnrichedCopper(final Supplier<Item> supplier) {
this.quartzEnrichedCopper = supplier;
}

public Item getQuartzEnrichedCopper() {
return requireNonNull(quartzEnrichedCopper).get();
}

public void setSilicon(final Supplier<Item> supplier) {
this.silicon = supplier;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,17 @@
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;

public class ControllerModelPredicateProvider implements ClampedItemPropertyFunction {
public class ControllerItemPropertyFunction implements ClampedItemPropertyFunction {
@Override
public float unclampedCall(final ItemStack stack,
@Nullable final ClientLevel level,
@Nullable final LivingEntity entity,
final int seed) {
return PlatformApi.INSTANCE.getEnergyStorage(stack)
.map(energyStorage -> {
if (energyStorage.getStored() == 0) {
return 1F;
}
return (float) energyStorage.getStored() / (float) energyStorage.getCapacity();
})
.orElse(1F);
return PlatformApi.INSTANCE.getEnergyStorage(stack).map(energyStorage -> {
if (energyStorage.getStored() == 0) {
return 1F;
}
return (float) energyStorage.getStored() / (float) energyStorage.getCapacity();
}).orElse(1F);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "refinedstorage2:block/quartz_enriched_copper_block"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"mod.refinedstorage2": "Refined Storage 2",
"block.refinedstorage2.cable": "Cable",
"block.refinedstorage2.quartz_enriched_iron_block": "Block of Quartz Enriched Iron",
"block.refinedstorage2.quartz_enriched_copper_block": "Block of Quartz Enriched Copper",
"block.refinedstorage2.disk_drive": "Disk Drive",
"block.refinedstorage2.machine_casing": "Machine Casing",
"block.refinedstorage2.grid": "Grid",
Expand Down Expand Up @@ -178,6 +179,7 @@
"item.refinedstorage2.destructor.help": "Destroys blocks from the world and puts them in the storage network.",
"item.refinedstorage2.relay.help": "Turn entire sections of a storage network on or off and create new branches of your network.",
"item.refinedstorage2.quartz_enriched_iron": "Quartz Enriched Iron",
"item.refinedstorage2.quartz_enriched_copper": "Quartz Enriched Copper",
"item.refinedstorage2.processor_binding": "Processor Binding",
"item.refinedstorage2.silicon": "Silicon",
"item.refinedstorage2.raw_basic_processor": "Raw Basic Processor",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "refinedstorage2:block/quartz_enriched_copper_block"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "refinedstorage2:item/quartz_enriched_copper"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "refinedstorage2:block/quartz_enriched_copper_block"
}
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.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
"conditions": {
"items": [
{
"items": [
"refinedstorage2:storage_monitor"
]
"items": "refinedstorage2:storage_monitor"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"conditions": {
"items": [
{
"tag": "refinedstorage2:relays"
"items": "#refinedstorage2:relays"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"conditions": {
"items": [
{
"tag": "refinedstorage2:cables"
"items": "#refinedstorage2:cables"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"conditions": {
"items": [
{
"tag": "refinedstorage2:constructors"
"items": "#refinedstorage2:constructors"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"conditions": {
"items": [
{
"tag": "refinedstorage2:destructors"
"items": "#refinedstorage2:destructors"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"conditions": {
"items": [
{
"tag": "refinedstorage2:detectors"
"items": "#refinedstorage2:detectors"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
"conditions": {
"items": [
{
"items": [
"refinedstorage2:disk_drive"
]
"items": "refinedstorage2:disk_drive"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"conditions": {
"items": [
{
"tag": "refinedstorage2:exporters"
"items": "#refinedstorage2:exporters"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"conditions": {
"items": [
{
"tag": "refinedstorage2:importers"
"items": "#refinedstorage2:importers"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
"conditions": {
"items": [
{
"items": [
"refinedstorage2:interface"
]
"items": "refinedstorage2:interface"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"conditions": {
"items": [
{
"tag": "refinedstorage2:disk_interfaces"
"items": "#refinedstorage2:disk_interfaces"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
"conditions": {
"items": [
{
"tag": "refinedstorage2:network_transmitters"
"items": "#refinedstorage2:network_transmitters"
},
{
"tag": "refinedstorage2:network_receivers"
"items": "#refinedstorage2:network_receivers"
},
{
"items": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
"conditions": {
"items": [
{
"items": [
"refinedstorage2:portable_grid"
]
"items": "refinedstorage2:portable_grid"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"conditions": {
"items": [
{
"tag": "refinedstorage2:controllers"
"items": "#refinedstorage2:controllers"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"conditions": {
"items": [
{
"tag": "refinedstorage2:security_managers"
"items": "#refinedstorage2:security_managers"
},
{
"items": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"conditions": {
"items": [
{
"tag": "refinedstorage2:external_storages"
"items": "#refinedstorage2:external_storages"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"conditions": {
"items": [
{
"tag": "refinedstorage2:fluid_storage_disks"
"items": "#refinedstorage2:fluid_storage_disks"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"conditions": {
"items": [
{
"tag": "refinedstorage2:storage_disks"
"items": "#refinedstorage2:storage_disks"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
"conditions": {
"items": [
{
"items": [
"refinedstorage2:upgrade"
]
"items": "refinedstorage2:upgrade"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"conditions": {
"items": [
{
"tag": "refinedstorage2:crafting_grids"
"items": "#refinedstorage2:crafting_grids"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"conditions": {
"items": [
{
"tag": "refinedstorage2:grids"
"items": "#refinedstorage2:grids"
}
]
}
Expand Down
Loading

0 comments on commit 504b6ef

Please sign in to comment.