Skip to content

Commit

Permalink
Fix piston behavior (#62)
Browse files Browse the repository at this point in the history
* bump gradle and fabric loom

* bump fabric props

* fix block settings

* unify max count setting

* fix map color setting
  • Loading branch information
Aton-Kish committed Aug 20, 2023
1 parent 18a756c commit 122cab9
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 20 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "fabric-loom" version "1.2-SNAPSHOT"
id "fabric-loom" version "1.3-SNAPSHOT"
id "maven-publish"
id "com.matthewprenger.cursegradle" version "1.4.0"
id "com.modrinth.minotaur" version "2.+"
Expand Down Expand Up @@ -111,7 +111,7 @@ java {

jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
rename { "${it}_${project.base.archivesName.get()}"}
}
}

Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ org.gradle.parallel=true
# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.2
loader_version=0.14.21
yarn_mappings=1.20.1+build.10
loader_version=0.14.22

# Mod Properties
mod_version=2.4.1+1.20
Expand All @@ -15,7 +15,7 @@ org.gradle.parallel=true
archives_base_name=reinforced-shulker-boxes

# Dependencies
fabric_version=0.83.1+1.20.1
fabric_version=0.87.0+1.20.1
reinforced_core_version=3.1.2+1.20
reinforced_chests_version=2.4.2+1.20
quick_shulker_version=1.4.0-1.20
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
5 changes: 4 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private static void initializeReinforcedShulkerBoxes() {
materialSettings.getBlockSettings());
for (DyeColor color : DyeColor.values()) {
ReinforcedShulkerBoxesRegistry.registerMaterialDyeColorBlock(MOD_ID, material, color,
materialSettings.getBlockSettings());
materialSettings.getColorBlockSettings(color));
}
ReinforcedShulkerBoxesRegistry.registerMaterialBlockEntityType(MOD_ID, material);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@

import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.block.MapColor;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.ShulkerBoxBlockEntity;
import net.minecraft.block.enums.Instrument;
import net.minecraft.block.piston.PistonBehavior;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.DyeColor;

import atonkish.reinfcore.api.ReinforcedCoreRegistry;
import atonkish.reinfcore.util.ReinforcingMaterial;
Expand All @@ -20,33 +24,33 @@ public enum ReinforcingMaterialSettings {
.create()
.strength(2.0F, 6.0F)
.sounds(BlockSoundGroup.COPPER),
new Item.Settings().maxCount(1)),
new Item.Settings()),
IRON(ReinforcedCoreRegistry.registerReinforcingMaterial("iron", 54, Items.IRON_INGOT),
FabricBlockSettings
.create()
.instrument(Instrument.IRON_XYLOPHONE)
.strength(2.0F, 6.0F)
.sounds(BlockSoundGroup.METAL),
new Item.Settings().maxCount(1)),
new Item.Settings()),
GOLD(ReinforcedCoreRegistry.registerReinforcingMaterial("gold", 81, Items.GOLD_INGOT),
FabricBlockSettings
.create()
.instrument(Instrument.BELL)
.strength(2.0F, 6.0F)
.sounds(BlockSoundGroup.METAL),
new Item.Settings().maxCount(1)),
new Item.Settings()),
DIAMOND(ReinforcedCoreRegistry.registerReinforcingMaterial("diamond", 108, Items.DIAMOND),
FabricBlockSettings
.create()
.strength(2.0F, 6.0F)
.sounds(BlockSoundGroup.METAL),
new Item.Settings().maxCount(1)),
new Item.Settings()),
NETHERITE(ReinforcedCoreRegistry.registerReinforcingMaterial("netherite", 108, Items.NETHERITE_INGOT),
FabricBlockSettings
.create()
.strength(2.0F, 1200.0F)
.sounds(BlockSoundGroup.NETHERITE),
new Item.Settings().maxCount(1).fireproof());
new Item.Settings().fireproof());

private final ReinforcingMaterial material;
private final Block.Settings blockSettings;
Expand All @@ -58,24 +62,33 @@ private ReinforcingMaterialSettings(ReinforcingMaterial material, Block.Settings
BlockEntity blockEntity = world.getBlockEntity(pos);
if (!(blockEntity instanceof ShulkerBoxBlockEntity)) {
return true;
} else {
ShulkerBoxBlockEntity shulkerBoxBlockEntity = (ShulkerBoxBlockEntity) blockEntity;
return shulkerBoxBlockEntity.suffocates();
}
ShulkerBoxBlockEntity shulkerBoxBlockEntity = (ShulkerBoxBlockEntity) blockEntity;
return shulkerBoxBlockEntity.suffocates();
};

this.material = material;
this.blockSettings = blockSettings.dynamicBounds().nonOpaque()
.suffocates(contextPredicate).blockVision(contextPredicate);
this.itemSettings = itemSettings;
this.blockSettings = blockSettings.solid().dynamicBounds().nonOpaque()
.suffocates(contextPredicate).blockVision(contextPredicate)
.pistonBehavior(PistonBehavior.DESTROY).solidBlock(Blocks::always);
this.itemSettings = itemSettings.maxCount(1);
}

public ReinforcingMaterial getMaterial() {
return this.material;
}

public Block.Settings getBlockSettings() {
return this.blockSettings;
return this.blockSettings.mapColor(MapColor.PURPLE);
}

public Block.Settings getColorBlockSettings(DyeColor color) {
MapColor mapColor = switch (color) {
case PURPLE -> MapColor.TERRACOTTA_PURPLE;
default -> color.getMapColor();
};

return this.blockSettings.mapColor(mapColor);
}

public Item.Settings getItemSettings() {
Expand Down

0 comments on commit 122cab9

Please sign in to comment.