Skip to content

Commit

Permalink
Merge pull request #131 from Chainmail-Studios/shnup
Browse files Browse the repository at this point in the history
i hate holo bridges
  • Loading branch information
Shnupbups authored Jul 1, 2020
2 parents 41e27cf + 8b95cc1 commit b02d9d3
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.github.chainmailstudios.astromine.access;

public interface DyeColorAccess {
int getColor();
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
import net.minecraft.world.BlockView;
import net.minecraft.world.World;

import com.github.chainmailstudios.astromine.access.DyeColorAccess;
import com.github.chainmailstudios.astromine.common.block.base.DefaultedHorizontalFacingBlockWithEntity;
import com.github.chainmailstudios.astromine.common.block.entity.HolographicBridgeProjectorBlockEntity;
import com.github.chainmailstudios.astromine.mixin.DyeColorMixin;
import spinnery.widget.api.Color;

public class HolographicBridgeProjectorBlock extends DefaultedHorizontalFacingBlockWithEntity {
Expand All @@ -32,7 +34,16 @@ public ActionResult onUse(BlockState state, World world, BlockPos position, Play
HolographicBridgeProjectorBlockEntity entity = (HolographicBridgeProjectorBlockEntity) world.getBlockEntity(position);

if (entity != null) {
entity.color = Color.of(0x7e000000 >> 2 | dye.getColor().getFireworkColor());
entity.color = Color.of(0x7e000000 >> 2 | ((DyeColorAccess)(Object)dye.getColor()).getColor());
if(!world.isClient()) entity.sync();
if(entity.hasChild()) {
entity.getChild().color = Color.of(0x7e000000 >> 2 | ((DyeColorAccess)(Object)dye.getColor()).getColor());
if(!world.isClient()) entity.getChild().sync();
}
if(entity.hasParent()) {
entity.getParent().color = Color.of(0x7e000000 >> 2 | ((DyeColorAccess)(Object)dye.getColor()).getColor());
if(!world.isClient()) entity.getParent().sync();
}

if (!player.isCreative()) {
stack.decrement(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ public boolean buildBridge() {
return false;
}
}
if(!world.isClient()) {
sync();
}
return true;
}

Expand Down Expand Up @@ -271,6 +274,9 @@ public void destroyBridge() {
}
}
}
if(!world.isClient()) {
sync();
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.github.chainmailstudios.astromine.mixin;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

import net.minecraft.util.DyeColor;

import com.github.chainmailstudios.astromine.access.DyeColorAccess;

@Mixin(DyeColor.class)
public class DyeColorMixin implements DyeColorAccess {
@Shadow
int color;

public int getColor() {
return color;
}
}
5 changes: 5 additions & 0 deletions src/main/resources/assets/astromine/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@
"text.astromine.astronautics.space_suit.title": "Space Suit",
"text.astromine.astronautics.space_suit.page_one.title": "Space Suit",
"text.astromine.astronautics.space_suit.page_one.text": "Vital for survival in hostile environments, a Space Suit is the most important thing one may carry. $(p)With internal tanks which may be pressurized in certain machines, it may be filled with (un-)breathable gases fit for whoever is wearing it.",
"text.astromine.astronautics.rocket.title": "Rocket",
"text.astromine.astronautics.rocket.page_one.title": "Rocket",
"text.astromine.astronautics.rocket.page_one.text": "Your ticket to the final frontier.",
"text.astromine.astronautics.rocket.page_two.title": "Crafting and Notes",
"text.astromine.astronautics.rocket.page_two.text": "Right click with a $(item)Flint and Steel$() to launch. Right click with a $(item)Stick$() to destroy. These are both temporary measures.",
"text.astromine.components.circuits.title": "Circuits",
"text.astromine.components.circuits.page_one.title": "Basic Circuit",
"text.astromine.components.circuits.page_one.text": "A basic electric circuit board, built for general systems with no special requirements, whose architecture is based on graphene.",
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/astromine.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"package": "com.github.chainmailstudios.astromine.mixin",
"compatibilityLevel": "JAVA_8",
"mixins": [
"AbstractMinecartEntityMixin", "BrewingRecipeRegistryMixin", "BucketItemMixin",
"EntityMixin", "FishingBobberEntityMixin", "FlamingAnvilCraftingMixin",
"GravityEntityMixin", "HoneyBlockMixin", "HopperBlockEntityMixin", "ItemEntityMixin", "LivingEntityMixin",
"SlimeEntityMixin", "SquidEntityMixin", "StepAndDestroyBlockGoalMixin", "ThreadExecutorMixin", "WorldChunkMixin"
"AbstractMinecartEntityMixin", "BrewingRecipeRegistryMixin", "BucketItemMixin", "DyeColorMixin", "EntityMixin",
"FishingBobberEntityMixin", "FlamingAnvilCraftingMixin", "GravityEntityMixin", "HoneyBlockMixin",
"HopperBlockEntityMixin", "ItemEntityMixin", "LivingEntityMixin", "SlimeEntityMixin", "SquidEntityMixin",
"StepAndDestroyBlockGoalMixin", "ThreadExecutorMixin", "WorldChunkMixin"
],
"client": [
"BossBarHudMixin", "BuiltinModelItemRendererMixin", "CurrentDownParticleMixin", "EggEntityMixin",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "text.astromine.astronautics.rocket.title",
"icon": "astromine:rocket",
"category": "astronautics",
"sortnum": 0,
"pages": [
{
"type": "entity",
"entity": "astromine:rocket",
"name": "text.astromine.astronautics.rocket.page_one.title",
"text": "text.astromine.astronautics.rocket.page_one.text"
},
{
"type": "crafting",
"recipe": "astromine:rocket",
"title": "text.astromine.astronautics.rocket.page_two.title",
"text": "text.astromine.astronautics.rocket.page_two.text"
}
]
}

0 comments on commit b02d9d3

Please sign in to comment.