Skip to content

Commit

Permalink
add docs to material and add PushReaction
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredlll08 committed May 2, 2021
1 parent a302465 commit 3596767
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
Expand Up @@ -7,6 +7,7 @@
import com.google.common.collect.HashBiMap;
import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialColor;
import net.minecraft.block.material.PushReaction;
import org.openzen.zencode.java.ZenCodeType;

@ZenRegister
Expand Down Expand Up @@ -64,7 +65,9 @@ public class ExpandMaterial {
* Indicate if the material is opaque
*/
@ZenCodeType.Method
@ZenCodeType.Getter("opaque")
public static boolean isOpaque(Material internal) {

return internal.isOpaque();
}

Expand All @@ -74,6 +77,7 @@ public static boolean isOpaque(Material internal) {
@ZenCodeType.Method
@ZenCodeType.Getter("color")
public static MaterialColor getColor(Material internal) {

return internal.getColor();
}

Expand All @@ -82,51 +86,82 @@ public static MaterialColor getColor(Material internal) {
* Returns true if the block is a considered solid. This is true by default.
*/
@ZenCodeType.Method
@ZenCodeType.Getter("solid")
public static boolean isSolid(Material internal) {

return internal.isSolid();
}

/**
* Returns if the block can burn or not.
*/
@ZenCodeType.Method
@ZenCodeType.Getter("flammable")
public static boolean isFlammable(Material internal) {

return internal.isFlammable();
}

/**
* Returns if blocks of these materials are liquids.
*/
@ZenCodeType.Method
@ZenCodeType.Getter("liquid")
public static boolean isLiquid(Material internal) {

return internal.isLiquid();
}

/**
* Returns whether the material can be replaced by other blocks when placed - eg snow, vines and tall grass.
*/
@ZenCodeType.Method
@ZenCodeType.Getter("replaceable")
public static boolean isReplaceable(Material internal) {

return internal.isReplaceable();
}

/**
* Returns if this material is considered solid or not
*/
@ZenCodeType.Method
@ZenCodeType.Getter("blocksMovement")
public static boolean blocksMovement(Material internal) {

return internal.blocksMovement();
}

/**
* Gets this Material's {@link PushReaction}.
*
* @return The {@link PushReaction} of this Material.
*/
@ZenCodeType.Method
@ZenCodeType.Getter("pushReaction")
public static PushReaction getPushReaction(Material internal) {

return internal.getPushReaction();
}

/**
* Gets the bracket syntax for this Material
*
* @return The {@code <blockmaterial>} Bracket Syntax for this material
*/
@ZenCodeType.Method
@ZenCodeType.Getter("commandString")
public static String getCommandString(Material internal) {

final BiMap<Material, String> inverse = hardcodedMaterials.inverse();
final String name = inverse.getOrDefault(internal, "UNKNOWN");
return "<blockmaterial:" + name + ">";

}

public static Material tryGet(String tokens) {

return hardcodedMaterials.get(tokens.toUpperCase());
}

}
@@ -0,0 +1,13 @@
package com.blamejared.crafttweaker.impl_native.block.material;

import com.blamejared.crafttweaker.api.annotations.ZenRegister;
import com.blamejared.crafttweaker_annotations.annotations.Document;
import com.blamejared.crafttweaker_annotations.annotations.NativeTypeRegistration;
import net.minecraft.block.material.PushReaction;

@ZenRegister
@Document("vanilla/api/block/material/PushReaction")
@NativeTypeRegistration(value = PushReaction.class, zenCodeName = "crafttweaker.api.block.material.PushReaction")
public class ExpandPushReaction {

}

0 comments on commit 3596767

Please sign in to comment.