Skip to content

Commit

Permalink
Merge branch 'FabricMC:1.20.1' into 1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Phoupraw authored Nov 4, 2023
2 parents cc27ca5 + cff3450 commit 6f4b2f5
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,12 @@ public boolean validate(String value) {
try {
final double d = Double.parseDouble(value);

return this.inBounds(d);
if (!this.inBounds(d)) {
return false;
}

this.value = d;
return true;
} catch (NumberFormatException ignored) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
public interface ValidateableRule {
/**
* Validates if a rule can accept the input.
* If valid, the input will be set as the rule's value.
*
* @param value the value to validate
* @return true if the value can be accepted.
* @return true if the value was accepted.
*/
boolean validate(String value);
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,18 @@ protected FabricBlockSettings(AbstractBlock.Settings settings) {
thisAccessor.setDynamicBounds(otherAccessor.getDynamicBounds());
thisAccessor.setOpaque(otherAccessor.getOpaque());
thisAccessor.setIsAir(otherAccessor.getIsAir());
thisAccessor.setBurnable(otherAccessor.getBurnable());
thisAccessor.setLiquid(otherAccessor.getLiquid());
thisAccessor.setForceNotSolid(otherAccessor.getForceNotSolid());
thisAccessor.setForceSolid(otherAccessor.getForceSolid());
this.pistonBehavior(otherAccessor.getPistonBehavior());
thisAccessor.setToolRequired(otherAccessor.isToolRequired());
thisAccessor.setOffsetter(otherAccessor.getOffsetter());
thisAccessor.setBlockBreakParticles(otherAccessor.getBlockBreakParticles());
thisAccessor.setRequiredFeatures(otherAccessor.getRequiredFeatures());
this.emissiveLighting(otherAccessor.getEmissiveLightingPredicate());
this.instrument(otherAccessor.getInstrument());
thisAccessor.setReplaceable(otherAccessor.getReplaceable());

// Not copied in vanilla: field definition order
this.jumpVelocityMultiplier(otherAccessor.getJumpVelocityMultiplier());
Expand All @@ -82,7 +90,6 @@ protected FabricBlockSettings(AbstractBlock.Settings settings) {
this.suffocates(otherAccessor.getSuffocationPredicate());
this.blockVision(otherAccessor.getBlockVisionPredicate());
this.postProcess(otherAccessor.getPostProcessPredicate());
this.emissiveLighting(otherAccessor.getEmissiveLightingPredicate());
}

public static FabricBlockSettings create() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.BlockState;
import net.minecraft.block.MapColor;
import net.minecraft.block.enums.Instrument;
import net.minecraft.block.piston.PistonBehavior;
import net.minecraft.entity.EntityType;
import net.minecraft.resource.featuretoggle.FeatureSet;
import net.minecraft.sound.BlockSoundGroup;
Expand Down Expand Up @@ -106,6 +108,27 @@ public interface AbstractBlockSettingsAccessor {
@Accessor
FeatureSet getRequiredFeatures();

@Accessor
boolean getBurnable();

@Accessor
boolean getLiquid();

@Accessor
boolean getForceNotSolid();

@Accessor
boolean getForceSolid();

@Accessor
PistonBehavior getPistonBehavior();

@Accessor
Instrument getInstrument();

@Accessor
boolean getReplaceable();

/* SETTERS */
@Accessor
void setCollidable(boolean collidable);
Expand Down Expand Up @@ -139,4 +162,19 @@ public interface AbstractBlockSettingsAccessor {

@Accessor
void setOffsetter(Optional<AbstractBlock.Offsetter> offsetter);

@Accessor
void setBurnable(boolean burnable);

@Accessor
void setLiquid(boolean liquid);

@Accessor
void setForceNotSolid(boolean forceNotSolid);

@Accessor
void setForceSolid(boolean forceSolid);

@Accessor
void setReplaceable(boolean replaceable);
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,14 @@ public Storage<FluidVariant> find(ItemStack itemStack, ContainerItemContext cont
}

public static Event<FluidStorage.CombinedItemApiProvider> getOrCreateItemEvent(Item item) {
// register here is thread-safe, so the query below will return a valid provider (possibly one registered before or from another thread).
FluidStorage.ITEM.registerForItems(new Provider(), item);
ItemApiLookup.ItemApiProvider<Storage<FluidVariant>, ContainerItemContext> existingProvider = FluidStorage.ITEM.getProvider(item);

if (existingProvider == null) {
FluidStorage.ITEM.registerForItems(new Provider(), item);
// The provider might not be new Provider() if a concurrent registration happened, re-query.
existingProvider = FluidStorage.ITEM.getProvider(item);
}

if (existingProvider instanceof Provider registeredProvider) {
return registeredProvider.event;
} else {
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx2560M
org.gradle.parallel=true
fabric.loom.multiProjectOptimisation=true

version=0.90.0
version=0.90.7
minecraft_version=1.20.1
yarn_version=+build.1
loader_version=0.14.21
Expand All @@ -28,7 +28,7 @@ fabric-dimensions-v1-version=2.1.53
fabric-entity-events-v1-version=1.5.22
fabric-events-interaction-v0-version=0.6.1
fabric-events-lifecycle-v0-version=0.2.62
fabric-game-rule-api-v1-version=1.0.38
fabric-game-rule-api-v1-version=1.0.39
fabric-gametest-api-v1-version=1.2.12
fabric-item-api-v1-version=2.1.27
fabric-item-group-api-v1-version=4.0.11
Expand All @@ -43,7 +43,7 @@ fabric-model-loading-api-v1-version=1.0.2
fabric-models-v0-version=0.4.1
fabric-networking-api-v1-version=1.3.10
fabric-networking-v0-version=0.3.50
fabric-object-builder-api-v1-version=11.1.1
fabric-object-builder-api-v1-version=11.1.2
fabric-particles-v1-version=1.1.1
fabric-recipe-api-v1-version=1.0.20
fabric-registry-sync-v0-version=2.3.2
Expand All @@ -59,7 +59,7 @@ fabric-resource-loader-v0-version=0.11.9
fabric-screen-api-v1-version=2.0.7
fabric-screen-handler-api-v1-version=1.3.29
fabric-sound-api-v1-version=1.0.12
fabric-transfer-api-v1-version=3.3.1
fabric-transfer-api-v1-version=3.3.2
fabric-transitive-access-wideners-v1-version=4.3.0
fabric-convention-tags-v1-version=1.5.4
fabric-client-tags-api-v1-version=1.1.1

0 comments on commit 6f4b2f5

Please sign in to comment.