Skip to content

Commit

Permalink
Cherrypick to 1.20 (#449)
Browse files Browse the repository at this point in the history
* Add setters to `ToolProperty` allowing materials toolstats to be changed via kubejs (#446)

* fix: large mixer has the wrong casing

* fix: pipe textures

---------

Co-authored-by: BlackDragon2447 <[email protected]>
  • Loading branch information
screret and blackdragon2447 authored Oct 4, 2023
1 parent c057b9f commit a1d3c5c
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 14 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
* fix crash when joining servers
* fix pipe covers not having collision
* add oilsands veins
* fix machines sometimes losing NBT
* fix machines sometimes losing NBT
* fix large mixer using the wrong casing
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static BlockColor tintedColor() {
}

public int tinted(BlockState blockState, @Nullable BlockAndTintGetter blockAndTintGetter, @Nullable BlockPos blockPos, int index) {
return index == 1 ? material.getMaterialRGB() : -1;
return index == 0 || index == 1 ? material.getMaterialRGB() : -1;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import it.unimi.dsi.fastutil.objects.Object2IntArrayMap;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.world.item.enchantment.Enchantment;
import org.apache.commons.lang3.ArrayUtils;

Expand All @@ -20,6 +21,7 @@ public class ToolProperty implements IMaterialProperty<ToolProperty> {
* Default: 1.0F
*/
@Getter
@Setter
private float harvestSpeed;

/**
Expand All @@ -28,6 +30,7 @@ public class ToolProperty implements IMaterialProperty<ToolProperty> {
* Default: 1.0F
*/
@Getter
@Setter
private float attackDamage;

/**
Expand All @@ -36,6 +39,7 @@ public class ToolProperty implements IMaterialProperty<ToolProperty> {
* Default: 0.0F
*/
@Getter
@Setter
private float attackSpeed;

/**
Expand All @@ -44,6 +48,7 @@ public class ToolProperty implements IMaterialProperty<ToolProperty> {
* Default: 100
*/
@Getter
@Setter
private int durability;

/**
Expand All @@ -52,6 +57,7 @@ public class ToolProperty implements IMaterialProperty<ToolProperty> {
* Default: 2 (Iron).
*/
@Getter
@Setter
private int harvestLevel;

/**
Expand All @@ -60,32 +66,37 @@ public class ToolProperty implements IMaterialProperty<ToolProperty> {
* Default: 10
*/
@Getter
@Setter
private int enchantability = 10;

/**
* If crafting tools should not be made from this material
*/
@Getter
@Setter
private boolean ignoreCraftingTools;

/**
* If tools made of this material should be unbreakable and ignore durability checks.
*/
@Getter
@Setter
private boolean isUnbreakable;

/**
* If tools made of this material should be "magnetic," meaning items go
* directly into the player's inventory instead of dropping on the ground.
*/
@Getter
@Setter
private boolean isMagnetic;

/**
* A multiplier to the base durability for this material
* Mostly for modpack makers
*/
@Getter
@Setter
private int durabilityMultiplier = 1;

private MaterialToolTier toolTier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ public List<BakedQuad> bakeQuads(@Nullable Direction side, int connections) {

if (side != null) {
if (thickness == 1) { // full block
BakedQuad base = FaceQuad.builder(side, sideSprite).cube(coreCube.inflate(-0.001)).cubeUV().tintIndex(1).bake();
return List.of(base);
return List.of(FaceQuad.builder(side, sideSprite).cube(coreCube).cubeUV().tintIndex(0).bake());
}

if (isConnected(connections, side)) { // side connected
Expand All @@ -109,7 +108,7 @@ public List<BakedQuad> bakeQuads(@Nullable Direction side, int connections) {
if (sideOverlaySprite != null) {
for (Direction face : Direction.values()) {
if (face != side && face != side.getOpposite()) {
quads.add(FaceQuad.builder(face, sideOverlaySprite).cube(sideCubes.get(side).inflate(-0.000)).cubeUV().tintIndex(0).bake());
quads.add(FaceQuad.builder(face, sideOverlaySprite).cube(sideCubes.get(side).inflate(-0.000)).cubeUV().tintIndex(2).bake());
}
}
}
Expand All @@ -124,18 +123,18 @@ public List<BakedQuad> bakeQuads(@Nullable Direction side, int connections) {
// render core cube
for (Direction face : Direction.values()) {
if (!isConnected(connections, face)) {
quads.add(FaceQuad.builder(face, sideSprite).cube(coreCube).cubeUV().tintIndex(1).bake());
quads.add(FaceQuad.builder(face, sideSprite).cube(coreCube).cubeUV().tintIndex(0).bake());
}
// render each connected side
for (Direction facing : Direction.values()) {
if (facing.getAxis() != face.getAxis()) {
if (isConnected(connections, facing)) {
quads.add(FaceQuad.builder(face, sideSprite).cube(sideCubes.get(facing)).cubeUV().tintIndex(1).bake());
if (endOverlaySprite != null) {
quads.add(FaceQuad.builder(face, endOverlaySprite).cube(sideCubes.get(facing).inflate(0.01)).cubeUV().tintIndex(0).bake());
}
quads.add(FaceQuad.builder(face, sideSprite).cube(sideCubes.get(facing)).cubeUV().tintIndex(0).bake());
//if (endOverlaySprite != null) {
// quads.add(FaceQuad.builder(face, endOverlaySprite).cube(sideCubes.get(facing).inflate(0.01)).cubeUV().tintIndex(0).bake());
//}
if (sideOverlaySprite != null) {
quads.add(FaceQuad.builder(face, sideOverlaySprite).cube(sideCubes.get(facing).inflate(0.001)).cubeUV().tintIndex(0).bake());
quads.add(FaceQuad.builder(face, sideOverlaySprite).cube(sideCubes.get(facing).inflate(0.001)).cubeUV().tintIndex(2).bake());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ public static void init() {}
.rotationState(RotationState.NON_Y_AXIS)
.recipeType(MIXER_RECIPES)
.recipeModifier(GTRecipeModifiers.PARALLEL_HATCH.apply(OverclockingLogic.PERFECT_OVERCLOCK, GTRecipeModifiers.ELECTRIC_OVERCLOCK))
.appearanceBlock(CASING_VIBRATION_SAFE)
.appearanceBlock(CASING_REACTION_SAFE)
.pattern(definition -> FactoryBlockPattern.start()
.aisle("#XXX#","#XXX#","#XXX#","#XXX#","#XXX#","##F##")
.aisle("XXXXX","XAPAX","XAAAX","XAPAX","XAAAX","##F##")
.aisle("XXXXX","XPPPX","XAPAX","XPPPX","XAGAX","FFGFF")
.aisle("XXXXX","XAPAX","XAAAX","XAPAX","XAAAX","##F##")
.aisle("#XXX#","#XSX#","#XXX#","#XXX#","#XXX#","##F##")
.where('S', controller(blocks(definition.get())))
.where('X', blocks(CASING_VIBRATION_SAFE.get()).setMinGlobalLimited(14)
.where('X', blocks(CASING_REACTION_SAFE.get()).setMinGlobalLimited(14)
.or(autoAbilities(definition.getRecipeTypes()))
.or(Predicates.autoAbilities(true, false, true)))
.where('F', blocks(ChemicalHelper.getBlock(TagPrefix.frameGt, GTMaterials.HastelloyX)))
Expand All @@ -161,7 +161,7 @@ public static void init() {}
.where('A', Predicates.air())
.where('#', Predicates.any())
.build())
.workableCasingRenderer(GTCEu.id("block/casings/gcym/vibration_safe_casing"),
.workableCasingRenderer(GTCEu.id("block/casings/gcym/reaction_safe_mixing_casing"),
GTCEu.id("block/multiblock/gcym/large_mixer"), false)
.compassSections(GTCompassSections.TIER[IV])
.compassNodeSelf()
Expand Down

0 comments on commit a1d3c5c

Please sign in to comment.