Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Devan-Kerman <[email protected]>
  • Loading branch information
Devan-Kerman committed May 17, 2021
1 parent 831d0ea commit e03913b
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repositories {
}
dependencies {
modImplementation group: 'net.devtech', name: 'arrp', version: '0.3.11'
modImplementation group: 'net.devtech', name: 'arrp', version: '0.3.12'
}
```

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ loader_version=0.11.3
#Fabric api
fabric_version=0.34.2+1.16
# Mod Properties
mod_version=0.3.11
mod_version=0.3.12
maven_group=net.devtech
archives_base_name=arrp
# Dependencies
6 changes: 6 additions & 0 deletions src/main/java/net/devtech/arrp/json/blockstate/JState.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;

import net.minecraft.util.Identifier;

public final class JState {
private final List<JVariant> variants = new ArrayList<>();
private final List<JMultipart> multiparts = new ArrayList<>();
Expand Down Expand Up @@ -71,6 +73,10 @@ public static JBlockModel model(String id) {
return new JBlockModel(id);
}

public static JBlockModel model(Identifier id) {
return new JBlockModel(id);
}

public static JMultipart multipart(JBlockModel... models) {
JMultipart multipart = new JMultipart();
for (JBlockModel model : models) {
Expand Down
68 changes: 62 additions & 6 deletions src/main/java/net/devtech/arrp/json/lang/JLang.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import net.minecraft.entity.EntityType;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

Expand Down Expand Up @@ -55,24 +57,78 @@ public JLang entry(String entry, String name) {
return this;
}


/**
* adds a translation key for an item, respects {@link Item#getTranslationKey()}
*/
public JLang itemRespect(Item item, String name) {
this.lang.put(item.getTranslationKey(), name);
return this;
}

public JLang item(ItemStack stack, String name) {
this.lang.put(stack.getTranslationKey(), name);
return this;
}

/**
* @see JLang#itemRespect(Item, String) uses the {@link Item#getTranslationKey()}}
*/
@Deprecated
public JLang item(Item item, String name) {
return this.object(Registry.ITEM, "item", item, name);
}

/**
* adds a translation key for an block, respects {@link Block#getTranslationKey()}
*/
public JLang blockRespect(Block block, String name) {
this.lang.put(block.getTranslationKey(), name);
return this;
}

/**
* @see JLang#blockRespect(Block, String) uses the {@link Block#getTranslationKey()}}
*/
@Deprecated
public JLang block(Block block, String name) {
return this.object(Registry.BLOCK, "block", block, name);
}

public JLang fluid(Fluid id, String name) {
return this.object(Registry.FLUID, "fluid", id, name);
public JLang fluid(Fluid fluid, String name) {
return this.object(Registry.FLUID, "fluid", fluid, name);
}

/**
* adds a translation key for an entity, respects {@link EntityType#getTranslationKey()}
*/
public JLang entityRespect(EntityType<?> type, String name) {
this.lang.put(type.getTranslationKey(), name);
return this;
}

/**
* @see JLang#entityRespect(EntityType, String) uses the {@link EntityType#getTranslationKey()}}
*/
@Deprecated
public JLang entity(EntityType<?> type, String name) {
return this.object(Registry.ENTITY_TYPE, "entity_type", type, name);
}

public JLang entity(EntityType<?> id, String name) {
return this.object(Registry.ENTITY_TYPE, "entity_type", id, name);
/**
* adds a translation key for an entity, respects {@link Enchantment#getTranslationKey()}
*/
public JLang enchantmentRespect(Enchantment enchantment, String name) {
this.lang.put(enchantment.getTranslationKey(), name);
return this;
}

public JLang enchantment(Enchantment id, String name) {
return this.object(Registry.ENCHANTMENT, "enchantment", id, name);
/**
* @see JLang#enchantmentRespect(Enchantment, String) uses the {@link Enchantment#getTranslationKey()}}
*/
@Deprecated
public JLang enchantment(Enchantment enchantment, String name) {
return this.object(Registry.ENCHANTMENT, "enchantment", enchantment, name);
}

public JLang item(Identifier item, String name) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/devtech/arrp/json/models/JFace.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class JFace implements Cloneable {
private final String texture;
private String cullface;
private Integer rotation;
private Integer tintIndex;
private Integer tintindex;

/**
* @see JModel#face(String)
Expand Down Expand Up @@ -45,7 +45,7 @@ public JFace rot270() {
}

public JFace tintIndex(int index) {
this.tintIndex = index;
this.tintindex = index;
return this;
}

Expand Down
9 changes: 9 additions & 0 deletions src/main/java/net/devtech/arrp/json/models/JModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.Arrays;
import java.util.List;

import net.minecraft.util.Identifier;
import net.minecraft.util.math.Direction;

/**
Expand Down Expand Up @@ -45,6 +46,10 @@ public static JModel modelKeepElements(String parent) {
return model;
}

public static JModel modelKeepElements(Identifier identifier) {
return modelKeepElements(identifier.toString());
}

public static JModel model() {
return new JModel();
}
Expand All @@ -55,6 +60,10 @@ public static JModel model(String parent) {
return model;
}

public static JModel model(Identifier identifier) {
return model(identifier.toString());
}

public static JDisplay display() {
return new JDisplay();
}
Expand Down

0 comments on commit e03913b

Please sign in to comment.